-1
XML에서 자식 노드를 추출하는 데 도움이 필요합니다. 내 XML 파일은 다음과 같으며 자식 노드 "Stereotype"이 있는지 note.by가 있는지 알고 싶습니다 NodeList nChilds = nNode.getChildNodes();은 내가 자식 노드를받을 수 있나요 만에 자식 노드를 찾을 수 없습니다. XML 파일은 XML 파일에서 자식 노드를 추출하는 데 도움이 필요합니다.
< Activity BacklogActivityId="0" BodyFontSize="0" Documentation_plain="" Id="xJmijDqGAqB8AQnX" Name="Activity" PmAuthor="mameh" PmCreateDateTime="2017-05-22T10:47:43.779" PmLastModified="2017-05-22T10:49:53.126" Postcondition="" Precondition="" QualityScore="-1" ReadOnly="false" Reentrant="false" SingleExecution="false" UserIDLastNumericValue="0">
< Stereotypes>
**Stereotype Idref="e5bijDqGAqB8AQuV" Name="Context_Activity"/>**
< /Stereotypes>
< MasterView>
< Activity Idref="3xmijDqGAqB8AQmn" Name="Activity"/>
< /MasterView>
< /Activity>
DocumentBuilderFactory dbFactory
= DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(inputFile);
doc.getDocumentElement().normalize();
System.out.println("Root element :"
+ doc.getDocumentElement().getNodeName());
NodeList nList = doc.getElementsByTagName("Activity");
System.out.println("----------------------------");
for (int temp = 0; temp < nList.getLength(); temp++) {
Node nNode = nList.item(temp);
NamedNodeMap att= nNode.getAttributes();
if(att.getLength()==15)
{
**NodeList nChilds = nNode.getChildNodes();**
System.out.println(nChilds.getLength());