Parsing XML document with nested elements into multiple db tables(master-detail)

Can you help me with storing xml document into master-detail tables?
I have two tables:
1) customers (customerid number primary key, firstname varchar2(30),lastname varchar2(30))
2) cust_addresses (customerid number references customers, street varchar2(30),city varchar2(30),state varchar2(10),zip varchar2(10))
I have XML document:
<?xml version="1.0"?>
<ROWSET>
<ROW num="1">
<CUSTOMERID>1044</CUSTOMERID>
<FIRSTNAME>Paul</FIRSTNAME>
<LASTNAME>Astoria</LASTNAME>
<HOMEADDRESS>
<STREET>123 Cherry Lane</STREET>
<CITY>SF</CITY>
<STATE>CA</STATE>
<ZIP>94132</ZIP>
</HOMEADDRESS>
<HOMEADDRESS>
<STREET>N.Fryda 4</STREET>
<CITY>CB</CITY>
<STATE>CZ</STATE>
<ZIP>37005</ZIP>
</HOMEADDRESS>
</ROW>
</ROWSET>
I know that I must use DBSM_XMLSave package, create view and instead of trigger but I did found no example in documentation.
Thanx.

Interested question; one I do not know the answer to at the moment, I am afraid. I would like to know your results.
To tell others, though, what I have done. I did finally adapt Muench's not-yet-published examples #71 to work with a table. Here the table has as it's value "#{backing_app_EPG_DAYPG.jobDayDriverTable[row.Id1]}"
This accesses a hash map defined in the backing bean as follows:
public Map jobDayDriverTable = new HashMap(){
@Override
public Object get(Object key) {
Number jobDayId = (Number)key;
if (getEpgDayPage().jobDayDrivers(jobDayId) != null) {
return getEpgDayPage().jobDayDrivers(jobDayId).getAllRowsInRange();
else return null;
jobDayDrivers returns RowIterator. From this I call getAllRowsInRange which returns a Row[]. The table consumes this as a value, and lists the values as I want.
Since the table is using Rows for its rows, I am guessing that it would have access to #{row.rowKeyStr}, or at least #{row.<pk>} which would allow you to programmatically set the current row using code like the following:
public static boolean setCurrentRow() {
// BindingContainer bindings = getBindings();
OperationBinding operationBinding =
// bindings.getOperationBinding("setCurrentRowWithKey");
(OperationBinding)EL.get("#{bindings.setCurrentRowWithKey}");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return false;
return true;
You could call this as part of code in a pages backing bean behind a button or link.
Hope this helps somebody.
By the way example #71 was to get a detail set of rows from a master row value and display the detail set in the master row of an af:table.
You can find this and other examples at http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html

Similar Messages

  • Transforming xml file with different elements into HTML

    hi all !
    i have an xml object that has been generated from database using java. the xml file has numerous elements that have been merged into single file. all elements have been got from different table :-
    <?xml version = '1.0' ?>
    <ROWSET>
    <ROW id= "1">
    <EMPID>1</EMPID>
    <EMPADDRESS>H 3 STREET 4</EMPADDRESS>
    <EMPPHONE>98764653</EMPPHONE>
    </ROW>
    <ROW id="2">
    <EMPID>5</EMPID>
    <EMPQUAL>GRADE 12</EMPQUAL>
    <EMPGRADE>A</EMPGRADE>
    </ROW>
    </ROWSET>
    (its just a sample data, might not be wel formed)
    as it shows that each element "ROW" has data corresponding to different employee and with different details. actually these elemnt are the updates in an employee profile that have to be communicated to a distant located database. what i need is a tranformation into HTML so that the recieving user can view this file as html with relative headings of corresponding tables.
    (the schema at both ends is exact replica)
    any help in this regards would be obliging.

    thank you bro!
    the xml file has been created by importing multiple files resulted from XSU into a master file in java. we are running a web based project in a distributed environment. so i would need to make this page appear in a web browser with ACCEPT and REJECT command buttons as the receiver is the approving agent. what all i have thought of so far is to create a style sheet with templates of all heading of each table from where the data is coming from and then run a check on what table the data is from and place that specific heading on the entry. the style sheet would be placed at both ends so only the xml file will be transported and transformation would be done auto.
    i hope it works. but am not sure wether its the right approach or not.

  • Parse xml document with xpath

    I would like to parse an xml document using xpath, see:
    http://www.onjava.com/pub/a/onjava/2005/01/12/xpath.html
    however, in the documentation (in the link above), it states that I need J2SE 5.0.
    Currently, I have:
    $ java -version
    java version "1.5.0_11"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
    Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)
    Does that mean that I really have to install J2SE 5.0 in order to use J2SE 5.0's XPath support? Does anybody know anything about getting started with XPath, and whether I can just use my existing version of Java? I've never used XPath.
    For more documentation, one can view:
    http://www.w3.org/TR/xpath20/
    Thank you.

    I have copied the code for the xpath tutorial on
    http://www.onjava.com/pub/a/onjava/2005/01/12/xpath.html
    exactly as it is on the tutorial, and imported the correct jars (I think).
    But still my code is giving lots of errors!
    Granted its my first shot but anyway here's the code and the errors...
    package test;
    import org.jdom.xpath.*;
    import java.io.*;
    import javax.xml.xpath.*;
    public class XPath {
         public static void main (String [] args){
              XPathFactory factory = XPathFactory.newInstance();
              XPath xPath=factory.newXPath();
              XPathExpression  xPathExpression=xPath.compile("/catalog/journal/article[@date='January-2004']/title");
              File xmlDocument = new File("/home/myrmen/workspace/Testing/test/catalog.xml");     
              //FileInputStream fis = new FileInputStream(xmldocument); 
              InputSource inputSource = new InputSource(new FileInputStream(xmlDocument));
              String title = xPathExpression.evaluate(inputSource);
              String publisher = xPath.evaluate("/catalog/journal/@publisher", inputSource);
              String expression="/catalog/journal/article";
              NodeSet nodes = (NodeSet) xPath.evaluate(expression, inputSource, XPathConstants.NODESET);
              NodeList nodeList=(NodeList)nodes;
              SAXBuilder saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
              org.jdom.Document jdomDocument = saxBuilder.build(xmlDocument);
              org.jdom.Attribute levelNode = (org.jdom.Attribute)(XPath.selectSingleNode(jdomDocument,"/catalog//journal[@title='JavaTechnology']" + "//article[@date='January-2004']/@level"));
              levelNode.setValue("Intermediate");
              org.jdom.Element titleNode = (org.jdom.Element) XPath.selectSingleNode( jdomDocument,"/catalog//journal//article[@date='January-2004']/title");
              titleNode.setText("Service Oriented Architecture Frameworks");
              java.util.List nodeList = XPath.selectNodes(jdomDocument,"/catalog//journal[@title='Java Technology']//article");
              Iterator iter=nodeList.iterator();
              while(iter.hasNext()) {
                   org.jdom.Element element = (org.jdom.Element) iter.next();
                   element.setAttribute("section", "Java Technology");
              XPath xpath = XPath.newInstance("/catalog//journal:journal//article/@journal:level");
              xpath.addNamespace("journal", "http://www.w3.org/2001/XMLSchema-Instance");
              levelNode = (org.jdom.Attribute) xpath.selectSingleNode(jdomDocument);
              levelNode.setValue("Advanced");
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         Type mismatch: cannot convert from XPath to XPath
         The method compile(String) is undefined for the type XPath
         InputSource cannot be resolved to a type
         InputSource cannot be resolved to a type
         NodeSet cannot be resolved to a type
         NodeSet cannot be resolved to a type
         NodeList cannot be resolved to a type
         NodeList cannot be resolved to a type
         SAXBuilder cannot be resolved to a type
         SAXBuilder cannot be resolved to a type
         The method selectSingleNode(Document, String) is undefined for the type XPath
         The method selectSingleNode(Document, String) is undefined for the type XPath
         Duplicate local variable nodeList
         The method selectNodes(Document, String) is undefined for the type XPath
         Iterator cannot be resolved to a type
         The method newInstance(String) is undefined for the type XPath
         The method addNamespace(String, String) is undefined for the type XPath
         The method selectSingleNode(Document) is undefined for the type XPath
         at test.XPath.main(XPath.java:12)

  • How to parse XML document with default namespace with JDOM XPath

    Hi All,
    I am having difficulty parsing using Saxon and TagSoup parser on a namespace html document. The relevant content of this document are as follows:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body>
        <div id="container">
            <div id="content">
                <table class="sresults">
                    <tr>
                        <td>
                            <a href="http://www.abc.com/areas" title="Hollywood, CA">hollywood</a>
                        </td>
                        <td>
                            <a href="http://www.abc.com/areas" title="San Jose, CA">san jose</a>
                        </td>
                        <td>
                            <a href="http://www.abc.com/areas" title="San Francisco, CA">san francisco</a>
                        </td>
                        <td>
                            <a href="http://www.abc.com/areas" title="San Diego, CA">San diego</a>
                        </td>
                  </tr>
    </body>
    </html>
    Below is the relevant code snippets illustrates how I have attempted to retrieve the contents (value of  <a>):
                 import java.util.*;
                 import org.jdom.*;
                 import org.jdom.xpath.*;
                 import org.saxpath.*;
                 import org.ccil.cowan.tagsoup.Parser;
    ( 1 )       frInHtml = new FileReader("C:\\Tmp\\ABC.html");
    ( 2 )       brInHtml = new BufferedReader(frInHtml);
    ( 3 ) //    SAXBuilder saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
    ( 4 )       SAXBuilder saxBuilder = new SAXBuilder("org.ccil.cowan.tagsoup.Parser");
    ( 5 )       org.jdom.Document jdomDocument = saxbuilder.build(brInHtml);
    ( 6 )       XPath xpath =  XPath.newInstance("/ns:html/ns:body/ns:div[@id='container']/ns:div[@id='content']/ns:table[@class='sresults']/ns:tr/ns:td/ns:a");
    ( 7 )       xpath.addNamespace("ns", "http://www.w3.org/1999/xhtml");
    ( 8 )       java.util.List list = (java.util.List) (xpath.selectNodes(jdomDocument));
    ( 9 )       Iterator iterator = list.iterator();
    ( 10 )     while (iterator.hasNext())
    ( 11 )     {
    ( 12 )            Object object = iterator.next();
    ( 13 ) //         if (object instanceof Element)
    ( 14 ) //               System.out.println(((Element)object).getTextNormalize());
    ( 15 )             if (object instanceof Content)
    ( 16 )                   System.out.println(((Content)object).getValue());
    ….This program would work on the same document without the default namespace, hence, it would not be necessary to include “ns” prefix along in the XPath statements (line 6-7) either. Moreover, I was using “org.apache.xerces.parsers.SAXParser” to have successfully retrieve content of <a> from the same document without default namespace in the past.
    I would like to achieve the following objectives if possible:
    ( i ) Exclude DTD and namespace in order to simplifying the parsing process. How this could be done?
    ( ii ) If this is not possible, how to include it in XPath statements (line 6-7) so that the value of <a> is picked up correctly?
    ( iii ) Would changing from “org.apache.xerces.parsers.SAXParser” to “org.ccil.cowan.tagsoup.Parser” make any difference as far as using XPath is concerned?
    ( iv ) Failing to exlude DTD, how to change the lookup of a PUBLIC DTD to a local SYSTEM one and include a local DTD for reference?
    I am running JDK 1.6.0_06, Netbeans 6.1, JDOM 1.1, Saxon6-5-5, Tagsoup 1.2 on Windows XP platform.
    Any assistance would be appreciated.
    Thanks in advance,
    Jack

    Here's an example of using a custom EntityResolver with the standard DocumentBuilder provided by the JDK. The code may or may not be similar for the parsers that you're using.
    import java.io.IOException;
    import java.io.StringReader;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.xml.sax.EntityResolver;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    public class ParseExamples
        private final static String COMMON_XML
            = "<music>"
            +     "<artist name=\"Anderson, Laurie\">"
            +         "<album>Big Science</album>"
            +         "<album>Strange Angels</album>"
            +     "</artist>"
            +     "<artist name=\"Fine Young Cannibals\">"
            +         "<album>The Raw & The Cooked</album>"
            +     "</artist>"
            + "</music>";
        private final static String COMMON_DTD
            = "<!ELEMENT music (artist*)>"
            + "<!ELEMENT artist (album+)>"
            + "<!ELEMENT album (#PCDATA)>"
            + "<!ATTLIST artist name CDATA #REQUIRED>";
        public static void main(String[] argv)
        throws Exception
            // this version uses just a SYSTEM identifier - note that it gets turned
            // into a file: URL
            String xml = "<!DOCTYPE music SYSTEM \"bar\">"
                       + COMMON_XML;
            // this version uses both PUBLIC and SYSTEM identifiers; the SYSTEM ID
            // gets munged, the PUBLIC ID doesn't
    //        String xml = "<!DOCTYPE music PUBLIC \"foo\" \"bar\">"
    //                   + COMMON_XML;
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setValidating(true);
            DocumentBuilder db = dbf.newDocumentBuilder();
            db.setEntityResolver(new EntityResolver()
                public InputSource resolveEntity(String publicId, String systemId)
                    throws SAXException, IOException
                    System.out.println("publicId = " + publicId);
                    System.out.println("systemId = " + systemId);
                    return new InputSource(new StringReader(COMMON_DTD));
            Document dom = db.parse(new InputSource(new StringReader(xml)));
            System.out.println("root element name = " + dom.getDocumentElement().getNodeName());
    }

  • Parse XML document with LINQ TO XML

    Hello,
    I need to parse an XML Feed that looks like this:
    <ContentAPI xmlns="http://www.geneity.co.uk/genbet/ContentAPI" status="OK" timezone="UTC" msg_stamp="NzMzNzUzNzE6MTAyMTppdA==" version="1.0" request="get_sports">
    <Sport sport_code="FOOT" name="Calcio" has_events="Y" disporder="-2"/>
    <Sport sport_code="TENN" name="Tennis" has_events="Y" disporder="1"/>
    <Sport sport_code="BASK" name="Basket" has_events="Y" disporder="2"/>
    <Sport sport_code="VOLL" name="Pallavolo" has_events="Y" disporder="4"/>
    <Sport sport_code="HAND" name="Pallamano" has_events="N" disporder="5"/>
    <Sport sport_code="ICEH" name="Hockey su Ghiaccio" has_events="Y" disporder="6"/>
    <Sport sport_code="AMFO" name="Football Americano" has_events="N" disporder="7"/>
    <Sport sport_code="BASE" name="Baseball" has_events="Y" disporder="7"/>
    </ContentAPI>
    I want to use LINQ TO XML in order to read it into an object var.
    This is the code that i wrote but i doesn't work...
     XDocument xdoc = XDocument.Load(string.Format("myURL....."));
                var Sport = from feed in xdoc.Descendants("Sport")
                            select new
                                _sport_code = feed.Attribute("sport_code").Value,
                                _name = feed.Attribute("name").Value,
                                _has_events = feed.Attribute("has_events").Value,
                                _disporder = feed.Attribute("disporder").Value
                foreach (var s in Sport)
    The program doesn't run inside the foreach loop...
    for sure the problem is on the linq to xml query...
    Thanks for your help

    Hello, I'm back again...
    Now I have to parse a second file XML with some little differences on the track:
    <ContentAPI xmlns="http://www.geneity.co.uk/genbet/ContentAPI" status="OK" timezone="UTC" msg_stamp="NzM1NTQ5MDQ6MTAyMTppdA==" version="1.0" request="get_classes_for_sport">
    <Sport sport_code="FOOT" name="Calcio" disporder="-2">
    <SBClass sb_class_id="12432" name="Italia" has_events="Y" disporder="-9999"/>
    <SBClass sb_class_id="14603" name="Euro 2016" has_events="N" disporder="-1000"/>
    </Sport>
    </ContentAPI>
    The C# code to get the SBClass elements is this:
    XDocument xdoc = XDocument.Load(string.Format(url_Get_Region_By_Lang_Sport, pCodLang, pCodSport));
    var SportRegion = from _SportRegion in xdoc.Descendants(XName.Get("Sport", "http://www.geneity.co.uk/genbet/ContentAPI")).Descendants("SBClass")
    select new
    CodSport = _SportRegion.Attribute("sport_code").Value.Trim(),
    SbRegionId = _SportRegion.Attribute("name").Value.Trim(),
    Region = _SportRegion.Attribute("has_events").Value.Trim(),
    HasEvents = _SportRegion.Attribute("disporder").Value.Trim(),
    RegionOrder = _SportRegion.Attribute("disporder").Value.Trim()
    foreach(var sptr in SportRegion)
    The program doesn't step inside the foreach loop...
    Thanks again!

  • How to parse an XML document with oracle8i

    Has anyone a good link or an example how to decode and store an XML document into an oracle8i database.
    I' ve found only good things for oracle9i.
    Thank you
    Roger

    Here is an example of parsing xml taken fro Oracle8i 8.1.7 xdk.
    This one uses external OS files to pase, but could be easily converted to
    use CLOB or VARCHAR2 string for parsing XML documents.
    IF you wanted to use CLOB to store and manipulate xml documents you can use XMLParser and XMLDom
    packages along with the DBMS_LOB package to do that.
    -- This file demonstates a simple use of the parser and DOM API.
    -- The XML file that is given to the application is parsed and the
    -- elements and attributes in the document are printed.
    -- The use of setting the parser options is demonstrated.
    set serveroutput on;
    create or replace procedure domsample(dir varchar2, inpfile varchar2,
    errfile varchar2) is
    p xmlparser.parser;
    doc xmldom.DOMDocument;
    -- prints elements in a document
    procedure printElements(doc xmldom.DOMDocument) is
    nl xmldom.DOMNodeList;
    len number;
    n xmldom.DOMNode;
    begin
    -- get all elements
    nl := xmldom.getElementsByTagName(doc, '*');
    len := xmldom.getLength(nl);
    -- loop through elements
    for i in 0..len-1 loop
    n := xmldom.item(nl, i);
    dbms_output.put(xmldom.getNodeName(n) || ' ');
    end loop;
    dbms_output.put_line('');
    end printElements;
    -- prints the attributes of each element in a document
    procedure printElementAttributes(doc xmldom.DOMDocument) is
    nl xmldom.DOMNodeList;
    len1 number;
    len2 number;
    n xmldom.DOMNode;
    e xmldom.DOMElement;
    nnm xmldom.DOMNamedNodeMap;
    attrname varchar2(100);
    attrval varchar2(100);
    begin
    -- get all elements
    nl := xmldom.getElementsByTagName(doc, '*');
    len1 := xmldom.getLength(nl);
    -- loop through elements
    for j in 0..len1-1 loop
    n := xmldom.item(nl, j);
    e := xmldom.makeElement(n);
    dbms_output.put_line(xmldom.getTagName(e) || ':');
    -- get all attributes of element
    nnm := xmldom.getAttributes(n);
    if (xmldom.isNull(nnm) = FALSE) then
    len2 := xmldom.getLength(nnm);
    -- loop through attributes
    for i in 0..len2-1 loop
    n := xmldom.item(nnm, i);
    attrname := xmldom.getNodeName(n);
    attrval := xmldom.getNodeValue(n);
    dbms_output.put(' ' || attrname || ' = ' || attrval);
    end loop;
    dbms_output.put_line('');
    end if;
    end loop;
    end printElementAttributes;
    begin
    -- new parser
    p := xmlparser.newParser;
    -- set some characteristics
    xmlparser.setValidationMode(p, FALSE);
    xmlparser.setErrorLog(p, dir || '/' || errfile);
    xmlparser.setBaseDir(p, dir);
    -- parse input file
    xmlparser.parse(p, dir || '/' || inpfile);
    -- get document
    doc := xmlparser.getDocument(p);
    -- Print document elements
    dbms_output.put('The elements are: ');
    printElements(doc);
    -- Print document element attributes
    dbms_output.put_line('The attributes of each element are: ');
    printElementAttributes(doc);
    -- deal with exceptions
    exception
    when xmldom.INDEX_SIZE_ERR then
    raise_application_error(-20120, 'Index Size error');
    when xmldom.DOMSTRING_SIZE_ERR then
    raise_application_error(-20120, 'String Size error');
    when xmldom.HIERARCHY_REQUEST_ERR then
    raise_application_error(-20120, 'Hierarchy request error');
    when xmldom.WRONG_DOCUMENT_ERR then
    raise_application_error(-20120, 'Wrong doc error');
    when xmldom.INVALID_CHARACTER_ERR then
    raise_application_error(-20120, 'Invalid Char error');
    when xmldom.NO_DATA_ALLOWED_ERR then
    raise_application_error(-20120, 'Nod data allowed error');
    when xmldom.NO_MODIFICATION_ALLOWED_ERR then
    raise_application_error(-20120, 'No mod allowed error');
    when xmldom.NOT_FOUND_ERR then
    raise_application_error(-20120, 'Not found error');
    when xmldom.NOT_SUPPORTED_ERR then
    raise_application_error(-20120, 'Not supported error');
    when xmldom.INUSE_ATTRIBUTE_ERR then
    raise_application_error(-20120, 'In use attr error');
    end domsample;
    show errors;

  • Parse XML document which have xlink/xpointer inside

    dear friends,
    There are lots of topic talking about parse xml, validating xml with schema and so on, but no one or any book talking about parsing xml document which can parse document with link inside.
    According to Mr Meggison at http://www.megginson.com/Background/
    we can do it, but he is not expert with this thing.
    For example I have 3 XML document. My main XML document, let named it A.XML have XPointer inside and this element pointing to B.XML and C.XML using xpointer. how to parse A.XML and in the same time my SAX recognized this XPointer and parse also element inside B.XML and C.XML.
    I am really grateull for any helpful information from you.
    best regards

    I think you need to look for a SAX or DOM parser that undestands XPointers and knows how to follow them to additional content.
    I have used XSLT and specified external documents to it. It knows how to read a document and in effect make a nodeset which can be searched with the XPath capabilities of XSLT.
    It sounds like you wnat an <include file="xxx"/> capability and have the parser stop reading the current file, and start reading the second file.
    That works in Schemas, but I'm unaware of any way to do it with SAX or DOM in one pass.
    It would not be too hard to process the first file, say with DOM.
    After the Document is built, go find the <include> elements, read get the attribute needed, build a new Document and merge it into the original Document in place of the <include> element.
    Is this more what you want to do?
    Dave Patterson

  • Collect data from a dynamic XML file into multiple internal tables

    I need to convert the XML file into multiple internal tables. I tried many links and posts in SDN but still was facing difficulty in achieving this. Can some one tell me where I am going wrong.
    My XML file is of the following type.It is very complex and the dynamice.
    The following tags occur more than once in the XML file. The "I" and "L" tags and its child tags can occur ones or more than once for each XML file and it is not constant. i.e in one file they can occur 1 time and in another they can occur 100 times.
    "I" and "L" are child tags of <C>
    <I>
           <J>10</J>
             <K>EN</K>
      </I>
    <L>
             <J>20</J>
              <N>BB</N>
      </L>
    Tags <C> and <F> occur only ones for each XML file. <C> is the child tag of "A" and "F" is the child tag of <C>.
    I need to collect <D>, <E> in one internal table ITAB.
    I need to collect <G>, <H> in one internal table JTAB.
    I need to collect <J>, <K> in one internal table KTAB.
    I need to collect <J>, <N> in one internal table PTAB.
    Below is the complete XML file.
    ?xml version="1.0" encoding="iso-8859-1" ?>
    <A>
        <B/>
        <C>
           <D>RED</D>
           <E>999</E>
        <F>
           <G>TRACK</G>
           <H>PACK</H>
        </F>
        <I>
           <J>10</J>
           <K>EN</K>
        </I>
        <I>
           <J>20</J>
           <K>TN</K>
        </I>
        <I>
           <J>30</J>
           <K>KN</K>
        </I>
        <L>
           <J>10</J>
           <N>AA</N>
        </L>
        <L>
           <J>20</J>
           <N>BB</N>
        </L>
        <L>
           <J>30</J>
           <N>CC</N>
        </L>
        </C>
      </A>
    With the help of SDN I am able to gather the values of <D> <E> in one internal table.
    Now if I need to gather
    <G>, <H> in one internal table JTAB.
    <J>, <K> in one internal table KTAB.
    <J>, <N> in one internal table PTAB.
    I am unable to do. I am following  XSLT transformation method. If some one has some suggestions. Please help.
    Here is my ABAP program
    TYPE-POOLS abap.
    CONSTANTS gs_file TYPE string VALUE 'C:\TEMP\ABCD.xml'.
    * This is the structure for the data from the XML file
    TYPES: BEGIN OF ITAB,
             D(10) TYPE C,
             E(10) TYPE C,
           END OF ITAB.
    * Table for the XML content
    DATA: gt_itab       TYPE STANDARD TABLE OF char2048.
    * Table and work ares for the data from the XML file
    DATA: gt_ITAB     TYPE STANDARD TABLE OF ts_ITAB,
          gs_ITAB     TYPE ts_ITAB.
    * Result table that contains references
    * of the internal tables to be filled
    DATA: gt_result_xml TYPE abap_trans_resbind_tab,
          gs_result_xml TYPE abap_trans_resbind.
    * For error handling
    DATA: gs_rif_ex     TYPE REF TO cx_root,
          gs_var_text   TYPE string.
    * Get the XML file from your client
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename                = gs_file
      CHANGING
        data_tab                = gt_itab1
      EXCEPTIONS
        file_open_error         = 1
        file_read_error         = 2
        no_batch                = 3
        gui_refuse_filetransfer = 4
        invalid_type            = 5
        no_authority            = 6
        unknown_error           = 7
        bad_data_format         = 8
        header_not_allowed      = 9
        separator_not_allowed   = 10
        header_too_long         = 11
        unknown_dp_error        = 12
        access_denied           = 13
        dp_out_of_memory        = 14
        disk_full               = 15
        dp_timeout              = 16
        not_supported_by_gui    = 17
        error_no_gui            = 18
        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.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "IITAB".
    GET REFERENCE OF gt_shipment INTO gs_result_xml-value.
    gs_result_xml-name = 'IITAB'.
    APPEND gs_result_xml TO gt_result_xml.
    * Perform the XSLT stylesheet
    TRY.
        CALL TRANSFORMATION zxslt
        SOURCE XML gt_itab1
        RESULT (gt_result_xml).
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY.
    * Now let's see what we got from the file
    LOOP AT gt_ITAB INTO gs_ITAB.
      WRITE: / 'D:', gs_ITAB-D.
      WRITE: / 'E :', gs_ITAB-E.
    ENDLOOP.
    Transformation
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <IITAB>
              <xsl:apply-templates select="//C"/>
            </IITAB>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <item>
          <D>
            <xsl:value-of select="D"/>
          </D>
          <E>
            <xsl:value-of select="E"/>
          </E>
        </item>
      </xsl:template>
    </xsl:transform>
    Now the above pgm and transformation work well and I am able to extract data into the ITAB. Now what changes should I make in transformation and in pgm to collect
    <G>, <H> in one internal table JTAB.
    <J>, <K> in one internal table KTAB.
    <J>, <N> in one internal table PTAB.
    Please help..i am really tring hard to figure this out. I am found lot of threads addressing this issue but not my problem.
    Kindly help.
    Regards,
    VS

    Hi Rammohan,
    Thanks for the effort!
    But I don't need to use GUI upload because my functionality does not require to fetch data from presentation server.
    Moreover, the split command advised by you contains separate fields...f1, f2, f3... and I cannot use it because I have 164 fields.  I will have to split into 164 fields and assign the values back to 164 fields in the work area/header line.
    Moreover I have about 10 such work areas.  so the effort would be ten times the above effort! I want to avoid this! Please help!
    I would be very grateful if you could provide an alternative solution.
    Thanks once again,
    Best Regards,
    Vinod.V

  • How to parse XML Column and insert values into a table

    Hello,
    I am working on a simple project to demonstrate how to load and extract XML using SQL, I have already made a table that contains a column of XMLTYPE and loaded an XML file into it (code below)
    create or replace directory XMLSRC as 'C:\XMLSRC';
    drop table Inventory;
    create table Inventory(Inv XMLTYPE);
    INSERT INTO Inventory VALUES (XMLTYPE(bfilename('XMLSRC', 'Inventory.xml'),nls_charset_id('AL32UTF')));
    select * from Inventory;
    I now however need to get the XML data back out of that and loaded into a new table. Troubleshooting guides I have read online seem to only be dealing with parsing an external XML document and loading it into a table, and not what I need to do which is parse a column of XML data and load that into a table. The project trivial with simple tables containing only 3 columns.
    The table that needs to be loaded is as follows:
    create table InventoryOut(PartNumber Number(10), QTY Number(10), WhLocation varchar2(500));
    The XML document is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Inventory.xsd" generated="2012-04-09T17:36:30">
    <Inventory>
    <PartNumber>101</PartNumber>
    <QTY>12</QTY>
    <WhLocation>WA</WhLocation>
    </Inventory>
    </dataroot>
    Thank you for any help you can offer.

    First of all, thank you for your help!! Still stunned that you actually took the time to write out an eample using my tables/names/etc. Thank you!!
    Attached is the code, there seems to be an issue with referencing the other table, Inventory.Inv, I checked and that table and the Inv column are showing up in the database so I am not sure why it is having issues locating them, take a look at the code I wrote as well as the output (*I included the real version number for you this time :)
    EDIT: In your code right here:
    select xt.*
    3 from Inventory inve,
    4 XMLTable('/dataroot/Inventory'
    5 PASSING inve.Inv
    I think is where I am messing it up, perhaps not understanding fully what is going on, as you write "Inventory inve" and "inve.Inv" ---- Is inve a keyword that I am just not familiar with? I think this is where the issues lies in my code.
    END EDIT
    EDIT2: Well that looks like it was it, changed that to how you have it and it now works!!! Could you please explain what that few lines is doing, and what the xt.* and inve are doing? Thanks again!!!
    END EDIT2
    drop table InventoryOut;
    create table InventoryOut (PartNumber number(10), QTY number(10), WhLocation varchar2(500));
    insert into InventoryOut (PartNumber, QTY, WhLocation)
    select xt.*
    from Inventory Inv,
    XMLTable('/dataroot/Inventory'
    PASSING Inventory.Inv COLUMNS
    PartNumber number path 'PartNumber',
    QTY number path 'QTY',
    WhLocation path 'WhLocation')xt;
    select * from InventoryOut;
    select * from v$version;
    table INVENTORYOUT dropped.
    table INVENTORYOUT created.
    Error starting at line 4 in command:
    insert into InventoryOut (PartNumber, QTY, WhLocation)
    select xt.*
    from Inventory Inv,
    XMLTable('/dataroot/Inventory'
    PASSING Inventory.Inv COLUMNS
    PartNumber number path 'PartNumber',
    QTY number path 'QTY',
    WhLocation path 'WhLocation')xt
    Error at Command Line:8 Column:12
    Error report:
    SQL Error: ORA-00904: "INVENTORY"."INV": invalid identifier
    00904. 00000 - "%s: invalid identifier"
    *Cause:   
    *Action:
    PARTNUMBER QTY WHLOCATION
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    If this helps here is the code and output for the creation of the Inventory table itself:
    create or replace directory XMLSRC as 'C:\XMLSRC';
    drop table Inventory;
    create table Inventory(Inv XMLTYPE);
    INSERT INTO Inventory VALUES (XMLTYPE(bfilename('XMLSRC', 'Inventory.xml'),nls_charset_id('AL32UTF')));
    select * from Inventory;
    directory XMLSRC created.
    table INVENTORY dropped.
    table INVENTORY created.
    1 rows inserted.
    INV
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Inventory.xsd" generated="2012-04-09T17:36:30">
    <Inventory>
    <PartNumber>101</PartNumber>
    <QTY>12</QTY>
    <WhLocation>WA</WhLocation>
    </Inventory>
    </dataroot>
    Thanks again for your help so far! Hope we can get this working :)
    Edited by: 926502 on Apr 11, 2012 2:47 PM
    Edited by: 926502 on Apr 11, 2012 2:49 PM
    Edited by: 926502 on Apr 11, 2012 2:54 PM
    Edited by: 926502 on Apr 11, 2012 2:54 PM
    Updated issue to solved - Edited by: 926502 on Apr 11, 2012 2:55 PM

  • Parse XML document ,create table according to tags &  load data to  table

    Hi All!
    I have one of the most common problem, one faces when dealing with xml stuff and oracle.I get xml documents, with each file having different tags.I want to write a pl/sql procedure such that, the xml file is parsed, a table is created with the tag names becoming the column names and all the nodes' data get inserted into the table as rows.I am using oracle 10g.
    I read a thread at the following url:
    Parse XML and load into table
    But did not get much of it.
    Can anybody please tell me how to accomplish this.
    Thanking in advance.
    Regards,
    Deepika.

    Why do people have such an aversion to the XML DB forum for XML questions...
    See FAQ for XML DB forum here: XML DB FAQ
    Explains all about getting XML into tables in the database.

  • Convert 1 single microsoft word document with section breaks to multiple pdf files

    I am a windows 7 users. I have a single microsoft word document which contain 1500 pages. These 1500 pages are seperated by sections breaks in the microsoft word. I am trying to convert this word document to multiple pdf files seperated by the section breaks in the Microsoft word. How can I convert the single microsoft word document with section breaks to multiple seperate pdf files?

    Acrobat (Adobe PDF Printer and PDFMaker ) doesn't recognize the Section breaks.  It never has as far as I am aware.  The easiest thing to do is to manually break up a copy of the MS Word Document into the Sections you need and then create the PDFs from those MS Word documents.

  • Need to Load data in XML file into multiple Oracle tables

    Experts
    I want to load data that is stored at XML file into multiple Oracle table using plsql.
    I am novice in this area.Kindly explain in depth or step by step so that i can achive this.
    Thanks in advnace.

    Hi,
    extract your xml and then you can use insert all clause.
    here's very small example on 10.2.0.1.0
    SQL> create table table1(id number,val varchar2(10));
    Table created.
    SQL> create table table2(id number,val varchar2(10));
    Table created.
    SQL> insert all
      2  into table1 values(id,val)
      3  into table2 values(id2,val2)
      4  select extractValue(x.col,'/a/id1') id
      5        ,extractValue(x.col,'/a/value') val
      6        ,extractValue(x.col,'/a/value2') val2
      7        ,extractValue(x.col,'/a/id2') id2
      8  from (select xmltype('<a><id1>1</id1><value>a</value><id2>2</id2><value2>b</value2></a>') col from dual) x;
    2 rows created.
    SQL> select * from table1;
            ID VAL                                                                 
             1 a                                                                   
    SQL> select * from table2;
            ID VAL                                                                 
             2 b                                                                    Ants

  • Open XML document with proper layout

    Hi,
    I created my own XML form and I have problem when accessing the document within "KM Content".
    Indeed, when I click on the XML file generated by the XML Form it doesn't render it with the "Show" form but rather displays it as an usual XML document (with all its tags).
    Hint:
    I linked my iView to a custom CM repository. But, if I link my iView containing the XML Form to the out-of-the-box CM repository "/documents", it works fine.
    What should I do to make this work?
    Thanks in advance,
    Eric

    Hi Eric,
    in the Configuration under 'System Administration' -> 'System Configuration' -> 'Knowledge Management' -> 'Content Management' -> 'Repository Filters' you can find a filter named 'xmlforms_filter'. Some repositories are registered for this filter (in the standard e.g. documents). You should add your repositoriy here. After that the files in your repository should use the Show-form when being displayed.
    Hope this helps
    Karin

  • Please help; how to write XML document with JSP?

    I try to write XML document with JSP...
    But I got wrong results everytime.
    The result is not XML file displayed in the browser,
    but HTML file.
    I even tried to use HTML special code for <, >, "
    but still display as HTML file not XML file.
    How to do this?
    Thanks in advance. I put my codes below.
    Sincerely,
    Ted.
    ================
    Here is code for the JSP (called stk.jsp):
    <%@ page contentType="text/xml" %>
    <%@ page import="bean.Stock" %>
    <jsp:useBean id="portfolio" class="bean.Portfolio" />
    <% java.util.Iterator pfolio = portfolio.getPortfolio();
    Stock stock = null; %>
    <?xml version="1.0" encoding="UTF-8"?>
    <portfolio>
    <% while (pfolio.hasNext())
    stock = (Stock) pfolio.next(); %>
    <stock>
    <symbol>
    <%=stock.getSymbol() %>
    </symbol>
    <name><%=stock.getName() %> </name>
    <price><%=stock.getPrice() %> </price>
    </stock>
    <% } %>
    </portfolio>
    =================
    Here is the code for bean.Stock:
    package bean;
    public class Stock implements java.io.Serializable
    String symbol, name;
    float price;
    public Stock(String symbol, String name, float price)
    this.symbol = symbol;
    this.name = name;
    this.price = price;
    public String getSymbol()
    return symbol;
    public String getName()
    return name;
    public float getPrice()
    return price;
    ===============
    And here is bean.Portfolio:
    package bean;
    import java.util.Iterator;
    import java.util.Vector;
    public class Portfolio implements java.io.Serializable
    private Vector portfolio = new Vector();
    public Portfolio()
    portfolio.addElement(new Stock("SUNW", "Sun Microsystem", 34.5f));
    portfolio.addElement(new Stock("HWP", "Hewlett Packard", 15.15f));
    portfolio.addElement(new Stock("AMCC", "Applied Micro Circuit Corp.", 101.35f));
    public Iterator getPortfolio()
    return portfolio.iterator();
    }

    Hi
    I'm not sure whta your query is but I tested your code as it is has been pasted and it seems to work fine. There is an XML output that I'm getting.
    Keep me posted.
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun microsystems
    http://www.sun.com/developers/support

  • Split a string into multiple internal tables

    Hi all,
    I need to split a string based internal table into multiple internal tables based on some sub strings in that string based internal table...
    High priority help me out...
    eg...
    a | jhkhjk | kljdskj |lkjdlj |
    b | kjhdkjh | kldjkj |
    c | jndojkok |
    d |
    this data which is in the application server file is brought into a internal table as a text. Now i need to send 'a' to one internal table, 'b' to one internal table, so on... help me
    <Priority downgraded>
    Edited by: Suhas Saha on Oct 12, 2011 12:24 PM

    Hi pradeep,
    eg...
    a | jhkhjk | kljdskj |lkjdlj |
    b | kjhdkjh | kldjkj |
    c | jndojkok |
    d |
    As per your statement "Now i need to send 'a' to one internal table, 'b' to one internal table"
    Do you want only a to one internal table and b to one internal table
    OR
    Do you want the whole row of the internal table i mean
    a | jhkhjk | kljdskj |lkjdlj | to 1 internal table
    Having the case of an internal table which is of type string,
    1) Loop through the internal table.    LOOP AT lt_tab INTO lwa_tab.
    2) Ge the work area contents and get the first char wa_tab-string+0(1)
    3)   FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.
      w_tabname = p_table.
      CREATE DATA w_dref TYPE TABLE OF (w_tabname).
      ASSIGN w_dref->* TO <t_itab>.
    Follow the link
    http://www.sap-img.com/ab030.htm
    http://www.sapdev.co.uk/tips/dynamic-structure.htm
    and then based on the sy-tabix values you will get that many number of internal table
           <FS> = wa_tab-string+0(1)
          append  <FS>
    OR
    USE SPLIT statement at the relevant seperator
    revert for further clarification
    Thanks
    Sri
    Edited by: SRIKANTH P on Oct 12, 2011 12:36 PM

Maybe you are looking for

  • Blank screen after logo at startup

    I have an HP laptop (G72-B66US) running on 64-bit Windows 7 Home Premium. Since I bought it over a year ago, it had been running fine, until one day it failed to boot up to Windows, leaving only a blinking cursor in the upper-right corner of an other

  • Missing method.

    import acm.program.*; import acm.graphics.*; public class Image extends GraphicsProgram {      public void run() {           GImage image = new GImage("Image.jpg");           int[][] array = image.getPixelArray(); }I'm trying to compile this code but

  • Not applied Patch 5117016 after 10.2.0.2 patch set.

    Hi , database has been upgraded to 10gR2 on solaris 64bit. Patch 5117016 has not been applied after 10.2.0.2 patch set applied. but after that DST patches were applied. here my concern is should i rollback DST patches in order to apply Patch 5117016.

  • Error: "Unable to create a shortcut for MyApp" on Windows 2008

    When I try to install my JAVA app on windows 2008 via Java Web Start, it pop up a error message "Unable to create a shortcut for MyApp". The app can startup and work correctly after clicking "ok" on error message. BUT, there is no shortcut created on

  • Workflow get_property

    If I want to fetch the data for Goods Issue against a delivery and want to display it in a workflow which is triggered when the Delivery ( via vl02 ) has goods issue posted on it ..!! Is this a feasible solution :: I extend the LIKP object to ZLIKP a