Remove Texte Node From GATE XML File

397 views Asked by At

Here is my file XML that i should remove the texte correspondant of Type Address from that(I mean's number phone here).

<Node id="96"/>06<Node id="98"/>.<Node id="99"/>46<Node id="101"/>.<Node id="102"/>20<Node id="104"/>.<Node id="105"/>47<Node id="107"/>.<Node id="108"/>41<Node id="110"/>

    <Annotation Id="1430" Type="Address" StartNode="96" EndNode="110">
    <Feature>
    <Name className="java.lang.String">rule1</Name>
    <Value className="java.lang.String">IPaddress1</Value>
    </Feature><Feature>
    <Name className="java.lang.String">kind</Name>
    <Value className="java.lang.String">ip</Value>
    </Feature><Feature>
    <Name className="java.lang.String">rule2</Name>
    <Value className="java.lang.String">IpFinal</Value>
    </Feature>
    </Annotation>

And here is my code Java ,but i can not remove my data that they have to annotated with Address over my document.

 org.w3c.dom.Document doc1 = docBuilder.parse (new File("out1.gate.xml"));


             NodeList nodes = doc1.getElementsByTagName("Address");
             for (int j = 0; j < nodes.getLength(); j++) {

                Element e= (Element) nodes.item(0);
                String pName = e.getTextContent();
                //System.out.println("L :"+ nodes.getLength());
                e.getParentNode().removeChild(e);

             }

Could you help me please for remove that ?
0

There are 0 answers