Extract xml file with rowset schema using plsql

I want to extract the rowsheet data from an xml file using plsql database procedure
Here is an example of the xml file:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
     xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
     xmlns:rs='urn:schemas-microsoft-com:rowset'
     xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
     <s:ElementType name='row' content='eltOnly'>
          <s:AttributeType name='Sheet_Number' rs:number='1' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
          </s:AttributeType>
          <s:AttributeType name='Appl_Number1' rs:number='2' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
          </s:AttributeType>
          <s:AttributeType name='Rating1' rs:number='3' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='string' dt:maxLength='25'/>
          </s:AttributeType>
          <s:AttributeType name='Criteria1' rs:number='4' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='string' dt:maxLength='25'/>
          </s:AttributeType>
          <s:AttributeType name='Appl_Number2' rs:number='5' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
          </s:AttributeType>
          <s:AttributeType name='Rating2' rs:number='6' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='string' dt:maxLength='25'/>
          </s:AttributeType>
          <s:AttributeType name='Criteria2' rs:number='7' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='string' dt:maxLength='25'/>
          </s:AttributeType>
          <s:extends type='rs:rowbase'/>
     </s:ElementType>
</s:Schema>
<rs:data>
     <z:row Sheet_Number='32486' Appl_Number1='198970' Rating1='-2' Criteria1='RTG' Appl_Number2='198989' Rating2='5'
          Criteria2='RTG'/>
     <z:row Sheet_Number='12345' Appl_Number1='198970' Rating1='-3' Criteria1='RTG' Appl_Number2='198989' Rating2='3'
          Criteria2='RTG'/>
</rs:data>
</xml>
I need to extract the values from all of the columns : sheet_number, appl_number1, rating1, criteria1, appl_number2, rating2, criteria2. Validate the data and insert into oracle tables.
I'm having dificulties extrating the data from the "z:row" recordset
Can anyone help with the syntax ?
I'm use to extracting with tags using syntax like this
declare
v_xml_content XMLTYPE;
begin
v_xml_content := db_get_xml_from_file (p_file_name, p_directory, 'ISO-8859-1');
FOR f IN (SELECT value(x) file_data
FROM TABLE
(xmlsequence
(extract (v_xml_content,'/data'))) x) LOOP
SELECT extractvalue(f.file_data,'/data/row') into v_row from dual;                                                                      END LOOP;

I want to extract the rowsheet data from an xml file using plsql database procedure
Here is an example of the xml file:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
     xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
     xmlns:rs='urn:schemas-microsoft-com:rowset'
     xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
     <s:ElementType name='row' content='eltOnly'>
          <s:AttributeType name='Sheet_Number' rs:number='1' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
          </s:AttributeType>
          <s:AttributeType name='Appl_Number1' rs:number='2' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
          </s:AttributeType>
          <s:AttributeType name='Rating1' rs:number='3' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='string' dt:maxLength='25'/>
          </s:AttributeType>
          <s:AttributeType name='Criteria1' rs:number='4' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='string' dt:maxLength='25'/>
          </s:AttributeType>
          <s:AttributeType name='Appl_Number2' rs:number='5' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
          </s:AttributeType>
          <s:AttributeType name='Rating2' rs:number='6' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='string' dt:maxLength='25'/>
          </s:AttributeType>
          <s:AttributeType name='Criteria2' rs:number='7' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
               <s:datatype dt:type='string' dt:maxLength='25'/>
          </s:AttributeType>
          <s:extends type='rs:rowbase'/>
     </s:ElementType>
</s:Schema>
<rs:data>
     <z:row Sheet_Number='32486' Appl_Number1='198970' Rating1='-2' Criteria1='RTG' Appl_Number2='198989' Rating2='5'
          Criteria2='RTG'/>
     <z:row Sheet_Number='12345' Appl_Number1='198970' Rating1='-3' Criteria1='RTG' Appl_Number2='198989' Rating2='3'
          Criteria2='RTG'/>
</rs:data>
</xml>
I need to extract the values from all of the columns : sheet_number, appl_number1, rating1, criteria1, appl_number2, rating2, criteria2. Validate the data and insert into oracle tables.
I'm having dificulties extrating the data from the "z:row" recordset
Can anyone help with the syntax ?
I'm use to extracting with tags using syntax like this
declare
v_xml_content XMLTYPE;
begin
v_xml_content := db_get_xml_from_file (p_file_name, p_directory, 'ISO-8859-1');
FOR f IN (SELECT value(x) file_data
FROM TABLE
(xmlsequence
(extract (v_xml_content,'/data'))) x) LOOP
SELECT extractvalue(f.file_data,'/data/row') into v_row from dual;                                                                      END LOOP;

Similar Messages

  • How to validate an XML file with XSD Schema on JDK 1.4

    Hi
    I'm looking for samples how to validate xml files with xsd schema using jsdk 1.4
    Thank you.

    This is how.
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.dom.DOMResult;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.validation.Schema;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Validator;
    DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
    dbfac.setNamespaceAware(true);
    SchemaFactory factory1 = SchemaFactory
                        .newInstance("http://www.w3.org/2001/XMLSchema");
    Schema schema = factory1.newSchema(new File("person.xsd"));
    dbfac.setSchema(schema);
    DocumentBuilder dbparser1 = dbfac.newDocumentBuilder();
    Document doc1 = dbparser1.parse(new File("person.xml"));
    Validator validator1 = schema.newValidator();
    DOMSource dm1 = new DOMSource(doc1);
    DOMResult domresult1 = new DOMResult();
    validator1.validate(dm1, domresult1);

  • How to validate xml file with XSD schema ??  in JDK1.4.2

    How to validate xml file with XSD schema ?? in JDK1.4.2
    i dont want to use new Xerec Jar ...
    Suggest option ...

    Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
    Then use Stax (Woodstock) or Saxon.
    - Saish

  • Binding Xml file with Xsd Schema

    Hello
    everybody there.
    I am trying to make an application where word files are converted into xml.
    For that i have used org.exolab.castor and org.apache.poi.hwpf.
    Now the problem is that i was able to generate the xml file from word, but when i am binding it with XMLSchema.xsd following error is coming.
    java.lang.IllegalArgumentException: getSimpleType: the simple type 'formChoice' is not a built-in type as defined in XML Schema specification.
         at org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:1289)
         at org.exolab.castor.xml.schema.Schema.addSimpleType(Schema.java:583)
         at org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.endElement(SchemaUnmarshaller.java:643)
         at org.exolab.castor.xml.schema.reader.Sax2ComponentReader.endElement(Sax2ComponentReader.java:198)
         at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
         at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
         at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
         at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
         at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
         at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:430)
         at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:485)
         at TempHwpf.<init>(TempHwpf.java:35)
         at TempHwpf.main(TempHwpf.java:44)the code for binding my xml file with xsd schema is as under:-
    SourceGenerator sourcegen = new SourceGenerator();
    sourcegen.getVersion();
    System.out.println(sourcegen.getVersion());
    sourcegen.generateSource("XMLSchema.xsd","packagename");I have checked XMLSchema.xsd file, in that formChoice is already defined, than also error is coming.
    can anyone help me out. first i thought that XMLSchema.xsd which i have is not proper, but i downloaded it again from w3c.org,
    than also same error is shown.
    please help me out.
    waiting for reply.
    milind

    Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
    Then use Stax (Woodstock) or Saxon.
    - Saish

  • What's the best way to create XML file with a schema from a database table?

    Hi,
    I want to create an XML file from a database table (which has over 600 columns) using XML schema (.xsd file). I want to know the best way to do this.
    The output XML file is NOT a direct data dump from the DB table, there�re some logic around it, such as the XML file has some hierarchy with repeating tags.
    I have done this using JAXB by creating Java classes form XML schema, but I don�t want to map 600 DB columns to these Java classes manually, and loop through the record set to create repeating tags.
    I know there are few tools around now like MapForce (Altova), how do people do these now?
    Thanks,
    Chandi

    Can you use a schema when we compose XML doc from Database tables?
    Actually, I'm using SQL Server (sorry, wrong forum). But, I thought a Java tool would have a solution for me.

  • How to generate xml file with multiple nodes using sqlserver as database in SSIS..

    Hi ,
    I have to generate the xml file using multiple nodes by using ssis and database is sqlserver.
    Can some one guide me on to perform this task using script task?
    sudha

    Why not use T-SQL for generating XML? You can use FOR XML for that
    http://visakhm.blogspot.in/2014/05/t-sql-tips-fun-with-for-xml-path.html
    http://visakhm.blogspot.in/2013/12/generating-nested-xml-structures-with.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Problem validating XML file with external schema file

    Hi All
    I am having trouble at the moment trying to validate an xml file using an external xsd file that sits on my server. I have followed the basic option but at the moment to no avail. I am using a DOMParser and am setting all the features and properties correctly ... well I think I am anyway.....below is a fragment of the code
    DOMParser parser = new DOMParser ();
    // Setting the validation on for the parser.
    parser.setFeature ( "http://xml.org/sax/features/validation", true );
    parser.setFeature ( "http://apache.org/xml/features/validation/schema", true);
    parser.setProperty ( "http://apache.org/xml/properties/schema/externalnoNamespaceSchemaLocation", "c://testing.xsd" );
    parser.setErrorHandler ( this );
    I am getting an error telling me that the root element cannot be found.....see below
    org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'mainhome'.
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLNamespaceBinder.startElement(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at com.cibenix.aps.util.MenuXMLParser.process(MenuXMLParser.java:163)
    at com.cibenix.aps.actions.MenuAddAction.execute(MenuAddAction.java:80)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
    Any help would be greatly appreciated
    thanks

    In the schema root element xs:schema add namespace declaration.
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    In the XML document root element add xmlns:xsi and xsi:noNamespaceSchemaLocation attributes.
    <root_element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://c:/testing.xsd">

  • XML generation with SAP data using XML schema - Reg

    Hello experts,
      My requirement is , SAP( ztable data )  data has to be transferred to third party software folder.Third party using XML so they requires output from SAP in XML format.
    For that third party software guys told me that they will give their own XML schema to me.I have to generate XML file with SAP data using their XML schema.
    Generating XML file with their Schema should be underlined.
    I studied that call transformation statement helps for this.
    Even then i don't have clear idea about this topic.
    Please brief me about how to use their XML schema to generate XML with my own sap data.
    Thanks in advance experts.
    Kumar

    please  try this  same program    and see  it ....
    *& Report  z_xit_xml_check
      REPORT  z_xit_xml_check.
      TYPE-POOLS: ixml.
      TYPES: BEGIN OF t_xml_line,
              data(256) TYPE x,
            END OF t_xml_line.
      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:temporders_dtd.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 METHOD cl_gui_frontend_services=>gui_upload
          EXPORTING
            filename   = l_filename
            filetype   = 'BIN'
          IMPORTING
            filelength = l_xml_table_size
          CHANGING
            data_tab   = l_xml_table
          EXCEPTIONS
            OTHERS     = 19.
        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.
        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.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
    *         element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
              WRITE: / 'ELEMENT  :'.
              WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
              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     :'.
              WRITE: AT indent value COLOR COL_GROUP INVERSE.
          ENDCASE.
    *     advance to next node
          node = iterator->get_next( ).
        ENDWHILE.
      ENDFORM.                    "process_dom
    reward  points  if it is use fulll ....
    Girish

  • How to extract data from XML file with JavaScript

    HI All
    I am new to this group.
    Can anybody help me regarding XML.
    I want to know How to extract data from XML file with JavaScript.
    And also how to use API for XML
    regards
    Nagaraju

    This is a Java forum.
    JavaScript is something entirely different than Java, even though the names are similar.
    Try another website with forums about JavaScript.
    For example here: http://www.webdeveloper.com/forum/forumdisplay.php?s=&forumid=3

  • Create XML file with worksheet's dynamically assigned through XSLT

    Hi all
    I have a requirement to create a xml file with worksheets dynamically created based on a field value in the internal table .
    I have all my values in internal table,  and am calling the transformation from bsp application.
    Say the internal table has field dataxyz, for every change in value in this field dataxyz  i need to create separate worksheet and populate that sheet with some corresponding values .
    please guide me how to create worksheet dynamically.
    thanks in advance.
    Bharathy
    Edited by: elam.bharathy on May 16, 2011 6:51 AM

    Can you use a schema when we compose XML doc from Database tables?
    Actually, I'm using SQL Server (sorry, wrong forum). But, I thought a Java tool would have a solution for me.

  • Create xml file with values from context

    Hi experts!
    I am trying to implement a WD application that will have some input fields, the value of those input fields will be used to create an xml file with a certain format and then sent to a certain application.
    Apart from this i want to read an xml file back from the application and then fill some other context nodes with values from the xml file.
    Is there any standard used code to do this??
    If not how can i do this???
    Thanx in advance!!!
    P.S. Points will be rewarded to all usefull answers.
    Edited by: Armin Reichert on Jun 30, 2008 6:12 PM
    Please stop this P.S. nonsense!

    Hi,
    you need to create three util class for that:-
    XMLHandler
    XMLParser
    XMLBuilder
    for example in my XML two tag item will be there e.g. Title and Organizer,and from ur WebDynpro view you need to pass value for the XML tag.
    And u need to call buildXML()function of builder class to generate XML, in that i have passed bean object to get the values of tags. you need to set the value in bean from the view ui context.
    Code for XMLBuilder:-
    Created on Apr 4, 2006
    Author-Anish
    This class is to created for having function for to build XML
    and to get EncodedXML
      and to get formated date
    package com.idb.events.util;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import com.idb.events.Event;
    public class XMLBuilder {
    This attribute represents the XML version
         private static final double VERSION_NUMBER = 1.0;
    This attribute represents the encoding
         private static final String ENCODING_TYPE = "UTF-16";
         /*Begin of Function to buildXML
    return: String
    input: Event
         public String buildXML(Event event) {
              StringBuffer xmlBuilder = new StringBuffer("<?xml version=\"");
              xmlBuilder.append(VERSION_NUMBER);
              xmlBuilder.append("\" encoding=\"");
              xmlBuilder.append(ENCODING_TYPE);
              xmlBuilder.append("\" ?>");
              xmlBuilder.append("<event>");
              xmlBuilder.append(getEncodedXML(event.getTitle(), "title"));
              xmlBuilder.append(getEncodedXML(event.getOrganizer(), "organizer"));
              xmlBuilder.append("</event>");
              return xmlBuilder.toString();
         /End of Function to buildXML/
         /*Begin of Function to get EncodedXML
    return: String
    input: String,String
         public String getEncodedXML(String xmlString, String tag) {
              StringBuffer begin = new StringBuffer("");
              if ((tag != null) || (!tag.equalsIgnoreCase("null"))) {
                   begin.append("<").append(tag).append(">");
                   begin.append("<![CDATA[");
                   begin.append(xmlString).append("]]>").append("</").append(
                        tag).append(
                        ">");
              return begin.toString();
         /End of Function to get EncodedXML/
         /*Begin of Function to get formated date
    return: String
    input: Date
         private final String formatDate(Date inputDateStr) {
              String date;
              try {
                   SimpleDateFormat simpleDateFormat =
                        new SimpleDateFormat("yyyy-MM-dd");
                   date = simpleDateFormat.format(inputDateStr);
              } catch (Exception e) {
                   return "";
              return date;
         /End of Function to get formated date/
    Code for XMLParser:-
    Created on Apr 12, 2006
    Author-Anish
    This is a parser class
    package com.idb.events.util;
    import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.XMLReader;
    import com.idb.events.Event;
    import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
    public class XMLParser {
    Enables namespace functionality in parser
         private final boolean isNameSpaceAware = true;
    Enables validation in parser
         private final boolean isValidating = true;
    The SAX parser used to parse the xml
         private SAXParser parser;
    The XML reader used by the SAX parser
         private XMLReader reader;
    This method creates the parser to parse the user details xml.
         private void createParser()
              throws SAXException, ParserConfigurationException {
              // Create a JAXP SAXParserFactory and configure it
              SAXParserFactory saxFactory = SAXParserFactory.newInstance();
              saxFactory.setNamespaceAware(isNameSpaceAware);
              saxFactory.setValidating(isValidating);
              // Create a JAXP SAXParser
              parser = saxFactory.newSAXParser();
              // Get the encapsulated SAX XMLReader
              reader = parser.getXMLReader();
              // Set the ErrorHandler
    This method is used to collect the user details.
         public Event getEvent(
              String newsXML,
              XMLHandler xmlHandler,
              IWDMessageManager mgr)
              throws SAXException, ParserConfigurationException, IOException {
              //create the parser, if not already done
              if (parser == null) {
                   this.createParser();
              //set the parser handler to extract the
              reader.setErrorHandler(xmlHandler);
              reader.setContentHandler(xmlHandler);
              InputSource source =
                   new InputSource(new ByteArrayInputStream(newsXML.getBytes()));
              reader.parse(source);
              //return the results of the parse           
              return xmlHandler.getEvent(mgr);
    Code for XMLHandler:-
    Created on Apr 12, 2006
    Author-Anish
    This is a parser class
    package com.idb.events.util;
    import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.XMLReader;
    import com.idb.events.Event;
    Created on Apr 12, 2006
    Author-Anish
    *This handler class is created to have constant value for variables and function for get events,
        character values for bean variable,
        parsing thr date ......etc
    package com.idb.events.util;
    import java.sql.Timestamp;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.Locale;
    import org.xml.sax.Attributes;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.helpers.DefaultHandler;
    import java.util.*;
    import com.idb.events.Event;
    import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
    public class XMLHandler extends DefaultHandler {
         private static final String TITLE = "title";
         private static final String ORGANIZER = "organizer";
         IWDMessageManager manager;
         private Event events;
         private String tagName;
         public void setManager(IWDMessageManager mgr) {
              manager = mgr;
    This function is created to get events
         public Event getEvent(IWDMessageManager mgr) {
              manager = mgr;
              return this.events;
    This function is created to get character for setting values through event's bean setter method
         public void characters(char[] charArray, int startVal, int length)
              throws SAXException {
              String tagValue = new String(charArray, startVal, length);
              if (TITLE.equals(this.tagName)) {
                   this.events.setTitle(tagValue);
              if (ORGANIZER.equals(this.tagName)) {
                   String orgName = tagValue;
                   try {
                        orgName = getOrgName(orgName);
                   } catch (Exception ex) {
                   this.events.setOrganizer(orgName);
    This function is created to parse boolean.
         private final boolean parseBoolean(String inputBooleanStr) {
              boolean b;
              if (inputBooleanStr.equals("true")) {
                   b = true;
              } else {
                   b = false;
              return b;
    This function is used to call the super constructor.
         public void endElement(String uri, String localName, String qName)
              throws SAXException {
              super.endElement(uri, localName, qName);
         /* (non-Javadoc)
    @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
    This function is used to call the super constructor.
         public void fatalError(SAXParseException e) throws SAXException {
              super.fatalError(e);
    This function is created to set the elements base on the tag name.
         public void startElement(
              String uri,
              String localName,
              String qName,
              Attributes attributes)
              throws SAXException {
              this.tagName = localName;
              if (ROOT.equals(tagName)) {
                   this.events = new Event();
         public static void main(String a[]) {
              String cntry = "Nigeria";
              XMLHandler xml = new XMLHandler();
              ArrayList engList = new ArrayList();
              engList = xml.getCountries();
              ArrayList arList = xml.getArabicCountries();
              int engIndex = engList.indexOf(cntry);
              System.out.println("engIndex  :: " + engIndex);
              String arCntryName = (String) arList.get(engIndex);
              System.out.println(
                   ">>>>>>>>>>>>>>>>>>>>" + xml.getArabicCountryName(cntry));
    Hope that may help you.
    If need any help , you are most welcome.
    Regards,
    Deepak

  • Problem In Extracting xml file from Zip File

    Hi,
    In my application I am creating a zip file which contains some xml files. I am using Weblogic 8.1 for my application.
    When I try to extract the xml file from the zip file it displays error and those xml files are not extracted from the zip file.
    Otherwise on tomcat it works absolutely fine.
    Is there any support issues of using the zip files with weblogic?
    Please respond.
    Thanks in Advance.

    Friends
    I resolved the problem
    just to add the jars of
    mail.jar and activation.jar in the client side.
    regards
    ashok

  • Example of xml file with connection pool SAP

    Hi Everyone
    I need a .xml file with pool connection SAP to run on weblogic 8.1.
    Where do I get it?
    Thanks

    Stefan
    Whether your XML is stored using structured storage or not is determined by the way your initially register the schema, not by the way the XML is delivered into the database. Even when performing, for example, and INSERT using a CLOB value, this CLOB will be 'shredded' into the structured storage tables if you have created them appropriately. If not, it will be stored as a simple CLOB.
    Allan

  • Count files in a dirctory using plsql

    Hi ,
    Currently i am using a shell script that counts the number of files in unix level directory that had xml files and load to the table as CLOB using the sql loader.
    Now i want to use plsql l to count files and then load using insert the script.I am able to use insert statement but not have any idea to count files at unix level using plsql.
    Please give me some ideas.
    Thanks in Advance.
    Rede

    Neither does anyone else... <<LOL
    I've found this one quite some time ago...
    -- How to get a listing of files in a directory using PL/SQL has got to be one of the most
    -- popular questions asked by Oracle developers. Prior to 10g, DIY solutions included the
    -- sophisticated, using either Java (8i onwards) or External Procedures (8 onwards),
    -- or the clunky (pipe servers and shell scripts from 7 onwards)
    -- However in 10g there is a new procedure hidden away in the undocumented
    -- DBMS_BACKUP_RESTORE package. It's called searchfiles, which is a bit of a giveaway
    -- and appears to have been introduced for the new backup features in 10g, as RMAN
    -- now needs to know about files in the recovery destination.
    -- Calling this procedure populates an in memory table called X$KRBMSFT, which
    -- is one of those magic X$ tables, the only column which is of relevance to us
    -- is FNAME_KRBMSFT which is the fully qualified path and file name.
    -- This X$ table acts in a similar fashion to a global temporary table in that it's contents
    -- can only be seen from the calling session. So two sessions can call searchfiles and each
    -- can only see the results of their call (which is extremely useful).
    -- The code sample below will only really run as SYS, due to the select from X$KRBMSFT, it's
    -- just intended as a demo. The first two parameters in the call to searchfiles are
    -- IN OUT so must be defined as variables, even though the second parameter is of no consequence
    -- to us and should be left as NULL. Even though they are IN OUT, testing shows they don't
    -- appear to change.
    -- Updated 29/05/2007
    -- The first parameter is the string to search for, in much the same format as you would pass
    -- in a call to dir (Windows) or ls (Unix). However, on some platforms and versions
    -- passing in a wildcard or anything other than a directory name will result in an empty X$KRBMSFT.
    -- The trick here is to simply pass a valid OS directory name - the entire listing of that directories
    -- contents will now appear in X$KRBMSFT, which can then be filtered using LIKE.
    -- This procedure appears to raise no exceptions, passing an invalid search string, such
    -- as a non-existant path or one with no permissions, simply results in an empty X$KRBMSFT.
    -- However, if the database parameter db_recovery_file_dest is not set, you will get ORA-19801.
    -- Interestingly, this procedure recursively searches sub directories found in the search string.
    -- So passing a string of 'C:\windows' (for example) populates X$KRBMSFT with not only the files found
    -- in that directory but all the files found in all directories beneath, such as C:\windows\system32.
    -- As X$KRBMSFT is an in memory table, you have been warned! Calling this procedure on a directory
    -- with thousands of sub directories and files has the potential to blow out memory
    -- The way forward is to wrap this functionality in a package, perhaps using
    -- directory objects instead and checking access priviliges, creating a view based on X$KRBMSFT,
    -- maybe even allowing/disallowing subdirectory traversal and limiting memory usage search size.
    -- I see another project coming, stay tuned for XUTL_FINDFILES!
    -- This code has been tested and works as intended on Oracle 10104 EE.
    -- Get this tip and others, along with useful PL/SQL utilities at
    -- www.chrispoole.co.uk
    DECLARE
    pattern VARCHAR2(1024) := '/u01/oracle/admin/SID/udump';
    ns VARCHAR2(1024);
    BEGIN
    SYS.DBMS_BACKUP_RESTORE.searchFiles(pattern, ns);
    FOR each_file IN (SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT WHERE FNAME_KRBMSFT LIKE '%.trc') LOOP
    DBMS_OUTPUT.PUT_LINE(each_file.name);
    END LOOP;
    END;
    DECLARE
    pattern VARCHAR2(1024) := 'C:\temp\*';
    ns VARCHAR2(1024);
    BEGIN
    SYS.DBMS_BACKUP_RESTORE.searchFiles(pattern, ns);
    FOR each_file IN (SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT) LOOP
    DBMS_OUTPUT.PUT_LINE(each_file.name);
    END LOOP;
    END;
    /Thomas

  • How can I save a XML file with JAXP1.1?

    Dear All.
    I write a program to create XML file with DOM model, but I can't know how to save it? My environment is JAXP1.1 and JDK1.3.1,I has been required not use other XML parser toolkits,only JAXP1.1.
    How can I do? thank you.
    Many person give me a idea the com.sun.xml.tree.XmlDocument, but I can't find the class in API document or JAXP1.1's packages. why?
    what is it? How can i use it?
    thank you very much.

    The way to save an XML Document is using a Transformer.
    To have access to a transformer use the packages :
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    Then for saving your Document Object (named dXml) get a Transformer Object with the TransformerFactory Object :
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer t = tf.newTransformer();
    Now you have got your Transformer Object, to save your Document Object use the method :
    Document dXml = getMyDocument(); // this is your Document Object.
    OutputStream osSave = getMySaveStream(); // this the OutputStream you need to save your Document.
    try
    t.transform(new DomSource(dXml), new StreamResult(new OutputStreamWriter(osSave)));
    finally
    osSave.close();
    And your Document was now saved.

Maybe you are looking for

  • Desktop Bluetooth Windows 7 Not working

    I have a BB 9000 that I have been trying to connect with desktop manager 6.0 by Bluetooth in Windows 7. Windows 7 pairs with the 9000 with no issue, but then the DT does not find the device. I have also removed the pairing with win 7 and had DT locat

  • Acrobat 9 Pro: Sudden license issue prevent use

    When trying to open a pdf document in Acrobat 9 Pro, I get to open it, but after a few seconds a window pops up, titled: "Licensing for this product has stopped working." The message reads: "You cannot use this product at this time. You must repair t

  • I Want to graph useing MSGraph with array data

    Hi.. I need to skill to graph using the msgraph with array data My forte version 2.0h E-MAIL ADDRESS : [email protected] TEL(C) : 02)273-3131(5233), 0331)40-8366(ÇöÀç ¿©±â ÀÖ½¿) PAGER : 015-959-9390 HAND PHONE : 011-411-9395 To unsubscribe, email '[e

  • Can Hyperion Reports Put Numbers On Rows??

    A client want us to show rows with sequential numbers. Is there a way to allow this to happen without hardcoding? We are using the @Children function throughout the reports and would each row to have differnt number and dynamically update as hierarch

  • Different screens in docking container...?

    Hi gurus, I'll try to explain what I'd like to do.... I have a dynpro with a docking container, on the left I have a tree where I can choose an activity (e.g.: go to se11, go to se38, go to se16, and so on). I would like to run those transaction insi