0
그의 모든 자녀 읽어속성으로 태그를 찾아 나는이 xml 파일이
<?xml version="1.0" encoding="UTF-8"?>
<Products>
<Product productName="testProduct1">
<Fields>
<Field name="Stack" />
<Field name="Overflow" />
</Fields>
<AnotherFields>
<Field name="Test" />
</AnotherFields>
</Product>
<Product productName="testProduct">
<Fields>
<Field name="StackOverflow" />
</Fields>
</Product>
</Products>
을 그리고 속성 productName
의 독점적 인 가치를 가지고 product
의 모든 자식 태그를 읽을 수에게, 다른 모든 태그는 생략 할 것입니다 .
public void mainParser(XmlResourceParser configXML, String productNameParameter)
throws XmlPullParserException, IOException {
int eventType = -1;
String strName, productName;
while (eventType != XmlResourceParser.END_DOCUMENT) {
if (eventType == XmlResourceParser.START_TAG) {
strName = configXML.getName();
if (strName.equals("Product")) {
if (eventType == XmlResourceParser.START_TAG) {
productName = configXML.getAttributeValue(null, "productName");
if (productName.equals(productNameParameter)) {
eventType = configXML.next();
//here is the problem
}
}
}
}
eventType = configXML.next();
}
}
누군가가 도와 드릴까요 :
그리고 여기에 내가 끼 었어 내 자바 코드?