Re: [xml] How xmlNewDocProp() works?



On Tue, Nov 11, 2003 at 07:09:37PM +0300, ôÀÛÉÎ ÷ÁÄÉÍ \(forsys\) wrote:
   doc = xmlNewDoc((xmlChar*)"1.0");
   Attr = xmlNewDocProp(doc, (xmlChar*)"PropName", (xmlChar*)"prop value");
   ..........................................

What is wrong?

  Document cannot hold attributes, only elements can !!!

==========================================================

2) "xmlDoc" structure has field "encoding". I couldn't find functions to read this field, or write into it. 
Can I do it directly simply writing somethign like this:

{
   xmlDocPtr doc=NULL;
 
   doc = xmlNewDoc((xmlChar*)"1.0");
   doc->encoding = "iso-8859-5";
   ..........................................
}

or I am wrong and there are stil some functions and I just didn't find them?

  xmlFreedoc will crash if you do this. You should *NOT* have to edit
this field. It will not do what you hope. It's only used when saving back
and in that case the target encoding can be specified to the serialization
function. It's possible to update teh string but not with a constant one.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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