2010-05-31 57 views
1

两个命名空间创建XML元素,我想创建具有如下的命名空间的XML元素:使用的libxml的API

element name="Root" xmlns:xsi="myXSI" xmlns:xsd="myXSD" 

我已经与现有的API都没有检查出来,但它不是以这种形式获得。我正在为

Root xmlns:xsd:xsi="myXSI" xmlns:xmlns:xsd="myXSD" 

我使用下面这个APIss:

xmlTextWriterWriteAttributeNS(xmlWriter, BAD_CAST "xmlns:xsd", BAD_CAST "xsi" , BAD_CAST "myXSD", BAD_CAST "myXSI"); 

回答

1

尝试

xmlTextWriterWriteAttributeNS(xmlWriter, BAD_CAST "xmlns", BAD_CAST "xsi", NULL, BAD_CAST "myXSI"); 

xmlTextWriterWriteAttributeNS(xmlWriter, BAD_CAST "xmlns", BAD_CAST "xsd", NULL, BAD_CAST "myXSD");