Partial document/node retrieval with DOM

I have constructed a DOMDocument of an XML input:
- <email>
- <folder name="inbox" id="">
- <message id="54321">
<time_received>2003-07-16 09:30:05</time_received>
<sender>John St.</sender>
<to> "aaa"</to>
<to>"bbb"</to>
<importance>High</importance>
<subject>My subject</subject>
<body>THis is great</body>
</message>
- <message id="12345">
<time_received>2003-07-16 09:30:10</time_received>
<sender>Tim Rice</sender>
<to>"ccc"</to>
<to>"ddd"</to>
<subject>My subject 2</subject>
<body>THis is great 2</body>
</message>
</folder>
</email>
I created a getter method which retrieve value using the tag, like
get("to") returns "aaa", and another get("to") returns "bbb"
I use getElementByTagName(...) to do this, but the problem is that
another get("to") will return "ccc". As you can see for the XML file, this
is not good because the "ccc" is within next "message" tag.
I want to provide another method to let the user select within which "message"
the getter method is functional.
I seemed to me that I have to create some "partial" doc pointing to the sub-nodes.
but I don't know how to do it, anyone has some idea about this?
besides, XPath seems can deal with it , but I am not allow to use it...
Thanks in advance!

I'm not sure I follow, but I would consider creating your own objects that represent messages, and iterate through your xml/dom with xpath to build your objects. then get rid of the dom document and work with your collection of "message" objects. I just use DOM as as part of an adapter to convert xml data into the applications object model - abstract out the xml/dom dependencies from your app logic.

Similar Messages

  • How to append an xml string as a child node to a dom document

    Hi
    I have an xml represented as a String. Now I want to add this xml string as a child node to another DOM Document.
    Do I have to first parse the xml String into a xml Document and then add the nodes to the existing Document. Is there a simpler way to do this. Any input is appreciated.
    Many thanks in advance.

    radsat wrote:
    Hi
    I have an xml represented as a String. Now I want to add this xml string as a child node to another DOM Document.
    Do I have to first parse the xml String into a xml Document and then add the nodes to the existing Document. yes, this is what you need to do.
    Is there a simpler way to do this. Any input is appreciated.no, there really isn't, sorry.

  • Read Node Attribute with XML DOM.

    Hello, I have a XML File like this:
    <?xml version="1.0" encoding="ISO-8859-15"?>
    <Datenexport>
    <Codeliste Nr="1">
    <Entry>
    <Code>J</Code>
    <Decodierung_DE>JA</Decodierung_DE>
    <Decodierung_EN/>
    </Entry>
    <Entry>
    <Code>N</Code>
    <Decodierung_DE>NEIN</Decodierung_DE>
    <Decodierung_EN/>
    </Entry>
    </Codeliste>
    <Codeliste Nr="3">
    <Entry>
    <Code>??</Code>
    <Decodierung_DE>Code noch festzulegen</Decodierung_DE>
    <Decodierung_EN>Code to be defined</Decodierung_EN>
    </Entry>
    I read the File with DOM and it works fin.
    This is a sample of my code:
    begin
    INDOMDOC := DBMS_XMLDOM.NEWDOMDOCUMENT(xml_doc.GETclobVAL());
    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(indomdoc),'/Datenexport','xmlns:xiz="http://www.bvl.bund.de/Schema/2010/xiz"');
    FOR cur IN 0 .. dbms_xmldom.getLength(l_nl) - 1
    LOOP
    l_n := dbms_xmldom.item(l_nl, cur);
    l_nl2 := dbms_xmldom.getchildnodes(l_n);
    lv_value := dbms_xmldom.getnodename(dbms_xmldom.getfirstchild(l_n));
              FOR cur2 IN 0 .. dbms_xmldom.getLength(l_nl2) - 1
              LOOP
              l_n2 := xmldom.ITEM(l_nl2, cur2);
              nodename_val := dbms_xmldom.getnodename(l_n2);
              dbms_output.put_line('NodenameAntrag: '||nodename_val);
              lv2_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_n2));
              dbms_output.put_line('NodeValue: '||lv2_value);
              IF nodename_val = 'Codeliste' THEN number_val := dbms_xmldom.????????????????;
    Now, i need to read the number of the "Codeliste" (<Codeliste Nr="1">).
    But i haven´t find the right function.
    Could anbody help me?

    Still not using XMLTable for this? ;)
    OK, using DOM, for example :
    SQL> set serveroutput on
    SQL>
    SQL> declare
      2    doc       xmltype;
      3    indomdoc  dbms_xmldom.domdocument;
      4    l_nl      dbms_xmldom.DOMNodeList;
      5    l_n       dbms_xmldom.DOMNode;
      6    lv_value  varchar2(30);
      7  begin
      8    doc := xmltype('<?xml version="1.0" encoding="ISO-8859-15"?>
      9  <Datenexport>
    10  <Codeliste Nr="1">
    11  <Entry>
    12  <Code>J</Code>
    13  <Decodierung_DE>JA</Decodierung_DE>
    14  <Decodierung_EN/>
    15  </Entry>
    16  <Entry>
    17  <Code>N</Code>
    18  <Decodierung_DE>NEIN</Decodierung_DE>
    19  <Decodierung_EN/>
    20  </Entry>
    21  </Codeliste>
    22  <Codeliste Nr="3">
    23  <Entry>
    24  <Code>??</Code>
    25  <Decodierung_DE>Code noch festzulegen</Decodierung_DE>
    26  <Decodierung_EN>Code to be defined</Decodierung_EN>
    27  </Entry>
    28  </Codeliste>
    29  </Datenexport>');
    30 
    31 
    32    indomdoc := dbms_xmldom.newdomdocument(doc);
    33 
    34    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(indomdoc),'/Datenexport/Codeliste');
    35 
    36    FOR cur IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
    37       l_n := dbms_xmldom.item(l_nl, cur);
    38       --lv_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_n));
    39       dbms_xslprocessor.valueOf(l_n, '@Nr', lv_value);
    40       dbms_output.put_line('Nr : '||lv_value);
    41    END LOOP;
    42 
    43    dbms_xmldom.freeDocument(indomdoc);
    44 
    45  end;
    46  /
    Nr : 1
    Nr : 3
    PL/SQL procedure successfully completed

  • Problem in reading with DOM

    i have the following xml file to read with DOM
    <?xml version="1.0" encoding="UTF-8" ?>
    - <usecasediag>
    - <actor id="1">
      <name>customer</name>
      <usecase>reservation of tour</usecase>
      <usecase>view tour data</usecase>
      <usecase>cancel reservation</usecase>
      <usecase>complain</usecase>
      </actor>
    - <actor id="2">
      <name>employee</name>
      <usecase>access</usecase>
      <usecase>update</usecase>
      </actor>
    </usecasediag>after reading the above file i need to create another XML file using DOM. I have the following code but i am not able to get the value "customer","enployee" while reading the XML file....
    import java.io.File;
    import java.io.IOException;
    import org.w3c.dom.*;
    import javax.xml.parsers.ParserConfigurationException;
    import com.sun.org.apache.xml.internal.serialize.OutputFormat;
    import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
    class Post
       Document dom; //to read
       Document dwrite; //to write
       Element root;//to read
       Element rootEle;//to write
       Post()
            File docFile = new File("..\\uml\\xml file\\sample.xml");
            try {
                DocumentBuilderFactory dbf =DocumentBuilderFactory.newInstance();
                DocumentBuilder db = dbf.newDocumentBuilder();
                dom= db.parse(docFile);
                  } catch (java.io.IOException e)
                System.out.println("Can't find the file");
                } catch (Exception e)
                System.out.print("Problem parsing the file.");
            Element root = dom.getDocumentElement();
            findActor();
    void findActor()
         Element ele=null;     
         NodeList nl1 = dom.getElementsByTagName("actor");
         if(nl1 != null && nl1.getLength() > 0)
             for(int i = 0 ; i < nl1.getLength();i++)
                   //get each actor element
                   ele = (Element)nl1.item(i);
                   Node nameEle=ele.getFirstChild();//name element
                   Node actnm=nameEle.getFirstChild();//customer
                   String clname=actnm.getNodeValue();
             }//for
         }//if               
    }//classcan anyone figure out the problem...thanx in advance

    you are right...its taking empty tag...i tried doing it some other way but the control is not matching the "if" statement....can you please tell me how do i write code to get the name & usecase element for each actor..
    void findActor()
         Element ele=null;     
         NodeList nl1 = dom.getElementsByTagName("actor"); //all actor tags in XML
         if(nl1 != null && nl1.getLength() > 0)
             for(int i = 0 ; i < nl1.getLength();i++)
                   //get each actor element
                   ele = (Element)nl1.item(i);
                   for(Node child=ele.getFirstChild();child!=null;child=child.getNextSibling())
              if(child.equals("name"))
              { System.out.println("got it");
                   break;
             }//for i loop
         }//if               
    }

  • XSLT with DOM/C++ Parser

    Help,
    Anyone familiar with xslprocess class with DOM Parser for C++? My application needs to transform the original XML document, and then parse the new document (parse elements in tree). The example in the XDK demo directory (XSLSample.cpp) stops short of this. This demo/sample code simply output the newly transformed to the standard output (screen). My attempt to parse the newly transformed XML has been unsuccessful. Most of my code is base direcly from the sample:
    void
    DbXMLLoad::transformXML( const string& filename)
    xmlpar.xmlinit();
    strcpy(xml_doc, (char*)filename.c_str());
    xmlpar.xmlparse((oratext *), xml_doc, (oratext *) 0, flags);
    xslpar.xmlinit();
    strcpy(xsl_doc, "it2xxx.xsl");
    xslpar.xmlparse((oratext *), xsl_doc, (oratext *) 0, flags);
    respar.xmlparse((oratext *) result, (oratext *) 0, flags);
    xslproc.xslprocess(&xmlpar, &xslpar, &respar, &result);
    xslproc.printres(&respar.getDocumentElement(), 1);
    // Parse the newly transformed XML document????
    constructTree(result, 1);
    (void) xmlpar.xmlterm();
    (void) xslpar.xmlterm();
    (void) respar.xmlterm();
    void
    DbXMLLoad::constructTree(Node *node, word level)
    if (node) {
    dumpTree(node, level);
    if ((node->getType() !=DOCUMENT_TYPE_NODE) && node->hasChildNodes()) {
    nodes = node->getChildNodes();
    n_nodes = node->numChildNodes();
    for (i=0; i< n_nodes; i++)
    constructTree(nodes->item(i), level + 1);
    void
    DbXMLLoad::dumpTree(Node *node, uword level)
    switch (node->getType()) {
    case ELEMENT_NODE: // start database processing
    case TEXT_NODE: // continue database processing
    default:
    Appreciate your help. Thanks in advance
    Russ

    what is "respar"?What version of XDK do you use?

  • XML parsing a spesific value with DOM

    Hi guys.
    I have the following xml file:
    <channel>
          <title>Java Technology Headlines</title>
          <link></link>
          <description>Technical content and news from java.sun.com, the premier source of information about the Java platform.</description>
          <language>en-us</language>
          <image>
            <title>java.sun.com</title>
            <url>http://developers.sun.com/im/logo_java_grey.gif</url>
            <link></link>
            <width>144</width>
            <hight>40</hight>
            <description>Visit java.sun.com</description>
          </image>   
         <item>
            <title>Implementing Service-Oriented Architectures (SOA) with the Java EE 5 SDK</title>
            <link>http://java.sun.com/developer/technicalArticles/WebServices/soa3/?feed=JSC</link>
            <description>This article presents concepts and language constructs needed to develop a Service-Oriented Architecture composite application in Java EE 5. It then describes an example application designed to solve a business problem.</description>
            <date></date>
         </item>
         <item>
            <title>2006 JavaOne Highlights!</title>
            <link>http://java.sun.com/javaone/sf/?feed=JSC</link>
            <description>In It's a Wrap, read about the doings that kept 14,000 attendees percolating. Winner's Circle lists who won the various drawings. And Incoming T-Shirt! Duck! celebrates the Gosling-MythBusters' Wow factor.</description>
            <date></date>
         </item>
         <item>
            <title>Visit us at JavaOne!</title>
            <link>http://java.sun.com/javaone/sf/?feed=JSC</link>
            <description>We are at the 2006 JavaOne conference this week. Find out about the latest happenings, including session coverage, announcements, articles, blogs, photos, and more. Check out all the JavaOne action at java.sun.com/javaone/sf.</description>
            <date></date>
         </item>
    </channel>    and the following java class.
    public class SimpleDOMExample
      public SimpleDOMExample()
      private static void scanDOMTree(Node node)
        int type = node.getNodeType();
        switch (type)
          case Node.ELEMENT_NODE:
             //System.out.println("Element: " +node.getNodeName());
             if(node.getNodeName().equals("channel")&&node.getNodeName().equals("title"))
                  //&& node.getNodeName().equals("title"))
                 Node fc = node.getFirstChild();
                  //Node sc = fc.getNextSibling();
                System.out.println("the tithe: "+ fc.getNodeValue());}
                   if(node.getNodeName().equals("link")){
                    // if ( node.getNodeName().equals("title") )//&& node.getNodeName().equals("title")
                      Node fc = node.getFirstChild();
                       //Node sc = fc.getNextSibling();
                     System.out.println("the url: "+ fc.getNodeValue());}
            NamedNodeMap attrs = node.getAttributes();
            for (int i = 0; i < attrs.getLength(); i++)
              Node attr = attrs.item(i);
              //System.out.println("Attribute: " +attr.getNodeName() + "=\"" + attr.getNodeValue());
            NodeList children = node.getChildNodes();
            if (children != null)  
              int len = children.getLength();
              for (int i = 0; i < len; i++)
                scanDOMTree(children.item(i));
            break;
          case Node.DOCUMENT_NODE:
            scanDOMTree(((Document)node).getDocumentElement()); 
            break;
          case Node.ENTITY_REFERENCE_NODE:
            //System.out.print("this &"+node.getNodeName()+";");
            break;
          case Node.TEXT_NODE:
           // System.out.println("TEXT: " + node.getNodeValue().trim());
            break;
         public static void main(String argv[])
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              Document document = null;
        try
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   document = builder.parse( new File("java.xml"));
        catch (Exception e)
                   e.printStackTrace();
        if(document!=null)
                   scanDOMTree(document);
    }The questions i have are really simple.
    1) I am trying to get a specific value from the xml.
    for example the <title> after <channel> but i want only this title not the others as well. I can all the titles but i cant get it right for returning only the first. What am i doing wrong?
    2) i also want to parse the same values that are in the <item> for all 3 items but when i am using the
                   if(node.getNodeName().equals("link")){
                     Node fc = node.getFirstChild();
                     System.out.println("the link: "+ fc.getNodeValue());}i get a nullPointerException because the first link is empty under the <title>. If i change it to <description> it works fine.
    The fact is that i dont know how to point it to look a specific tags like only in <item>
    I have some comments in there of the different things i tried...
    Any suggestions??? Pleaseeeee.... :)
    Thx in advance...

    thx for the replay
    1) i thought of using xpath but wanted to know how to do it over DOM
    2) i mean that the 3 <item> have other element inside like that:
    <item>
    <title>Implementing Service-Oriented Architectures (SOA) with the Java EE 5 SDK</title>
      <link>http://java.sun.com/developer/technicalArticles/WebServices/soa3/?feed=JSC</link>
      <description>This article presents concepts and language constructs needed to develop a Service-Oriented Architecture composite application in Java EE 5. It then describes an example application designed to solve a business problem.</description>
      <date />
      </item>and all of them have <title>, <link> etc. I want to get the same values(eg. <title>) from all the 3 <item> and not including the <title> in the begining of xml
    3) i am a professional child.....joke....
    try to get to your sensitive side...thats way.

  • Modify hbm file with DOM

    I modified hbm mapping using DOM, I read and save data in hbm, when read
    file mapping, that nodes in my Document xml is with default attributes which tags contained, example:
    Tag hibernate-mapping was saved attributes as default-lazy="true|false"
    auto-import="true|false" as soon as.
    I use DTDResolverEntity that is in hibernate package as DOM entity resolver.
    What�s happen when I save new hbm modified?
    Regards.
    fct

    <KG NAME="Exception Handling">
        <K> NAME="Error resisten" MAX="2" </K>
        <K> NAME="Using Finally clause" MAX="5" </K>
    </KG>You seem to be confused about what an attribute is, or perhaps about how empty elements--those with no text and no child elements--are formed.
    KG has the attribute NAME, and two child elements, both K.
    The Child elements K have no attributes and no child elements. Merely text.
    If you can't change that XML, then you'll have to do getText or whatever to get N="Err" Max="2" as a String, and then split() or StringTokenizer that String.
    However, I'd advise changing the XML. (I've abbreviated some of the names in the example becaues I'm lazy. You can of course keep the names you have.) <KG NAME="Exception Handling">
        <K NAME="Error resisten" MAX="2" />
        <K NAME="Using Finally clause" MAX="5" />
    </KG>
    <!-- OR -->
    <KG NAME="Exception Handling">
        <K NAME="Error resisten" MAX="2"></K>
        <K NAME="Using Finally clause" MAX="5"></K>
    </KG>
    <!-- OR -->
    <KG NAME="Exception Handling">
        <K>
            <NAME>Error resisten</NAME>
            <MAX>2</MAX>
        </K>
        <K>
            <NAME>Using Finally clause</NAME>
            <MAX>5</MAX>
        </K>
    </KG>

  • Child text node lost with newDomNode()

    Hello,
    I have a simple custom XMLBean compiled from a schema like:
    <?xml version="1.0" encoding="UTF-8"?>
    <schema targetNamespace="http://mydomain.com/xsd/myBean"
         xmlns="http://www.w3.org/2001/XMLSchema"
         xmlns:tns="http://mydomain.com/xsd/myBean"
         elementFormDefault="qualified">
         <simpleType name="MyType">
              <restriction base="double"/>
         </simpleType>
         <element name="MyElement" type="tns:MyType"/>
    </schema>
    An the Java code:
    import com.mydomain.xsd.myBean.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    void myMethod() {
    MyElementDocument bean = MyElementDocument.Factory.newInstance();
    bean.setMyElement(3.14d);
    // this prints the the xml with text including 3.14d
    System.out.println(bean.xmlText());
    Element dom = ((Document) bean.newDomNode()) .getDocumentElement();
    The problem is, after getting the DOM object my calling newDomNode(), the Text
    Node for "3.14d" is lost from the DOM tree; i.e. instead of
    <tns:MyElement xmlns:tns="http://mydomain.com/xsd/myBean">3.14d</tns:MyElement>
    I get XML like:
    <tns:MyElement xmlns:tns="http://mydomain.com/xsd/myBean" />
    Question: how come the DOM tree is not complete?
    Any help is very much appreciated.
    -Feng

    I fixed the error by upgrading xbean.jar to the one bundled with WebLogic Servcer
    8.1 SP2 (I originally had the version from WLS 8.1 SP1).
    -Feng
    "Feng Xue" <[email protected]> wrote:
    >
    Hello,
    I have a simple custom XMLBean compiled from a schema like:
    <?xml version="1.0" encoding="UTF-8"?>
    <schema targetNamespace="http://mydomain.com/xsd/myBean"
         xmlns="http://www.w3.org/2001/XMLSchema"
         xmlns:tns="http://mydomain.com/xsd/myBean"
         elementFormDefault="qualified">
         <simpleType name="MyType">
              <restriction base="double"/>
         </simpleType>
         <element name="MyElement" type="tns:MyType"/>
    </schema>
    An the Java code:
    import com.mydomain.xsd.myBean.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    void myMethod() {
    MyElementDocument bean = MyElementDocument.Factory.newInstance();
    bean.setMyElement(3.14d);
    // this prints the the xml with text including 3.14d
    System.out.println(bean.xmlText());
    Element dom = ((Document) bean.newDomNode()) .getDocumentElement();
    The problem is, after getting the DOM object my calling newDomNode(),
    the Text
    Node for "3.14d" is lost from the DOM tree; i.e. instead of
    <tns:MyElement xmlns:tns="http://mydomain.com/xsd/myBean">3.14d</tns:MyElement>
    I get XML like:
    <tns:MyElement xmlns:tns="http://mydomain.com/xsd/myBean" />
    Question: how come the DOM tree is not complete?
    Any help is very much appreciated.
    -Feng

  • To convert XML to ABAP internal table can we do it with DOM or we need XSLT

    I have a requirement where I need to collect the data from XML file into an internal table.
    I need to collect this data into an internal table as I should make use of this data and do Goods Receipt in SAP.
    My XML file is very very complex and the child nodes in my XML file may occur ones or 10 times and change dynamically.
    I want to know if XML to ABAP internal table is possible with DOM or does it need XSLT too.
    I used the blog of Robert which uses DOM, but it I am unable to collect the data in internal table. The blog explains only how to wtite the out put to screen as element and value.
    I want to know if XML to ABAP internal table is possible with DOM or do I need XSLT too? I am confused please help.
    Any help will be highly appreciated.
    Regards,
    Jessica Sam

    Hello Jessica
    Why not using the DOM itself for processing?
    Below you see the post-processing coding which I use to add the interchange control number (ICN) into an EDI message (which at this stage is still an XML-EDI stream). This is done on SAP-XI yet on the ABAP stack so you could use this approach on your R/3 system as well.
    method POSTPROCESSING.
    * Post-Processing of outbound EDI invoices & dispatch advices
      me->map_icn( ).
    endmethod.
    method MAP_ICN.
    * define local data
      DATA: lo_node       TYPE REF TO if_ixml_node,
            ld_name       TYPE string,
            ld_value      TYPE string,
            ld_error_code type MPG_ERRCODE,
    **        ld_control_number   TYPE char13,
            ld_rc         TYPE i,
            ld_msg        TYPE string.  " bapi_msg.
      DATA: ld_interface  TYPE string.
      DATA: incode TYPE REF TO if_ixml_node_collection.
      LOG-POINT ID zedi
        SUBKEY mc_subkey_method_trace.
      ld_error_code = md_clsname.
    * Get next interchange control number (ICN)
      me->md_next_number = me->get_next_number(
          id_nrobj  = me->md_nrobj   " Object (SNRO)
          id_nrnr   = me->md_nrnr ). " Number Range
      CALL METHOD zcl_edi_uk_counter=>calculate_modulo_n09
        EXPORTING
          id_input  = me->md_next_number
        receiving
          rd_output = me->md_next_number.
    * Build ICN according to naming conventions agreed with EDI customer
      me->md_icn = me->generate_icn( me->md_next_number ).
      ld_value = me->md_icn.  " type conversion to string
      CLEAR: incode,
             lo_node.
      incode  = me->mo_document->get_elements_by_tag_name( mc_d_0020 ).
      lo_node = incode->get_item( index = 0 ).
      CALL METHOD lo_node->set_value
        EXPORTING
          value = ld_value
        RECEIVING
          rval  = ld_rc.
      IF ( ld_rc NE 0 ).
        CONCATENATE 'Error [' mc_d_0020
                    ']: Method SET_VALUE (IF_IXML_NODE)'
                    INTO ld_msg.
        CONDENSE ld_msg.
        me->mif_trace->trace2( message = ld_msg ).
        RAISE EXCEPTION TYPE cx_mapping_fault
          EXPORTING
    *        textid =
    *        previous =
            error_code = ld_error_code
            error_text = ld_msg.
    **    MESSAGE ld_msg TYPE 'A'.
      ENDIF.
      CLEAR: incode,
             lo_node.
      incode  = me->mo_document->get_elements_by_tag_name( mc_d_0020_2 ).  " element for ICN
      lo_node = incode->get_item( index = 0 ).
      CALL METHOD lo_node->set_value
        EXPORTING
          value = ld_value
        RECEIVING
          rval  = ld_rc.
      IF ( ld_rc NE 0 ).
        CONCATENATE 'Error [' mc_d_0020_2
                    ']: Method SET_VALUE (IF_IXML_NODE)'
                    INTO ld_msg.
        CONDENSE ld_msg.
        me->mif_trace->trace2( message = ld_msg ).
        RAISE EXCEPTION TYPE cx_mapping_fault
          EXPORTING
    *        textid =
    *        previous =
            error_code = ld_error_code
            error_text = ld_msg.
    **    MESSAGE ld_msg TYPE 'A'.
      ENDIF.
    * define local data
      DATA: ls_record       TYPE mpp_dynamic.
      CLEAR: ls_record.
      ls_record-namespace = mc_dynamic_namespace.
      ls_record-name      = mc_icn.
      ls_record-value     = ld_value.
      mif_dynamic->add_record( ls_record ).
    endmethod.
    In your case you would need to do a DO...ENDDO loop until you parsed all required nodes.
    NOTE: ME->MO_DOCUMENT is of TYPE REF TO IF_IXML_DOCUMENT.
    Regards
       Uwe

  • Document in org.w3c.dom.*??

    Is Document in org.w3c.dom.* a file?what is its extension?
    How can i write a file with it?

    org.w3c.dom.Document is a class that represents an XML document.
    It does not represent an XML stream as mlk says.
    It doesn't have anything to do with files. You can use an XML parser to build up a Document in memory from an XML file or any other data source that produces XML. Class org.w3c.dom.Document does not have any methods by itself that you can use to write to an XML file.
    XML files usually have the extension ".xml", but they can also have other extensions.
    See this: Working with XML: The Java/XML Tutorial

  • XML Forms - Cannot append a text to a document node.

    Hi,
    I just created a new xml form as a copy of another working    form.
    I changed a bit in it and tried to run both i preview an real. Edit worked and renderlistitem worked. On the Show I got the error in the bottom.
    I tried to remove all the elements again, down to the displayname. But still I get the same error.
    I'm on NW04s SP9
    XML - Forms 
    Error applying XSL stylesheet to XML
    com.sapportals.wcm.WcmException: com.sap.engine.lib.xml.util.NestedException: org.w3c.dom.DOMException: Cannot append a text to a document node. -> org.w3c.dom.DOMException: Cannot append a text to a document node.
         at com.sapportals.wcm.service.pipeline.Pipeline.handle(Pipeline.java:284)
         at com.sapportals.wcm.service.pipeline.XSLTPipeline.handle(XSLTPipeline.java:118)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformer.pipeIt(Transformer.java:133)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformer.transform(Transformer.java:105)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformer.transform(Transformer.java:77)
         at com.sapportals.wcm.service.xmlforms.transformation.HtmlGenerator.getHtmlStream(HtmlGenerator.java:122)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformation.render(Transformation.java:391)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformation.render(Transformation.java:222)
         at com.sapportals.wcm.app.xmlforms.PreviewServlet.sendForm(PreviewServlet.java:165)
         at com.sapportals.wcm.app.xmlforms.PreviewServlet.doGetAction(PreviewServlet.java:130)
         at com.sapportals.wcm.app.xmlforms.XFBaseServlet.doGet(XFBaseServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sapportals.wcm.app.xmlforms.XFBaseServlet.service(XFBaseServlet.java:134)
         at com.sapportals.wcm.portal.proxy.PCProxyServlet.service(PCProxyServlet.java:331)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sapportals.portal.prt.core.broker.ServletComponentItem$ServletWrapperComponent.doContent(ServletComponentItem.java:110)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
         at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
         at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

    Hi Rasmus,
    Quite probable your XSL is broken.
    > tried to remove all the elements again
    So two possibilities:
    (a) You tried to - but failed
    (b) You are the victim of a cache
    Wait for at most 30 minutes and/or recheck your changes.
    Hope it helps
    Detlev

  • Printing partial document

    I have a user that's not able to print a partial document, but when printing the entire document, it works flawlessly. Adobe is fully up to date, the print is coming from Word 2010. Ran repairs on both Word and Adobe, with no successes. Please help!?!

    Michael,
    Thanks for the response. I am trying to print from Word, to the PDF printer. The OS is Windows 7 Professional. x32)
    Please let me know if you have any other questions.

  • Covert org.jdom.Document to org.w3c.dom.Document

    Hello,
    How would I convert org.jdom.Document to org.w3c.dom.Document??
    I'm creating org.jdom.Document from the servlet that reads from the database, which gets output like following.
    // doc is org.jdom.Document
    Document doc = new Document( root );
    reportName = new Element( "REPORT_NAME" );
    root.addContent( reportName );
    reportName.setText( "Current Account Balance" );
    // skip...
    XMLOutputter outputter = new XMLOutputter(" ", true, "UTF-8");
    outputter.output(doc, out);
    And in my caller servlet, I read from the previous servlet using URL and parse it, trying to get Document, but it
    InputSource xmlSource = new InputSource( url.openStream());
    //Use a DOM Parser (org.apache.xerces.parsers.DOMParser)
    DOMParser parser = new DOMParser();
    parser.parse( xmlSource );
    Document doc = parser.getDocument();
    // and I do transformation.
    DOMSource inXML = new DOMSource( doc );
    StreamResult outXML = new StreamResult( out );
    transformer.transform( inXML, outXML )
    I'd like to skip passing around XML and share the same Document object so that I don't have parse it again...
    Help!

    Convert jdom document to dom document with class DOMOutputter.
    org.jdom.output.DOMOutputter domOut=new DOMOutputter();
    org.w3c.dom.Document domDocument=domOut.output(org.jdom.Document jdomDocument);

  • How to clone a 11.1.0.7 oracle single node db with asm instance

    We need to clone a 11.1.0.7 environment with single node db plus asm storage used.
    I googled everywhere , and a lot notes on ASM with RAC cluster clone provided but no document for ASM with single node.
    Please help.
    Thanks

    9233598 wrote:
    We need to clone a 11.1.0.7 environment with single node db plus asm storage used.
    I googled everywhere , and a lot notes on ASM with RAC cluster clone provided but no document for ASM with single node.
    Please help.
    Thanks
    9233598 wrote:
    We need to clone a 11.1.0.7 environment with single node db plus asm storage used.
    I googled everywhere , and a lot notes on ASM with RAC cluster clone provided but no document for ASM with single node.
    Please help.
    Thanks
    RMAN> DUPLICATE DATABASE

  • Using XPath to create Document node

    Hi, could anyone suggest how to create Document nodes using xpaths with the help of some api (dom4j, JAXP, etc)?
    For example:
    With xpath="//A/B", I need to produce:
    <A>
    <B>.. </B>
    </A>
    XPath is usually used for querying XML document, but now I need to do the reverse.
    Thanks.

    DrClap, thanks for your reply.
    Yes, the topic title is a bit misleading. I shouldn't call it "Document" node.
    "And you have an XPath expression of a very restricted form which is supposed to describe the structure of that document."
    Not really, what I have is a bunch of xpath expressions, each of them describe a element in a xml.
    With these xpath expressions, in the end of the day I need to create a xml document with these elements.
    For example, if I have
    //A/B
    //A/C
    //A/D
    I need to create a xml like this:
    <A>
    <B> ...</B>
    <C>....</C>
    <D>.....</D>
    </A>
    While I could do this in a manual way (creating each element from the root and adding children one by one....), I'm sure dom4j (or other packages) can do this but I couldn't find how.

Maybe you are looking for