I want to extract the only selected tags out of a XML file:
<Shape>
<ShapeType>H2</ShapeType>
<Annotation>
<Properties>
<PropertyValue PropertyName="field_label">label.modelSeriesCd</PropertyValue>
<PropertyValue PropertyName="ContainerType">conditionContainer</PropertyValue>
</Properties>
</Annotation>
<FootnoteNumber>1</FootnoteNumber>
<Name>label.modelSeriesCd</Name>
<Rectangle>
<Rectangle X="14" Y="94" Width="43" Height="12" />
</Rectangle>
</Shape>
<Shape>
<ShapeType>H2</ShapeType>
<Annotation>
<Properties>
<PropertyValue PropertyName="field_label">label.modelSeriesMd</PropertyValue>
<PropertyValue PropertyName="ContainerType">mContainer</PropertyValue>
</Properties>
</Annotation>
<FootnoteNumber>1</FootnoteNumber>
<Name>label.modelSeriesCd</Name>
<Rectangle>
<Rectangle X="14" Y="94" Width="43" Height="12" />
</Rectangle>
</Shape>
I want to extract only those tags which has "conditionContainer" as the value of "propertyValue" and all the tags inside tag I am trying below code :
private static void visitChildNodes(NodeList nList)
{
for (int index = 0; index < nList.getLength(); index++)
{
Node node = nList.item(index);
if (node.getNodeType() == Node.ELEMENT_NODE)
{
if(node.getNodeName().equalsIgnoreCase("shape"))
System.out.println("Node Name = " + node.getNodeName() + "; Value = " + node.getTextContent());
please suggest me a way to do this.