DOM, NODE -- MyNode??

Hi,
I need to do some implementation for a research project on XML. Basically I need to parse an XML document using DOM.
Then traverse the tree structure with the help of NODE. I will take advantage of the comprehensive functions provided by interface NODE, e.g. getAttributes(), getFirstChildNode()...However, i still
need to accommodate some additional information, such as the path for each node,e.g. Root.Child1.grandChild2.... To associate such extra data, I plan to create a subclass of NODE, MyNode, which may also implement
some methods, such as setPath(), getPath()...for extra usage of 'path' information.
My questions are:
1. Since NODE is of type Interface, is it possible to create such a subclass, MyNode of it??
If yes, how should this be done? Since the tree structure is built by built-in function of DOM. Seems like no human intervention is allowed during the tree-building process.A typical piece of code using DOM may be:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder =  factory.newDocumentBuilder();
Document document = builder.parse("hello.xml");
Element root = document.getDocumentElement();
Node textNode = root.getFirstChild();
System.out.println(textNode.getNodeValue());
Blah Blah...How should the above snippet be adapted to fit MyNode? I think probably I should change the 4th line to:
MyNode root = builder.parse("hello.xml");
Will this work as intended?
2. How should the subclass, MyNode be constructed??
What is in my mind is as follows:
public class MyNode extends Element
//or here maybe Node, this goes back to my first question;I am not exactly sure which should be the parent class)  =|
   {       String path = "";
     //the constructor
     public MyNode(Node originalNode){
          super();     //should I invoke the constructor of its parent, NODE here???
          this.setPath();
     void setPath(){
           this.path = (MyNode)(this.getParentNode()).getPath() + (MyNode)(this.getParentNode()).getNodeName();
     String getPath(){
           return this.path;
    }Will the above construction of class MyNode work properly??
Many thanks in advance for any help on this topic. Some code example is very appreciated.
Frank

Many thanks for your reply.
I looked into your point.I understand that later versions of DOM support association of extra user information to any NODE object, by pairwisely using setUserData(String key, Object data, UserDataHandler handler), getUserData(String key), as illustrated at http://java.sun.com/j2se/1.5.0/docs/guide/plugin/dom/org/w3c/dom/Node.html. So besides all parsing automation of DOM in my implementation, I still have to explicitly specify the extra information, by setUserData for each NODE object before actually calling the getUserData method.More precisely, I should give it a NAME, presented by key, and the value for each object, object, while both key and object refer back to the command syntax above. Is my understanding correct?
I dont know the version of the code example in my 1st post of setting up a DOM parser. Can I directly invoke the two commands directly? The other aspect is that the project is based on my work last year, in which the DOM parser was set up running that way. In case it is not a DOM3, i.e. the 2 useful functions are not available to its version, can I simply upgrade it to DOM3 standard by ONLY modify its setup to something* like:
System.setProperty(DOMImplementationRegistry.PROPERTY,
      "org.apache.xerces.dom.DOMImplementationSourceImpl");
    DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
     DOMImplementation impl = registry.getDOMImplementation("[XML_file_name]");  //The parameter was originally 'LS-Load', is this the XML file name??
    if (impl == null) {
        System.err.println("Coudl not locate a DOM3 Parser");
        return;   
    DOMImplementationLS implls = (DOMImplementationLS) impl;
    LSParser parser = implls.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
    Document d = parser.parseURI(args); //Where can I specify the XML document to be parsed?? I wont need to use 'NameSpace' by the way.
*:an excerpt from Section 'Parsing documents with DOM3' on http://www.ibiblio.org/xml/slides/sd2004west/dom3/DOM_Level_3.html
Will this 'upgrading' successful? If so, most part of work last year may be reused without further modification.
To be frank, I dont really understand how this excerpt works. Can you plese explain a bit more? If it is not the proper setting up of the DOM parser incorporating the two useful functions, can you please refer me to the right direction?
Thanks & Have an awesome weekend
Frank

Similar Messages

  • Set Name of org.w3c.dom.Node (= chang the TagNam)

    Hi all,
    How I can set name of my object org.w3c.dom.Node.
    In fact, this is an Element and I want to chang the tag <label> to <LABEL> befort write out DOM to XML File
    thanks a lot
    dseaa

    org.w3c.dom.Element interface does not have a setTagName() method.
    Implement interface org/w3c/dom/contentModel/CMElementDeclaration which has a setTagName() method.
    http://www.w3.org/TR/2001/WD-DOM-Level-3-CMLS-20010419/java-binding.html

  • Problem of using "org.w3c.dom.Node" class

    I try to use removeChild(child) method of "org.w3c.dom.Node" object. it don't work.
    is it better to do child=null;

    child=null does nothing to the dom object
    removeChild works fine. You're just confused.
    You would need more info to have any chance of fixing the problem.

  • Cost of creating org.w3c.dom.Node

    I am trying to create an xml of cached data at run time. I need to know if this would increase the response time considerably ..?
    Is there any documents which talk about the cost of creating nodes(e.g.within loops) ..?
    public Node createnode(Document d, String node_name, int node_value) {
    org.w3c.dom.Node temp_element_node, temp_text_node;
    temp_element_node = d.createElement(node_name);
    temp_text_node = d.createTextNode(node_name);
    temp_text_node.setNodeValue(node_value + "");
    temp_element_node.appendChild(temp_text_node);
    return temp_element_node;
    Has anybody implimented a pool of nodes(like pool of database connections). Any information is appreciated!

    It would certainly depend somewhat on which parser you were using, but i can't imagine it would be any more costly than any other type of object.

  • Adding org.w3c.dom.Node

    Hi,
    can someone please tell me if it is posible do read a org.w3c.dom.Node from one XML file, and than add it to another? Or is there a way to copy one org.w3c.dom.Node to another XML?
    Thanx,
    Alan.

    Refer to
    http://javaalmanac.com/egs/org.w3c.dom/CloneSubtree2.html

  • How to initialize a org.w3c.dom.Node object?

    Hello,
    I want to initialize an org.w3c.dom.Node object with an empty Node.
    How could I do that?
    Thanks
    Sylvain

    I want to create a Document.
    If I test your line, this error appears:
    "Default constructor cannot handle exception type javax.xml.parsers.ParserConfigurationException thrown by implicit super constructor. Must define an explicit constructor."
    Do you know what's happen?
    Thanks
    Sylvain

  • Casting a org.w3c.dom Node to a org.dom4j Node

    Does anybody know how I can cast (convert) a w3c.dom Node to a dom4j Node?
    If I just trying casting the w3c node "(org.dom4j.Node)" it throws an exception...

    I have a org.w3c.dom.Node after calling HttpUnit's getDOMSubtree() method.
    Now I would like to change that Node to an org.dom4j.Node so i can use dom4j's Node.valueOf() method on it.
    Any idea how?

  • Unmarshalling a DOM node to an XML file with JAXB

    I'm trying to unmarshall a DOM node to an XML file using JAXB. However I keep receiving a NullPointerException. This only seems to occur when I create the DOM Node from scratch. The stack trace looks like the following:
    java.lang.NullPointerException
            at com.sun.xml.bind.unmarshaller.SAXUnmarshallerHandlerImpl.startElement
    (SAXUnmarshallerHandlerImpl.java:87)
            at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:109)
            at com.sun.xml.bind.unmarshaller.DOMScanner.parse(DOMScanner.java:64)
            at com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(Unmarshaller
    Impl.java:149)
            at Main.main(Main.java:103)(If I unmarshal an XML file into a DOM node, I can successfully marshall the DOM node out to a new XML file using JAXB without error.)
    Any insight into what I am doing wrong would be greatly appreciated!
    Sample code and XSD follow...
    Sample Code:
    import itemlistsample.*;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Iterator;
    import java.util.List;
    import javax.xml.bind.JAXBContext;
    import javax.xml.bind.JAXBException;
    import javax.xml.bind.Marshaller;
    import javax.xml.bind.Unmarshaller;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Node;
    import org.w3c.dom.Text;
    public class Main
      public static void main(String[] args)
          try
              JAXBContext jc = JAXBContext.newInstance( "itemlistsample" );
              Unmarshaller u = jc.createUnmarshaller();
              * Set up DOM Node Document Object.
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              dbf.setNamespaceAware(true);                   
              DocumentBuilder db = dbf.newDocumentBuilder(); 
              Document doc = db.newDocument();
              System.out.println();
              System.out.println();
              System.out.println("Create a DOM Node and unmarshall to an XML file");
              * Generate elements within DOM document
              Element itemListElt = (Element)doc.createElement("item_list");
              Element itemInfo = (Element)doc.createElement("item_info");
              Element name = (Element)doc.createElement("name");
              Element price = (Element)doc.createElement("price");
              * 3-Ring Binder @ 4.99
              name.appendChild(doc.createTextNode("3-Ring Binder"));
              itemInfo.appendChild(name);
              price.appendChild(doc.createTextNode("4.99"));
              itemInfo.appendChild(price);
              itemListElt.appendChild(itemInfo);
              * Large Paper Clips @ 1.23
              itemInfo = (Element)doc.createElement("item_info");
              name = (Element)doc.createElement("name");
              price = (Element)doc.createElement("price");
              name.appendChild(doc.createTextNode("Large Paper Clips"));
              itemInfo.appendChild(name);
              price.appendChild(doc.createTextNode("1.23"));
              itemInfo.appendChild(price);
              itemListElt.appendChild(itemInfo);
              doc.appendChild(itemListElt);
              * Display DOM document as a sanity check
              itemListElt = doc.getDocumentElement();
              System.out.println(itemListElt.getTagName());
              NodeList nl = itemListElt.getElementsByTagName("item_info");
              traverse("  ", nl.item(0));
              * Use JAXB to unmarshal the DOM document into
              * an instance of the generated JAXB class for
              * the root element.  Stack trace occurs here!
              ItemListType il = (ItemListType)u.unmarshal(doc);
              * Marshal to an XML file
              Marshaller m = jc.createMarshaller();
              m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
              m.marshal( il, new FileOutputStream("item_new.xml") );
          catch (Exception e)
         e.printStackTrace();
      public static void traverse(String indent, Node n)
        if (n != null)
          if (n.getNodeName() != null)
            System.out.println(indent + n.getNodeName());
            traverse(indent + "  ", n.getFirstChild());
          if (n.getNodeValue() != null)
            System.out.println(indent + n.getNodeValue());
          traverse(indent, n.getNextSibling());
    }Sample XSD:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <xsd:element name="item_list" type="ItemListType"/>
         <xsd:complexType name="ItemListType">
              <xsd:sequence>
                   <xsd:element name="item_info" type="ItemInfoType" maxOccurs="unbounded"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="ItemInfoType">
              <xsd:sequence>
                   <xsd:element name="name" type="xsd:string"/>
                   <xsd:element name="price" type="xsd:double"/>
              </xsd:sequence>
         </xsd:complexType>
    </xsd:schema>

    Modified schema
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="item_list">     
    <xsd:complexType>          
    <xsd:sequence>               
    <xsd:element ref="item_info" maxOccurs="unbounded"/>     
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="item_info">
         <xsd:complexType>          
    <xsd:sequence>               
    <xsd:element name="name" type="xsd:string"/>     
         <xsd:element name="price" type="xsd:double"/>     
         </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>

  • Error converting DOM nodes into SOAP nodes

    Hi,
    i am doing an http call using http binding activity in oracle soa suite 11g.The http call requires some header information.When I pass the header information through headers in invoke activity and invoke the http call,I get an error " Error converting DOM nodes into SOAP nodes".What might be the reason and how to solve it.
    Naresh

    Hello,
    It appears your code is trying to repeat messagePart itself. Split Joins strictly adheres to a WSDL definition for incoming and outgoing messages.
    Instead of repeating <RootElement> which is defined as single occurance in your message definition within WSDL, you should find a way to tweak the WSDL to have "repetitive node which will become single message after split" within 1 Root element.
    This will call for having need of implementing transformation within split join based on need of target input message. Below is the example:
    WSDL contains:
    <wsdl:message name="inputMessageName">
         <wsdl:part name="partInput" element="rootElement"/>
    </wsdl:message>
    What your current xml structure is(please note how message itself is repeating below while it has been defined as single in wsdl, unfortunately there is nothing maxOccurs for message in WSDL definition , although you can define multiple parts but that is not case here):
    <soap:Body>
    <rootElement>
    </rootElement>
    <rootElement>
    </rootElement>
    <rootElement>
    </rootElement>
    </soap:Body>
    What Split-Join expects(If you have existing wsdl then you need to tweak it to conform to below kind of structure then use transformation within split join to convert it into correct xml structure for outgoing):
    <soap:Body>
    <rootElement>
         <repetitiveElementSpecificToIndividualSplitRequest/>
         <repetitiveElementSpecificToIndividualSplitRequest/>
         <repetitiveElementSpecificToIndividualSplitRequest/>
    </rootElement>
    </soap:Body>
    I hope this helps.
    Regards,
    Ankit

  • ORA-31185 DOM NODES DO NOT BELONG TO THE SAME DOCUMENT

    Hi all,
    I developed an Oracle function that returns a XMLTYPE. In this function, I first created a node <ROOT> and I would like to append children nodes to this root node.
    To create children nodes I loop on a cursor and each iteration of this loop "build" a XMLTYPE node. I would like append this XMLTYPE node to the root node but for now I get the ORA-31185 error !
    Here is the code of my function (simplified version (without use of cursor)):
    CREATE OR REPLACE
    FUNCTION GET_MEDOC2 RETURN XMLTYPE IS
          parent_document DBMS_XMLDOM.DOMDOCUMENT;
       parent_rootnode DBMS_XMLDOM.DOMNODE;
       child_document  DBMS_XMLDOM.DOMDOCUMENT;
       child_rootnode  DBMS_XMLDOM.DOMNODE;
       rootXML XMLTYPE;
       subXML XMLTYPE;
       countLOOP NUMBER;
    BEGIN
        SELECT XMLELEMENT("ROOT") INTO rootXML FROM DUAL;
        parent_document := DBMS_XMLDOM.newDOMDocument(rootXML);
        parent_rootnode := DBMS_XMLDOM.makeNode(DBMS_XMLDOM.getDocumentElement(parent_document));
         FOR countLOOP IN 1..10 LOOP
            SELECT XMLELEMENT("CHILD", countLOOP) INTO subXML FROM DUAL;
            child_document  := DBMS_XMLDOM.newDOMDocument(subXML);
            child_rootnode  := DBMS_XMLDOM.makeNode(DBMS_XMLDOM.getDocumentElement(child_document));   
            child_rootnode := DBMS_XMLDOM.appendchild(parent_rootnode, child_rootnode);  
         END LOOP;
         RETURN rootXML;
    END GET_MEDOC2;When I execute the following :
    SELECT GET_MEDOC2() FROM DUAL;I get the beautiful ORA-31185 DOM NODES DO NOT BELONG TO THE SAME DOCUMENT
    What I expect is an XML like this :
    <ROOT>
        <CHILD>1</CHILD>
        <CHILD>2</CHILD>
        <CHILD>3</CHILD>
        <CHILD>4</CHILD>
        <CHILD>5</CHILD>
        <CHILD>6</CHILD>
        <CHILD>7</CHILD>
        <CHILD>8</CHILD>
        <CHILD>9</CHILD>
        <CHILD>10</CHILD>
    </ROOT>Can someone help me please ? (I'm on Oracle 10.1.0.5.0)
    Thanks

    Hi,
    I get the beautiful ORA-31185 DOM NODES DO NOT BELONG TO THE SAME DOCUMENTYou need function importNode (or adoptNode) to copy nodes across different documents.
    But, do not use DOM manipulation in this case.
    A single query using SQL/XML functions is certainly simpler and more performant :
    SELECT XMLElement("ROOT",
             XMLAgg(
               XMLelement("CHILD",
                 XMLForest(
                   empno
                 , ename
               ) order by empno
           ) as result
    FROM (
      -- your query goes here, e.g. :
      SELECT empno, ename
      FROM scott.emp
    <ROOT>
      <CHILD>
        <EMPNO>7369</EMPNO>
        <ENAME>SMITH</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7499</EMPNO>
        <ENAME>ALLEN</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7521</EMPNO>
        <ENAME>WARD</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7566</EMPNO>
        <ENAME>JONES</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7654</EMPNO>
        <ENAME>MARTIN</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7698</EMPNO>
        <ENAME>BLAKE</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7782</EMPNO>
        <ENAME>CLARK</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7839</EMPNO>
        <ENAME>KING</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7844</EMPNO>
        <ENAME>TURNER</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7900</EMPNO>
        <ENAME>JAMES</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7902</EMPNO>
        <ENAME>FORD</ENAME>
      </CHILD>
      <CHILD>
        <EMPNO>7934</EMPNO>
        <ENAME>MILLER</ENAME>
      </CHILD>
    </ROOT>

  • Saxon and Supplied NodeList contains non-Saxon DOM Nodes error

    Hi all,
    I am writing an extension function for my xslt. So far, it was working fine, but since I switched from xalan to saxon, my function is giving me the following error:
    Supplied NodeList contains non-Saxon DOM Nodes
    I understand that I can not use non-saxon DOM nodes with saxon. The question is, how would I construct a saxon DOM objects???
    my function looks like this:
    public static NodeSet splitPortsAndResults(String portList, String resultList) {
    // in here I am creating a document and node set to be returned to my xsl
    I can not find any documentation on how to create a document using saxon.
    I have spent a lot of time researching this. I would greatly appreciate any help.
    Namrata

    Dr. Clap,
    Thanks again!!! I have been looking for this information for atleast two days. Wow! I have printed the pages that explain how to return NodeList. I will implement it on Monday or Tuesday and will let you know by Wednesday. It should be pretty straight forward.
    Again, you are the best!!!
    Namrata

  • Can you add a DOM Node to a SOAP Header?

    Hi all
    This is related to my other post in the "Java Programming" forum, but is a much more general question, so I felt that it would be okay to start a new thread in a new forum!
    I have been trying to append an object of type...
    org.w3c.dom.Node
    ...to a...
    javax.wsdl.extensions.soap.SOAPHeader
    and have not been havign much luck. The following Exception is typically happening: -
    org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR
    If anyone could give me some advice or some sample code, I would be most grateful. I basically just want to be able to grab some XML and append it to my SOAP Header.
    Kind regards
    Jon

    I have been using the compact header add-on since V3 for just that purpose.
    https://addons.mozilla.org/en-US/thunderbird/addon/compactheader/

  • How to convert SOAPEnvelope or SOAPBody to org.w3c.dom.Node and vice versa?

    How to convert javax.xml.soap.SOAPEnvelope or javax.xml.soapSOAPBody to org.w3c.dom.Node and vice versa?If this convertion is very diffcult , how to convert String to org.w3c.dom.Node?
    Thanks a lot

    vj008 wrote:
    while parsing a DOM i want to convert
    org.w3c.dom.Element to xml string and after certain processing on that xml string i want to convert back it to
    org.w3c.dom.Element.[This might help. xml transformations in java. |http://tejaspurohit.blogspot.com/2009/08/xml-transformations-in-java.html]

  • DOM nodes serialized using LSSerializer.writeToString() looses formatting

    Hi All,
    I am trying to serialize DOM nodes into a serialized string, and facing the below problem,
    where I am loosing all the formatting ( new lines, spaces ) in the process.
    Basically here is how the whole process can be outlined:
    1. I take a formatted xml request sample String:
    <Batch>
    <Request1>
    <Content>abc</Content>
    </Request1>
    <Request2>
    <Content>efg</Content>
    </Request2>
    </Batch>
    2. Feed it into a Dom parser to parse the xml string and convert it into DOM objects
    public void parse( String xmlModel ) throws Exception {     
              if( xmlModel == null ){
                   throw new Exception( "No xml model string was supplied for parsing");
              else{
                   this.xmlModel = xmlModel;
              // Now try building the document
              try{
                   DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                   dbf.setNamespaceAware(true);
                   //parse the xml file.
                   DocumentBuilder parser = dbf.newDocumentBuilder();
                   parser.setErrorHandler(new ErrorHandlerImpl());
                   // ByteArrayInputStream extends from inputstream
                   InputStream is = new ByteArrayInputStream(xmlModel.getBytes());
                   setDoc(parser.parse(is));
    ( Continued in 3 .... )
    3. Then once the Document Object Model is ready, I try to serialize the object
    using the LSSerializer API interface to convert the DOM Node to an XML string,
    as below in the method implementation continued from above ..
    ( Continued from above here .... )
                   //write the output to the specified String variable
                   DOMImplementation impl = doc.getImplementation();
                   DOMImplementationLS implLS = (DOMImplementationLS) impl.getFeature("LS","3.0");
                   LSSerializer writer = implLS.createLSSerializer();
                   writer.getDomConfig().setParameter("error-handler",new DOMErrorHandlerImpl());
                   // This is to suppress the xml header, with version and the encoding being automatically generated
                   writer.getDomConfig().setParameter("xml-declaration", false);
    4. Assume the Node object got from the main DOM object is represented as "node"
    and if we try
    // Basically calling - LSSerializer.writeToString( Node node )
                   String xmlSerialized = writer.writeToString(node);
    System.out.println(xmlSerialized);
    The output would look like this:
    <Batch> <Request1> <Content>abc</Content> </Request1> <Request2> <Content>efg</Content> </Request2> </Batch>
    Basically lost all the formatting.
    Can someone suggest how to fix this ?
    Thanks

    I'm having the same problem. I think it's a bug with the LSSerialized. My code:
        Document doc = myElement.getOwnerDocument();
        ProcessingInstruction pi = doc.createProcessingInstruction(
            "xml-stylesheet",
            String.format(" type=\"%s\" href=\"%s\"", type, href));
        doc.insertBefore(pi,doc.getFirstChild());returns the following xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <windsor><queen favorite-dog="corgis"><name>Elizabeth</name><count>II</count></queen></windsor><?xml-stylesheet  type="text/xsl" href="mystylesheet.xsl"?>Interestingly, if I print out the nodes in order, using this code:
    NodeList nl = doc.getChildNodes();
        for(int i = 0 ; i < nl.getLength() ; i++) {
          System.out.println("NODE: " + nl.item(i));
        }They are in the correct order:
    NODE: [xml-stylesheet:  type="text/xsl" href="mystylesheet.xsl"]
    NODE: [windsor: null]I think I'm going to have to switch to using the transform framework for output serialization. sigh

  • Get line/column number from DOM Nodes

    Hello,
    I'm currently writing an xml editor application.
    I want to select the lines of a specified org.w3c.dom.Node or Element when the user selects a Node from a tree, so I must have the line and column number of the selected Node.
    I know I can get the location via the Locator during SAX parsing but I need a DOM tree. Of course i could create my own dom classes but then I'd had to rewrite a lot of code and my xpath evaluator (wich currently uses, of course, also w3c.dom classes) won't work together with it.
    I'm surely not the first one who needs this function, so there must be a possibility to figure it out. I thought about hacking xerces but probably it was a bad idea.
    I hope anyone knows a solution or even a totally other way.
    Thanks,
    Roar

    You might want to look at:
    http://cvs.sourceforge.net/viewcvs.py/armedbear-j/j/j/src/org/armedbear/j/XmlParserImpl.java?rev=1.7&view=auto
    In general, DOM is not designed for editors, but for applications dealing with XML as an object model, where the lexcal details don't matter.
    You could subclass whatever builds the DOM tree from SAX events and add either user data (if using DOM level 3) or and entry in an IdentityHashMap (if not) to the created nodes. You also need to add LexicalHandler support if you want to go into the detail of CDATA sections etc.
    Pete

Maybe you are looking for

  • 2 iTunes folders on one computer, 1 iPod - does it work?

    This part seems to work: putting one iTunes folder into the users>music folder at a time, with the other iTunes folder (containing its own iTunes Music folder and library) into a folder located elsewhere on the computer. If I just switch the entire i

  • Ping of death

    Hi AS discussed earlier ping to inside interface drops  after some intervals. When checked logs in asa built 10.1..x.x  123  65.55.21.22 123 build outbound udp connection 12345 for outside:65.55.21.22 to inside 10.1.x.x /123 for everyhour we are rece

  • ITunes 8 (WIndows) remote speaker problem: plays only (very) intermittently

    Running iTunes 8.1.0.52, Windows XP, on an HP 2230s laptop (2.53 GHz Core2Duo). I can play audio through the computer's speakers, no problem. When I connect to my remote speakers (via Airport Express), audio plays for only a moment or two, then stops

  • CK11N, object was not costed

    Hi, I am running CK11N, and have question about why the components of the BOM do not get costed. I have a BOM structure for material A1SUBASSEM, the components are A1_CD and A2_CD, how come the A1_CD and A2_CD components do not get costed?!

  • Internationalization of EP

    Hi, wanted to ask if internationalization of EP is same as internationalization of webDynpro NWDS. Is the following link the correct path for implementing multi-language feature in portal's existing features,and portal applications? the link: http://