Menu

Can't remove the last child element

Barry Liao
2009-03-06
2013-05-15
  • Barry Liao

    Barry Liao - 2009-03-06

    I always get the error messsage if i try to remove the last child which has its own children elements.

    Error Message:
    java.lang.IndexOutOfBoundsException
            at com.ximpleware.FastLongBuffer.longAt(FastLongBuffer.java:303)
            at com.ximpleware.VTDNav.getTokenDepth(VTDNav.java:1232)
            at com.ximpleware.VTDNav.getElementFragment(VTDNav.java:1096)
            at com.ximpleware.XMLModifier.remove(XMLModifier.java:203)

    Implement Code:
    XMLModifier modifier = new XMLModifier(nav);
    nav.toElement(VTDNav.LC);
    modifier.remove();

    XML content:
    <root>
            <NodeA>   
                    <SubNode1/>
                    <SubNode2/>
            </NodeA>
            <NodeB>   
                    <SubNode3/>
                    <SubNode4/>
            </NodeB>       
    </root>

    If I remove the children elements of NodeB, then it can be removed.
    <root>
            <NodeA>   
                    <SubNode1/>
                    <SubNode2/>
            </NodeA>
            <NodeB>   
            </NodeB>       
    </root>

    I think this must be a bug for VTD-XML, and I also try the lastest version 2.5.0,  the same problem appear.

     
    • jimmy zhang

      jimmy zhang - 2009-03-06

      will investigate and get back to u

       
    • jimmy zhang

      jimmy zhang - 2009-04-12

      this bug has been fixed...
      pls check out vtdNav.java in the repository
      let me know if there is any thing else

       

Log in to post a comment.