Re: [xml] Questions about XML


Hi Tam:

I'm trying to add the special tag <?xml-stylesheet type="text/xsl" href="ehlXml.xsl"?> into my XML document, but I'm having trouble with this. First I got the root element by using xmlDocGetRootElement(), then I tried creating a PI node using xmlNewPI(), but I'm not sure what to pass as parameters into xmlNewPI().

        You should try:
xmlNewPI(BAD_CAST "xml-stylesheet", BAD_CAST "type=\"text/xsl\" href=\"ehlXml.xsl\"");

 Once the PI node is created, I'm
suppose to call xmlAddPrevSibling() to add the new node to the document, right?

It should work, but I prefer xmlAddChild() using document root element as it's parent node.

Additionally, where should I be making these function calls: after xmlTextWriterStartDocument() or before xmlSaveFileEnc()? Any help would be greatly appreciated.

        Since you are using tree module, you should use xmlParseFile()
to create a tree from a file or xmlNewDoc() to create a new tree in memory.

Lucas Brasilino
brasilino recife pe gov br
Emprel -        Empresa Municipal de Informatica (pt_BR)
                Municipal Computing Enterprise (en_US)
Recife - Pernambuco - Brasil
Fone: +55-81-34167078

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]