我正在使用STAX Parser解析XML文檔。 我有這個標籤之下爲什麼此XML標記的屬性計數爲0
<bustxml><![CDATA[<bustxml xmlns=\"http://www.bustprotocol.org/bustxml-5-0-SP2\"><NewOrdMBag TmInForce=\"0\" OrdTyp=\"1\" Acct=\"1234\"><Ord OrdQty=\"1\" </bustxml>
我需要閱讀上述標籤的屬性,所以我用
case XMLStreamConstants.START_ELEMENT:
for(int i = 0, n = reader.getAttributeCount(); i < n; ++i)
System.out.println("Attribute: " + reader.getAttributeName(i)
+ "" + reader.getAttributeValue(i));
但不幸的是我得到,Attrbute計數爲0。 請告訴我如何可以讀取所有bustxml標籤
在您的示例FYI中,您打開一個CDATA節而不關閉它 – Justin
嗨賈斯汀,爲安全性我沒有發佈整個XML。所以我想這不是一個問題。 – Pawan