How to convert Xml Document into orcale tempary table

i am creating xml document into java and passing this xml into oracle database and i need to fetch this xml into result set | rowset.
Xml Structure
<Department deptno="100">
<DeptName>Sports</DeptName>
<EmployeeList>
<Employee empno="200"><Ename>John</Ename><Salary>33333</Salary>
</Employee>
<Employee empno="300"><Ename>Jack</Ename><Salary>333444</Salary>
</Employee>
</EmployeeList>
</Department>
i need like this format
Deptno DeptName empno Ename Salary
100 Sports 200 Jhon 2500
100 Sports 300 Jack 3000

It does depend on your version as odie suggests.
Here's a way that will work in 10g...
SQL> ed
Wrote file afiedt.buf
  1  with t as (select xmltype('<Department deptno="100">
  2  <DeptName>Sports</DeptName>
  3  <EmployeeList>
  4  <Employee empno="200"><Ename>John</Ename><Salary>33333</Salary>
  5  </Employee>
  6  <Employee empno="300"><Ename>Jack</Ename><Salary>333444</Salary>
  7  </Employee>
  8  </EmployeeList>
  9  </Department>
10  ') as xml from dual)
11  --
12  -- End of test data, Use query below
13  --
14  select x.deptno, x.deptname
15        ,y.empno, y.ename, y.salary
16  from t
17      ,xmltable('/'
18                passing t.xml
19                columns deptno   number       path '/Department/@deptno'
20                       ,deptname varchar2(10) path '/Department/DeptName'
21                       ,emps     xmltype      path '/Department/EmployeeList'
22               ) x
23      ,xmltable('/EmployeeList/Employee'
24                passing x.emps
25                columns empno    number       path '/Employee/@empno'
26                       ,ename    varchar2(10) path '/Employee/Ename'
27                       ,salary   number       path '/Employee/Salary'
28*              ) y
SQL> /
    DEPTNO DEPTNAME        EMPNO ENAME          SALARY
       100 Sports            200 John            33333
       100 Sports            300 Jack           333444
SQL>If the XML is a string e.g. a CLOB then it can easily be converted to XMLTYPE using the XMLTYPE function.

Similar Messages

  • How to convert XML-Information into RSAPrivateKey

    Hi,
    how can I convert PrivateKey-data issued as XML-document into a valid RSAPrivateKey that can be used for signature and encryption? For X509Certificates and PublicKey-data this seems to be no problem, but I could not find any function that does it for PrivateKey-data.
    Please see http://www.w3.org/TR/xkms2/#XKMS_2_0_Section_C_3 for an example XML-PrivateKey.
    After converting it into a valid RSAPrivateKey System.out.println(privateKey); should output something like this:
    Sun RSA private CRT key, 1024 bits
      modulus:          1149848018...
      public exponent:  65537
      private exponent: 3967455520...
      prime p:          1210859164...
      prime q:          9496133427...
      prime exponent p: 4043649185...
      prime exponent q: 6250868914...
      crt coefficient:  2246802223but with:
             BigInteger mod = new BigInteger(Base64.decode(modulus));
             BigInteger exp = new BigInteger(Base64.decode(exponent));
              KeyFactory keyFactory = KeyFactory.getInstance("RSA");
              RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(mod, exp);
              RSAPrivateKey privateKey = (RSAPrivateKey) keyFactory.generatePrivate(keySpec);I only got the following:
    Sun RSA private CRT key, 1024 bits
      modulus:          1149848018...
      private exponent: 3967455520...Please help!

    at no charge for you:
    import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.math.BigInteger;
    import java.security.KeyFactory;
    import java.security.NoSuchAlgorithmException;
    import java.security.PrivateKey;
    import java.security.spec.InvalidKeySpecException;
    import java.security.spec.RSAPrivateCrtKeySpec;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    public class DotNetXMLPrivateKeyReader {
         private Document privateKeyDocument;
         private InputStream xmlInputStream;
         public DotNetXMLPrivateKeyReader(InputStream xmlInputStream) throws SAXException, IOException{
              this.xmlInputStream = xmlInputStream;
              parseDocument();
         public DotNetXMLPrivateKeyReader(byte xmlBytes[]) throws SAXException, IOException{
              this(new ByteArrayInputStream(xmlBytes));
         public DotNetXMLPrivateKeyReader(String xmlString) throws SAXException, IOException{
              this(xmlString.getBytes());
         public PrivateKey getPrivateKey() throws IOException, InvalidKeySpecException {
              KeyFactory keyFactory;
              try {
                   keyFactory = KeyFactory.getInstance("RSA");
              } catch (NoSuchAlgorithmException e) {
                   throw new RuntimeException("Error loading RSA KeyFactory", e);
              RSAPrivateCrtKeySpec keySpec = loadKeySpec();
              return keyFactory.generatePrivate(keySpec);
         private void parseDocument() throws SAXException, IOException {
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder;
              try {
                   builder = dbf.newDocumentBuilder();
              } catch (ParserConfigurationException e) {
                   throw new RuntimeException("Error creating DocumentBuilder from DocumentBuilderFactory", e);
              privateKeyDocument = builder.parse(xmlInputStream);
         private RSAPrivateCrtKeySpec loadKeySpec() throws IOException {
              String modulusStr = getNodeContent("Modulus");
              String publicExpStr = getNodeContent("Exponent");
              String primePStr = getNodeContent("P");
              String primeQStr = getNodeContent("Q");
              String primeEPStr = getNodeContent("DP");
              String primeEqStr = getNodeContent("DQ");
              String crtCoefficientStr = getNodeContent("InverseQ");
              String privateExpStr = getNodeContent("D");
              RSAPrivateCrtKeySpec keySpec = new RSAPrivateCrtKeySpec(
                        decodeBigDecimal(modulusStr), decodeBigDecimal(publicExpStr),
                        decodeBigDecimal(privateExpStr), decodeBigDecimal(primePStr),
                        decodeBigDecimal(primeQStr), decodeBigDecimal(primeEPStr),
                        decodeBigDecimal(primeEqStr), decodeBigDecimal(crtCoefficientStr));
              return keySpec;
         private String getNodeContent(String nodeName) {
              NodeList elementsByTagName = privateKeyDocument.getElementsByTagName(nodeName);
              Node node = elementsByTagName.item(0);
              String modulusStr = node.getTextContent();
              return modulusStr;
         private byte[] b64Decode(String data) throws IOException {
              return Base64Util.decode(data);
         private BigInteger decodeBigDecimal(String str) throws IOException {
              byte decodedMod[] = b64Decode(str);
              byte positiveMod[] = new byte[decodedMod.length + 1];
              System.arraycopy(decodedMod, 0, positiveMod, 1, decodedMod.length);
              return new BigInteger(positiveMod);
    Marcus Vin�cius Travassos Haickel de Oliveira
    Software Architect
    Live Source IT Solutions

  • How to convert xml file into internal table in ABAP Mapping.

    Hi All,
    I am trying with ABAP mapping. I have one scenario in which I'm using below xml file as a sender from my FTP server.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MTO_ABAP_MAPPING xmlns:ns0="http://Capgemini/Mumbai/sarsingh">
      <BookingCode>2KY34R</BookingCode>
    - <Passenger>
      <Name>SARVESH</Name>
      <Address>THANE</Address>
      </Passenger>
    - <Passenger>
      <Name>RAJESH</Name>
      <Address>POWAI</Address>
      </Passenger>
    - <Passenger>
      <Name>CARRON</Name>
      <Address>JUHU</Address>
      </Passenger>
    - <Flight>
      <Date>03/03/07</Date>
      <AirlineID>UA</AirlineID>
      <FlightNumber>125</FlightNumber>
      <From>LAS</From>
      <To>SFO</To>
      </Flight>
      </ns0:MTO_ABAP_MAPPING>
    AT the receiver side I wnat to concatenate the NAME & ADDRESS.
    I tried Robert Eijpe's weblog (/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach)
    but couldnt succeed to convert the xml file into internal table perfectly.
    Can anybody help on this. 
    Thanks in advance!!
    Sarvesh

    Hi Sarvesh,
    The pdf has details of ABAP mapping. The example given almost matches the xml file you want to be converted.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
    Just in case you have not seen this
    regards
    Vijaya

  • How to convert unstructured document into structured document

    I have many unstructured documents. Is it possible to convert these documents into strcutured documents? I know that structured FM uses DITA which is different from unstrcutured document. This is client's requirement so I want to get community views on this.

    Yanesh,
    I would approach this in 2 stages.
    Understand how DITA works independently of FrameMaker first. I say this because DITA is not a straight forward 'out of the box' experience. This could be a good starting point -http://www.technicalcommunicationcenter.com/2011/04/13/technical-book-review-practical-dit a-a-nuts-and-bolts-guide-to-structured-technical-writing/
    Understand how FrameMaker works with DITA. FrameMaker has it's own way of how you author DITA based content. You might want to look at tools such as DITA FMx - http://www.leximation.com/dita-fmx/, which claims to make DITA authoring easier with FrameMaker.
    If you are initially just producing PDF from your DITA content, then FrameMaker is probably the best way of getting the results you want, as FrameMaker templates work the same with structured content, as they do with unstructured.
    Good luck
    Mark

  • How to ftp XML document into a XML type which is not created by itself.

    Hi,
    1.
    I have a table call SNPLEX_DESIGN which is created automaticly when I register a snplex_design.xsd XML schema.( Oracle creates it through the xdb:defaultTable="SNPLEX_DESIGN attribute). and it is created using SNPLEX user account.
    2.
    I also created a folder (resource) call /home/SNPLEX/Orders. which is used to hold all the incoming XML document.
    3.
    I created another user account call SNPLEX_APP, which is the only user account allowed to FTP XML document into /home/SNPLEX/Orders folder.
    Isuues,
    If I login as SNPLEX user, I can ftp XML document into the folder and TABLE (the file size = 0). But If I login as SNPLEX_APP user account, I can only ftp XML document into the folder, but Oracle doesn't store the document into the table( becuase the files size shows a number).
    I have granted all the ACL privileges on the /home/SNPEX/Orders folder to SNPLEX_APP hrough OEM.
    DO I miss anything. Any helps will be great appreciated. Resolve this issues is very import to us, sicne we are on a stage to roll system into production.
    Regards,
    Jinsen

    IN order for a registered schema to be available to other users the schema must be registered as a GLOBAL, rather than a LOCAL Schema. This is controlled by the third agument passed to registerSChema, and the default is local. Note that you will also need to explicity grant appropriate permissions on any tables created by the schema registration process to other users who will be loading or reading data from these tables.

  • How to convert XML file to an internal table ?

    Hi All,
    I want to do a batch input program. The source data would be given as an excel file . I would like to know how to convert XML file to internal table properly. Please help me out..
    Thanking you in advance ..
    Shankara Narayanan T.V

    Hi Shankar,
    use 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
             EXPORTING
                  filename                = p_file1
                  i_begin_col             = '1'
                  i_begin_row             = '5'
                  i_end_col               = '40'
                  i_end_row               = '16'
             TABLES
                  intern                  = it_intern
             EXCEPTIONS
                  inconsistent_parameters = 1
                  upload_ole              = 2
                  OTHERS                  = 3.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    LOOP AT it_intern.
          AT NEW row.
            CLEAR it_intern.
          ENDAT.
            CASE lv_flag.
        Production Version
              WHEN  1.
                it_master-matnr      =   it_intern-value.     
              WHEN  2.
                it_master-werks      = it_intern-value.
              WHEN  3.
                it_master-verid      = it_intern-value.
              WHEN  4.
                it_master-text1      = it_intern-value.
              WHEN  5.
                it_master-fdate     = it_intern-value.
          AT END OF row.
            APPEND it_master.
          ENDAT.
        ENDLOOP.
    -Anu
    Message was edited by:
            Anupama Reddy

  • XML: How to convert xml string into Node/Document

    I have a string in xml form.
    <name>
    <first/>
    <second/>
    </name>
    I want to convert this string into DOM Node or Document.
    How can I do this?
    Any help or pointer?
    TIA
    Sachin

    Try this :
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(new org.xml.sax.InputSource(new StringReader(strXml)));Hope this helps.

  • How to convert XML data into binary data (opaque data)

    Hi,
    I am trying to develop a process that delivers files after reading data from a database.
    However, it is required not to deliver the data immediately. We want to perform some checks before the files get written.
    So the way we want to design this is,
    1. Read data from database (or any other input). The data is in XML format (this is a requirement, as in general, we have xml data)
    2. This data is written, opaquely, to a JMS queue that can store binary data, along with what is the filename of the file that would be written (filename is passed using JMS Headers)
    3. When required, another process reads the JMS queue's binary data, and dumps into a file
    The reason I want to use opaque data while inserting in the JMS queue is, that enables me to develop a single process in Step 3 that can write any file, irrespective of the format.
    My questions are
    1. How to convert the xml data to opaque data. In BPEL I may use a embedded java, but how about ESB. Any other way....?
    2. how to pass filename to the jms queue, when payload is opaque. Can I use a header attribute...custom attributes?
    3. Which jms message type is better for this kind of requirement - SYS.AQ$_JMS_BYTES_MESSAGE or SYS.AQ$_JMS_STREAM_MESSAGE

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • How to convert XML content into SQL INSERT statements

    Hi all,
    I'm very new to XML. Forgive me if I don't use technical XML terms. :-)
    We are planning to convert SQL queries into XML format using a third party tool.
    After that we have to read the XML files and use the tokens to insert into custom tables.
    So, basically we have to create INSERT statements using the data stored in the XML file.
    How do we go about reading / parsing the XML file in Java?
    Pls help!
    Regards,
    Sam

    This is the requirement with an example.
    eg. if the following SQL query is fed into the 3rd party system,
    select last_name,job_id,salary from employees a, deptno b
    where a.deptno = b.deptno
    the output would be,
    <?xml version="1.0" ?>
    <sqlscript dbvendor="MSSQL">
    <fullselectstmt nestlevel="0">
    <subselectstmt><selectclause><fieldlist>
    <field><fieldname>
    <attr>
    <sourcetoken toketype="" dbobjtype="field">last_name</sourcetoken>
    </attr>
    </fieldname>
    </field>
    <field><fieldname>
    <attr>
    <sourcetoken toketype="" dbobjtype="field">job_id</sourcetoken>
    </attr>
    </fieldname>
    </field>
    <field><fieldname>
    <attr>
    <sourcetoken toketype="" dbobjtype="field">salary</sourcetoken>
    </attr>
    </fieldname>
    </field>
    </fieldlist></selectclause>
    <fromclause><joinlist><join nestlevel="0">
    <lztable><simpletable><attr>
    <sourcetoken toketype="" dbobjtype="table">employees</sourcetoken>
    </attr><aliasclause withas="false"><sourcetoken toketype="" dbobjtype="table alias">a</sourcetoken></aliasclause></simpletable></lztable></join><join nestlevel="0">
    <lztable><simpletable><attr>
    <sourcetoken toketype="" dbobjtype="table">deptno</sourcetoken>
    </attr><aliasclause withas="false"><sourcetoken toketype="" dbobjtype="table alias">b</sourcetoken></aliasclause></simpletable></lztable></join></joinlist></fromclause>
    <whereclause><expression exprtype="Expr_Comparison" exproop="="><attr>
    <sourcetoken toketype="" dbobjtype="table alias">a</sourcetoken>
    <sourcetoken toketype="" dbobjtype="unknown">.</sourcetoken>
    <sourcetoken toketype="" dbobjtype="field">deptno</sourcetoken>
    </attr><attr>
    <sourcetoken toketype="" dbobjtype="table alias">b</sourcetoken>
    <sourcetoken toketype="" dbobjtype="unknown">.</sourcetoken>
    <sourcetoken toketype="" dbobjtype="field">deptno</sourcetoken>
    </attr></expression>
    </whereclause></subselectstmt></fullselectstmt>
    </sqlscript>
    So, using the output file, the list of columns (under token "field") last_name,job_id and salary should be inserted into LIST_COLUMNS table. So 3 INSERT statements should be created for 3 columns.
    The list of tables (under token "table") employees and dept should be inserted into LIST_TABLES table. So 2 INSERT statements should be created for the 2 tables.
    Regards,
    Sam

  • How to convert XML document to xml variable?

    Hi,
    I have taken an xml variable in my process and reading a xml document file. Can anyone tell me how can i convert this xml document to xml variable so that i can parse the xml variable.
    I am able to convert xml variable to xml document variable by using set value activity. But how do I perform reverse process.
    I want to perform this conversion because i want to keep xml data in document format on storage drive and then parse this xml data so that i can read the nodes.
    Any help will be appreciated..
    Regards
    Sunil

    we can use set value activity to reach these xml docs and assign it to xml variable.
    Then parsing of this xml can be browsed to find the nodes.
    Regards
    Sunil

  • How to split XML document into two

    I want to create new docuemnt by taking part of the existent XML document under the node document_text
    vNodeList := xmldom.getElementsByTagName(vdoc, 'document_text');
    vNode := xmldom.item(vNodeList, 0); -- The xmldom.getNodeName(vNode) of this node is exactly what i am
    -- looking for
    vdoc:= xmldom.makeDocument( vNode);
    insert into cltab values (empty_clob()) returning cl into cl;
    xmldom.writeToClob(vdoc_txt, cl);
    But after that i am still getting the whole document tree, - copy of the whole document.
    What am i doing wrong? What functions should i use for this kind of task? xmldom.clonenode?
    Could you recommend any good description of the xmldom package?
    Thanks,
    Roman

    If you are using an FI  entry F-43 to generate invoice this can be done by giving the same invoice ref. in the Inv. Ref. field  for two vendors. This is manual
    Document Split will split the document between two profit center and not between vendors.

  • How to convert XML file into DTD or XSD

    Hi Folks,
    This is the output structure I need to get. My interface is file to file. Can u please let me know How do I create a data type or any XSD to get below Structure.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <Command xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Command.xsd">
    - <WriteTagData readerID="EasyDP">
    - <Item>
    - <FieldList format="C:\Documents and Settings\wlee\Desktop\Format_4A.btw" jobName="Test1" quantity="1">
      <Field name="PlantNo">4012</Field>
      <Field name="PlantName">ANE</Field>
      <Field name="SKU">12000001</Field>
      <  </FieldList>
      </Item>
      </WriteTagData>
      </Command>
    Please help me How would I create Data type for this. Your help is highly apreciated
    Thanks,
    Enivass

    Hi Enivas,
    >>>>>>>>>Please help me how would I delete ns0.
    For  remove ns0,  you have to do use XMLAnonymizerBean module  in adpater module (In Communication channel).
    Insert the XMLAnonymizerBean before the CallSapAdapter .
    The module name u2018CallSapAdapteru2019 is default one that can be left as it is.
    Module Name : AF_Modules/XMLAnonymizerBean
    Type: Local Enterprise Bean
    Module Key: 0  
    Add Parameters in the Module Configuration
    2.       Module Key: 0
    Parameter Name: anonymizer.acceptNamespaces
    Parameter Value: <namespace> u2018u2019  
    Enter a list of namespaces and their prefixes that are to be kept in the target XML document and to result a namespace without a prefix, enter u2018 u2018 (two single quotation marks).   In your case like namespace http://www.w3.org/2001/XMLSchema-instance follow with two single quotation marks.
    3.       Module Key: 0
    Parameter Name: anonymizer.quote
    Parameter Value: u2018
    Here specify the character to be used to enclose the attribute values.  The default value is u2018.  
    When scenario is executed, the target message contains the namespace with no prefix.  
    Then, you are not facing any issue in target messages.
    Regards,
    Rajesh

  • How to convert xml data into html format in bpel

    Hi ,
    Can any one tel me how to conevrt xml into html in oracle bpel.
    Does bpel support this functionality or not.
    Regards,
    Ana
    Edited by: user10181991 on Apr 5, 2009 11:16 PM

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • How to upload XML file into the internal table in Webdynpro  ABAP ?

    Hi Friends,
    I am not able to upload the XML file into ABAP,can you please help me in solving this issue with the help of source code.
    Regards
    Dinesh

    Hi Dinesh,
    Try go through this program which I had developed earlier. It takes as input an XML file and then breaks it down into name-value pairs of an intrnal table. You need to pass an XML file as input to this program. (I had hard coded the path for my XML file in it. You need to replace it with 1 of your own or you can just delete it and use the browse button to selet the file on your PC)
    Regards,
    Uday
    REPORT  ZUDAY_XML no standard page heading.
    " Internal table to store the XML file in binary mode
    data: begin of it_xml occurs 1,
            c(255) type x,
          end of it_xml,
    " Name-value pairs table rturned by FM SMUM_XML_PARSE
          it_SMUM_XMLTB type SMUM_XMLTB occurs 0 with header line,
    " Table returned by FM SMUM_XML_PARSE for error handling
          it_bapiret2 type bapiret2 occurs 0 with header line.
    " XSTRING variable to be used by FM SCMS_BINARY_TO_XSTRING to hold the XML file in XSTRING format
    data: I_xstring type xstring, 
    " String variable to hold XML file path to pass to GUI_UPLOAD
          I_file_path type string,
    " Variable to store the size of the uploaded binary XML file
          I_LENGTH TYPE I VALUE 0.
    parameters: P_path type IBIPPARMS-PATH default 'C:\Documents and Settings\c5104398\Desktop\flights.xml'.
    " Get the XML file path from the user
    at selection-screen on value-request for P_path.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          FILE_NAME = P_PATH.

  • I want to convert XML file into SAP Internal table

    Hi Frndz,
    My xml file is:
    <?xml version="1.0" ?>
    - <!-- Comments: START DATE :1/11/2002 11:26:14 PM
      -->
    - <!-- Comments: RFID Tags read by Mercury4 Copyright Praff@Anantara Solutions
      -->
      <RFIDs><ID>0x303030303030303035050000B5EC</ID><ID>0x300833B2DDD901403505000042E7</ID></RFIDs>
    i want to take those 2 ID's in a internal table that id field is of 28 character type....
    very urgent.
    Thanks,
    Arunprasad.P

    class cl_ixml definition load.
    type-pools: ixml.
    types: begin of t_xml_line,
             data(256) type x,
           end of t_xml_line,
           begin of tsfixml,
             data(1024) type c,
           end of tsfixml.
    data: l_ixml type ref to if_ixml,
          l_streamfactory type ref to if_ixml_stream_factory,
          l_parser type ref to if_ixml_parser,
          l_istream type ref to if_ixml_istream,
          l_document type ref to if_ixml_document,
          l_node type ref to if_ixml_node,
          l_xmldata type string.
    data: l_elem type ref to if_ixml_element,
          l_root_node type ref to if_ixml_node,
          l_next_node type ref to if_ixml_node,
          l_name type string,
          l_iterator type ref to if_ixml_node_iterator.
    data: l_xml_table type table of t_xml_line,
          l_xml_line type t_xml_line,
          l_xml_table_size type i.
    data: l_filename type string.
    parameters: pa_file type char1024 default
    'C:\WINDOWS\Desktop\RFIDTags.xml'.
    *Validation of XML file: Only DTD included in xml document is supported
    parameters: pa_val type char1 as checkbox.
    start-of-selection.
    *Creating the main iXML factory
    l_ixml = cl_ixml=>create( ).
    *Creating a stream factory
    l_streamfactory = l_ixml->create_stream_factory( ).
    perform get_xml_table changing l_xml_table_size l_xml_table.
    *wrap the table containing the file into a stream
    l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
                                                        size  = l_xml_table_size ).
    *Creating a document
    l_document = l_ixml->create_document( ).
    *Create a Parser
    l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                      istream = l_istream
                                      document = l_document ).
    *Validate a document
    if pa_val eq 'X'.
        l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    endif.
    *Parse the stream
    if l_parser->parse( ) ne 0.
      if l_parser->num_errors( ) ne 0.
        data: parseerror type ref to if_ixml_parse_error,
              str type string,
              i type i,
              count type i,
              index type i.
              count = l_parser->num_errors( ).
              write: count, ' parse errors have occured:'.
              index = 0.
              while index < count.
                parseerror = l_parser->get_error( index = index ).
                i = parseerror->get_line( ).
                write: 'line: ', i.
                i = parseerror->get_column( ).
                write: 'column: ', i.
                str = parseerror->get_reason( ).
                write: str.
                index = index + 1.
              endwhile.
    endif.
    endif.
    *Process the document
    if l_parser->is_dom_generating( ) eq 'X'.
        perform process_dom using l_document.
    endif.
    *& Form get_xml_table
    form get_xml_table changing l_xml_table_size type i
                  l_xml_table type standard table.
    *Local variable declaration
    data: l_len type i,
          l_len2 type i,
          l_tab type tsfixml,
          l_content type string,
          l_str1 type string,
          c_conv TYPE REF TO cl_abap_conv_in_ce,
          l_itab type table of string.
    l_filename = pa_file.
    *upload a file from the client's workstation
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = l_filename
        FILETYPE                      = 'BIN'
      IMPORTING
        FILELENGTH                    = l_xml_table_size
      HEADER                        =
      TABLES
        DATA_TAB                      = l_xml_table
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *Writing the XML document to the screen
    CLEAR l_str1.
    LOOP AT l_xml_table INTO l_xml_line.
    c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
    replacement = space ).
    c_conv->read( IMPORTING data = l_content len = l_len ).
    CONCATENATE l_str1 l_content INTO l_str1.
    ENDLOOP.
    l_str1 = l_str1+0(l_xml_table_size).
    SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
    WRITE: /.
    WRITE: /' XML File'.
    WRITE: /.
    LOOP AT l_itab INTO l_str1.
    REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab
    IN
    l_str1 WITH space.
    WRITE: / l_str1.
    ENDLOOP.
    WRITE: /.
    endform. "get_xml_table
    *& Form process_dom
    form process_dom using document type ref to if_ixml_document.
    data: node type ref to if_ixml_node,
          iterator type ref to if_ixml_node_iterator,
          nodemap type ref to if_ixml_named_node_map,
          attr type ref to if_ixml_node,
          name type string,
          prefix type string,
          value type string,
          indent type i,
          count type i,
          index type i.
    data: name2 type string,
          name_root type string,
          node_parent type ref to if_ixml_node,
          node_root type ref to if_ixml_node,
          num_children type i.
        node ?= document.
    check not node is initial.
    uline.
    write: /.
    write: /' DOM-TREE'.
    write: /.
    if node is initial. exit. endif.
    create a node iterator
      iterator = node->create_iterator( ).
    get current node
      node = iterator->get_next( ).
    loop over all nodes
        while not node is initial.
          indent = node->get_height( ) * 2.
          indent = indent + 20.
          num_children = node->num_children( ).
          case node->get_type( ).
          when if_ixml_node=>co_node_element.
           element node
            name = node->get_name( ).
            nodemap = node->get_attributes( ).
            node_root = node->get_root( ).
            name_root = node_root->get_name( ).
            write: / 'ELEMENT :'.
            write: at indent name color col_positive inverse.
            write: 'NUM_CHILDREN:', num_children.
            write: 'ROOT:', name_root.
            node_parent = node->get_parent( ).
            name2 = node_parent->get_name( ).
            write: 'NAME2: ' , name2.
        if not nodemap is initial.
    *attributes
            count = nodemap->get_length( ).
            do count times.
            index = sy-index - 1.
            attr = nodemap->get_item( index ).
            name = attr->get_name( ).
            prefix = attr->get_namespace_prefix( ).
            value = attr->get_value( ).
            write: / 'ATTRIBUTE:'.
            write: at indent name color col_heading inverse, '=',
            value color col_total inverse.
        enddo.
    endif.
    when if_ixml_node=>co_node_text or
    if_ixml_node=>co_node_cdata_section.
    *text node
    value = node->get_value( ).
    write: / 'VALUE :'.
    node_parent = node->get_parent( ).
    write: at indent value color col_group inverse.
    name2 = node_parent->get_name( ).
    write: 'NAME2: ' , name2.
    endcase.
    *advance to next node
    node = iterator->get_next( ).
    endwhile.
    endform. "process_dom
    Thanks,
    Arunprasad.P

Maybe you are looking for

  • PDF Output of Spfli!

    Hi,    I've created an Input Node node_in which consists of the carrid of the table spfli. I've created a PDF interactive form which outputs all the details of spfli. Now my requirement is when i select a carrid in the view and say submit. It should

  • LCD Tv -- Macbook pro?

    Hey Just brought a LCD HD ready tv with a HDMI slot, how do I connect my Macbook pro?? Thanks

  • Removing iPad from otterbox case

    In response to an earlier post about removing residue from an iPad screen, I was going to try the warm water on a cloth approach but I can't get the iPad out of the case now:). I have the commuter series I think is what it's called, it's the cheaper

  • HT5293 Why does wireshark (1.12.0) crash within a sec after connecting it to XQuartz (2.7.7) ?? have tried to re-install, it doesn't work.

    i have 10.9.4 on my mac, and i need Wireshark to work, because we use it in lectures (in my education,, i'm not english speaking by birth).. I have installed Wireshark 1.12.0 and there no prob starting up when its not connected to XQuartz, but it kin

  • Re-write 32bit chroot daemon in systemd service format?

    I followed the Arch wiki instructions quite successfully and have been using the daemon script to use a 32bit chroot. I just switched over fully to systemd (at least I think so) and no longer have the ability to start it since rc.conf no longer exist