私はこのアンドロイドで同じ要素名のAndroid xml解析?
<parent>
<Title>1</Title>
<child>"Some data1"</child>
<child>"Some data2"</child>
<child>"Some data3"</child>
</parent>
<parent>
<Title>2</Title>
<child>"Some data1"</child>
<child>"Some data2"</child>
<child>"Some data3"</child>
</parent>
この(UP側)のようなXMLを解析するための任意のアイデアのようなXMLを持っているxmlファイルを解析する
編集:
この
ような構造であれば<parent>
<Title>2</Title>
<child>"Some data1"</child>
</parent>
i
NodeList nodes1 = doc.getElementsByTagName("parent");
for (int i = 0; i < nodes1.getLength(); i++) {
Objectclass ciro = new Objectclass();
Element e = (Element)nodes1.item(i);
ciro.Title = functionsClass.getValue(e, "Title");
ciro.child= functionsClass.getValue(e, "child");
ArrayListClass.ItemList.add(ciro);
}
ここで私はオブジェクトクラスのデータをストリーミングして、配列リストにオブジェクトを追加してから、必要な場所でデータを使用します。
が、私は、これらの値を得ることができますどのように親で同じ子の名前に問題
..<parent>
<Title>1</Title>
<child>"Some data1"</child>
<child>"Some data2"</child>
<child>"Some data3"</child>
</parent>
<parent>
<Title>2</Title>
<child>"Some data1"</child>
<child>"Some data2"</child>
<child>"Some data3"</child>
</parent>
このため任意のチュートリアル..あなたは、このリンクを見て、SAXParserのを使用する必要が
SAXパーサ、またはDOMパーサの実装に入ると、疑問を明確にしてください。このXMLには何も問題はありません。通常、XMLレコードはこの形式になっています方法だけ。 – jeet
誰もがこの問題を解決することができる場合: http://stackoverflow.com/questions/17421506/how-to-parse-same-tag-name-in-android-xml-dom-parsing – Altair