Re: [xml] xmlTextWriter and namespace




Yong Chen (yongche) wrote:
   rc = xmlTextWriterStartElementNS(writer, "my_prefix", BAD_CAST
"ORDER", "www.my.com");

The node "ORDER" will have namespace set to "my_prefix" which has value
of "www.my.com" as following:

 <my_prefix:ORDER xmlns:my_prefix="www.my.com">


My question is, if I want to define several more namespaces (including
the default namespace) on node "ORDER", as following:

  <my_prefix:ORDER xmlns:my_prefix="www.my.com" xmlns="www.my1.com"
xmlns:my_prefix_2="www.my2.com">

How do I do it? Which API to call?
You can simply write them out as attributes:
xmlTextWriterWriteAttribute(writer, "xmlns", "www.my1.com");
xmlTextWriterWriteAttribute(writer, "xmlns:my_prefix_2", "www.my2.com");

Rob



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