2013-01-10 19 views
-1

喜想寫中,我們要插入如何與值一起提供的名稱屬性

<measType p="1">RRC.ConnEstabAtt.Cause</measType> 

XML我們使用

xmlTextWriterWriteFormatElement(writer, BAD_CAST "measType", "%s", "RRC.ConnEstabAtt.Cause"); 

但它簡單地打印輸出

<measType>RRC.ConnEstabAtt.Cause</measType> 
+0

您使用哪種語言和平臺?我們預計會猜測嗎? – Oded

回答

0

看起來您使用的是libxml2,您必須使用幾條不同的指令來獲取屬性。(請參閱http://www.xmlsoft.org/html/libxml-xmlwriter.html) 試着這麼做:

xmlTextWriterStartElement(writer, "measType"); 
xmlTextWriterWriteAttribute(writer, "p", "1"); 
xmlTextWriterWriteString("RRC.ConnEstabAtt.Cause"); 
xmlTextWriterEndElement(writer); 

乾杯,彼得。

+0

非常感謝您的回覆,它的工作正常 –

相關問題