XML processing

I was able to get the input stream of the query string to the application, I work with.  For example, if you called the application with this:

FSCalc.html? xml = <? XML version = "1.0" encoding = "UTF-8"? > < FSParm > < HouseholdSize > 6 < / HouseholdSize > < GrossMonthlyEarnedIncome > 2000 < / GrossMonthlyEar nedIncome >
< / FSParm >

the contents of the string of the entry is:

inputString = <? XML version = "1.0" encoding = "UTF-8"? > < FSParm > < HouseholdSize > 6 < / HouseholdSize > < GrossMonthlyEarnedIncome > 2000 < / GrossMonthlyEar nedIncome > < / FSParm >

Then I take that string and put it in an XMLList.

private var parseXML:XMLList = inputString;

What I need to know now is how to get the key pair name / value in an actionscript.  In pseudo-code, it would look like this:

for each {(heading parseXML)
If (key = "xyz") {}

setXYZ (value)}

If (key = {"abc"

setABC (value)}
}

How can I get there?

I do not trust the automatic conversion into AS3 (it works reliably, I can't remember the rules).

So I think that you started with a full url string and who found a way to find a substring that was to the right side of the = xml.

If inputString a string, which must be converted into XML (not XMLList) via

Var fsParm:XML = new XML (inputString);

And its parts will then be available as:

fsParm.HouseholdSize

fsParm.GrossMontlyEarnedIncome

fsParm.HouseholdSize is an XMLList, so to get a number you need to do

var householdSize:int = int (fsParm.HouseholdSize [0] m:System.NET.SocketAddress.ToString ())

or if you know that there is only one entry in the list,

var householdSize:int = int (fsParm.HouseholdSize.toString ())

Alex Harui

Flex SDK Developer

Adobe Systems Inc..

Blog: http://blogs.adobe.com/aharui

Tags: Flex

Similar Questions

  • File XML processing in oracle

    Hello

    I have the following provision in the xml:

    < csg >
    < ecrminput id = '000000001' >
    < xml id = "001" title = "CustomerId" > blah blah blah < / xml >
    < xml id = "002" title = "ContactId" > blah blah blah < / xml >
    < xml id = '003' title = "CustomerNo" > blah blah blah0 < / xml >
    < xml id = "500" title = "Attribute" > blah blah blah < / xml >
    < xml id = "500" title = "Attribute" > blah blah blah < / xml >
    < xml id = "1027" title = "Booking Code" > blah blah blah < / xml >
    < xml id = "1028" title = "Payment Reference" > blah blah blah < / xml >
    < xml id = "1029" title = 'Number of buyer' > blah blah blah < / xml >
    < / ecrminput >
    < ecrminput id = "000000002" >
    < xml id = "001" title = "CustomerId" > blah blah blah < / xml >
    < xml id = "002" title = "ContactId" > blah blah blah < / xml >
    < xml id = "500" title = "Attribute" > blah blah blah < / xml >
    < xml id = "500" title = "Attribute" > blah blah blah < / xml >
    < xml id = "1027" title = "Booking Code" > blah blah blah < / xml >
    < xml id = "1028" title = "Payment Reference" > blah blah blah < / xml >
    < xml id = "1029" title = 'Number of buyer' > blah blah blah < / xml >
    < xml id = "1016" title = "Call-ID" > blah blah blah < / xml >
    < / ecrminput >
    < / csg >

    and I need to find the best way to load this in oracle and extract the node information. The solution I came up with that is to load the xml document into a table with the field of clob, then extracted using a similar like syntax type below:

    SELECT a.*,
    DBMS_LOB. InStr (XmlType.getclobval (Attribute),' > AUGUST < ')
    from (SELECT extractvalue (value (xml_sequence) "," ecrminput/xml[@title="CustomerId"]') CustomerId,)
    Extract (value (xml_sequence) "," ecrminput/xml[@title="Attribute"]'), attribute
    OF xml_lfc donnees_xml,.
    table (XMLSequence (Extract (XmlType (xml_DATA), ' / csg/ecrminput "))) xml_sequence);

    This works when the file is small, but I need load and process a file more 6 000 000 records as part of the initial charge.

    Any ideas? I tried going down the road of xmlschema, but the xml file can have different fields of each record and the < xml = "500" title = "Attribute" id > tag may be repeated several times for each record also.

    Return of 1,000 records using the syntax above takes about 60 seconds. I use this on oracle 10g so am not able to use the index for xmltypes stuff.

    See you soon.

    Published by: user7989950 on July 7, 2010 23:48

    Published by: user7989950 on July 7, 2010 23:53

    Here's a starter DBMS_XMLDOM for you to have a game with...

    declare
      v_xml XMLTYPE := XMLTYPE('
    
    blah blah blah
    blah blah blah
    blah blah blah0
    blah blah blah
    blah blah blah
    blah blah blah
    blah blah blah
    blah blah blah
    
    
    blah blah blah
    blah blah blah
    blah blah blah
    blah blah blah
    blah blah blah
    blah blah blah
    blah blah blah
    blah blah blah
    
    ');
      v_xsdoc     DBMS_XMLDOM.DOMDocument;
      v_dn        DBMS_XMLDOM.DOMNode;
    
      PROCEDURE processnode; -- forward declaration
    
      PROCEDURE processattributes IS
        nm                      DBMS_XMLDOM.DOMNamedNodeMap;
        attr                    DBMS_XMLDOM.DOMAttr;
        attnode                 DBMS_XMLDOM.DOMNode;
        attname                 VARCHAR2(50);
        attval                  VARCHAR2(250);
      BEGIN
        nm := DBMS_XMLDOM.GetAttributes(v_dn);
        FOR i IN 0..DBMS_XMLDOM.GetLength(nm)-1
        LOOP
          attnode := DBMS_XMLDOM.Item(nm, i);
          attr := DBMS_XMLDOM.MakeAttr(attnode);
          attname := DBMS_XMLDOM.GetName(attr);
          attval := DBMS_XMLDOM.GetValue(attr);
          dbms_output.put_line('Attribute: '||attname||' Value: '||attval);
        END LOOP;
      END;
    
      PROCEDURE parse_node_element IS
        eltype        VARCHAR2(100);
      BEGIN
        eltype := DBMS_XMLDOM.GetTagName(DBMS_XMLDOM.MakeElement(v_dn));
        dbms_output.put_line('Tag: '||eltype);
        processattributes;
        processnode;
      END;
    
      PROCEDURE parse_node_text IS
      BEGIN
        DBMS_OUTPUT.PUT_LINE('Text: '||DBMS_XMLDOM.GetNodeValue(v_dn));
      END;
      PROCEDURE processnode IS
        dnl      DBMS_XMLDOM.DOMNodeList;
        nt       PLS_INTEGER;
      BEGIN
        dnl := DBMS_XMLDOM.GetChildNodes(v_dn);
        dbms_output.put_line('Child Nodes Found: '||DBMS_XMLDOM.GetLength(dnl));
        IF NOT DBMS_XMLDOM.IsNull(dnl) THEN
          FOR i IN 0 .. (DBMS_XMLDOM.GetLength(dnl) - 1)
          LOOP
            v_dn := DBMS_XMLDOM.Item(dnl, i);
            nt := DBMS_XMLDOM.GetNodeType(v_dn);
            CASE
              WHEN nt = DBMS_XMLDOM.ELEMENT_NODE THEN
                parse_node_element;
              WHEN nt IN (DBMS_XMLDOM.TEXT_NODE) THEN
                parse_node_text();
            ELSE
              NULL; -- Unhandled node type;
            END CASE;
          END LOOP;
        END IF;
      END;
    BEGIN
      v_xsdoc := DBMS_XMLDOM.NewDOMDocument(v_xml);
      v_dn := DBMS_XMLDOM.GetFirstChild(DBMS_XMLDOM.MakeNode(v_xsdoc)); -- 
      processnode;
    END;
    

    Currently, who's out like that...

    Child Nodes Found: 2
    Tag: ecrminput
    Attribute: id Value: 000000001
    Child Nodes Found: 8
    Tag: xml
    Attribute: id Value: 001
    Attribute: title Value: CustomerId
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 002
    Attribute: title Value: ContactId
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 003
    Attribute: title Value: CustomerNo
    Child Nodes Found: 1
    Text: blah blah blah0
    Tag: xml
    Attribute: id Value: 500
    Attribute: title Value: Attribute
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 500
    Attribute: title Value: Attribute
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 1027
    Attribute: title Value: Reservation Code
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 1028
    Attribute: title Value: Payment Reference
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 1029
    Attribute: title Value: Purchaser Customer Number
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: ecrminput
    Attribute: id Value: 000000002
    Child Nodes Found: 8
    Tag: xml
    Attribute: id Value: 001
    Attribute: title Value: CustomerId
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 002
    Attribute: title Value: ContactId
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 500
    Attribute: title Value: Attribute
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 500
    Attribute: title Value: Attribute
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 1027
    Attribute: title Value: Reservation Code
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 1028
    Attribute: title Value: Payment Reference
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 1029
    Attribute: title Value: Purchaser Customer Number
    Child Nodes Found: 1
    Text: blah blah blah
    Tag: xml
    Attribute: id Value: 1016
    Attribute: title Value: Call ID
    Child Nodes Found: 1
    Text: blah blah blah
    
    PL/SQL procedure successfully completed.
    
    SQL>
    
  • PHP variable and xml processing

    Hello
    I have a problem that is driving me crazy! I have a php file that creates an xml from a sql query string. The problem is that I need to use a variable from a swf file to create the query. All this should happen when I click a button on the swf page. The xml file is created no problem, but the variable is not used. I am able to use these POST variables in other php files. As you can see it the php file is called two times in the script action. What is the problem. The line: xmlData.load ("get_max_sess.php"); is very good. I stuck one on one-loadVariablesNum ('get_max_sess.php', 0, 'POST'); After the fact and that do not work. is there a confilct by calling the same file twice? The function sendAndLoad isn't an option? My php file is included below.

    Thank you very much. I really hope you can help me!

    ****************************************************ACTION SCRIPT**********************************

    {call_btn.onRelease = Function ()}

    function processXMLData (success)
    {loadVariablesNum ('get_max_sess.php', 0, 'POST');}
    If (success)
    {


    var rootNode = this.firstChild;

    var contentNode = findNode (rootNode, "guit_vol");
    guitVol = getValue (contentNode);

    var authorNode = findNode (rootNode, "guit_pan");
    guitPan = getValue (authorNode);

    var contentNode = findNode (rootNode, "guit_vis");
    visGuit = getValue (contentNode);

    _root.guitVis.gotoAndStop (visGuit);

    affect of musician objects xml information

    _root.guitObj.drag._y = guitVol;
    _root.guitObj.drag._x = guitPan * 2;


    }

    on the other

    {
    Content = "today's news is not ';
    }

    }

    function getValue (node)
    {
    If (node & & node.firstChild)
    Return node.firstChild.nodeValue;
    Return ' ';
    }

    function findNode (node, nodeName)
    {
    If (node.nodeName is nodeName)
    return the node;
    for (var i = 0; node.childNodes & & I < node.childNodes.length; i ++)
    {
    var foundNode = findNode (node.childNodes , nodeName);
    If (foundNode! = null)
    Return foundNode;
    }
    Returns a null value.
    }

    var xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad=processXMLData;//when xml data loads that runs the function above
    xmlData.load ("get_max_sess.php"); load the XML from this location

    Stop();
    }

    ****************************************************PHP FILE**********************************



    <? PHP

    user_id $= $_POST ['user_id'];

    database query for records
    $connection = mysql_connect ('localhost', 'm27849_martin', 'Geraldine1') or die ("cannot
    to connect! ») ;
    mysql_select_db('m27849_liveroom') or die ("cannot select database!");
    $query ="
    SELECT a.guit_sess_id, a.guit_vol, a.guit_pan, a.guit_vis, b.bass_sess_id, b.bass_vol, b.bass_pan, b.bass_vis, c.drum_sess_id, c.drum_vol, c.drum_pan, c.drum_vis
    OF guit_info a, bass_info b, drum_info c, users_sessions d
    WHERE d.session_id = (SELECT max (a.session_id) FROM users_sessions a WHERE a.user_id = ' $user_id ')
    AND a.guit_sess_id = d.session_id
    AND b.bass_sess_id = a.guit_sess_id
    AND c.drum_sess_id = b.bass_sess_id
    ";
    (SELECT userid from auth WHERE username = "martin")
    Insert here a variable to call the relevant line (session)
    $result = mysql_query ($query) or die ("' error in query: $query.". ")
    mysql_error());

    $doc = new DomDocument ('1.0');
    The first item we create in the XML document is known as the root element. Each must have 1 and 1 single element XML document root. In this example I have called 'root', but you can use any name you like (such as the name of the PHP script that runs). Note that you need to create the item and insert it in the document with two functions.
    create the root node


    While ($row = {mysql_fetch_assoc ($result))}
    $user = $doc-> createElement('session');
    $user = $doc-> appendChild ($user);

    foreach ($row as $fieldname = > $fieldvalue) {}
    Note that here I create a new item for the field and then insert it as a child of the database line current, such as identified in $occ.
    $child = $doc-> createElement ($fieldname);
    $child = $user-> appendChild ($child);

    Now, I have to add the value of the field as a text node, then inserted as a child of the current node of the field, as identified in $child.
    $value = $doc-> createTextNode ($fieldvalue);
    $value = $child-> appendChild ($value);
    These loops are not completed as long as they treated each column of each row that has been retrieved from the database.
    } / / foreach
    } / / While



    echo $doc-> saveXML();
    echo $doc-> saveXML ($child);

    mysql_close ($Connection);


    from: http://www.tonymarston.net/php-mysql/dom.html
    ? >

    Hello
    I broke down after a lot of back and forth and the-ING! Apparently, you CAN send a variable and then load the xml. Thanks a lot for your advice and your interests. I am very grateful.

    Marty group

    Discover my code below...

    user_id = 147;
    {submit_button.onRelease = Function ()}

    function processXMLData (success)
    {
    If (Success)
    {_root.status_id = "Success"

    var rootNode = this.firstChild;

    var contentNode = findNode (rootNode, "guit_vol");
    guitVol = getValue (contentNode);

    var authorNode = findNode (rootNode, "guit_pan");
    guitPan = getValue (authorNode);

    var contentNode = findNode (rootNode, "guit_vis");
    visGuit = getValue (contentNode);

    Batch = visGuit;

    etc...

    }

    on the other

    {
    Content = "today's news is not ';
    }

    }

    function getValue (node)
    {
    If (node & node.firstChild)
    Return node.firstChild.nodeValue;
    Return ' ';
    }

    function findNode (node, nodeName)
    {
    If (node.nodeName is nodeName)
    return the node;
    for (var i = 0; node.childNodes & I)
    {
    var foundNode = findNode (node.childNodes , nodeName);
    If (foundNode! = null)
    Return foundNode;
    }
    Returns a null value.
    }

    var xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = processXMLData;
    xmlData.load ("get_max_sess.php");
    var id: LoadVars = new LoadVars();
    ID.user_id = user_id;
    ID. UserName = _root.username;
    id.sendAndLoad ("get_max_sess.php", xmlData, "POST");
    }

    Basic idea of http://www.permadi.com/tutorial/flashXMLNewsExample/index.html - thanks!

  • LSX-00204 error when validating an XML file on a registered scheme

    Hello

    When I want to validate an XML file against the registered scheme I get the following error:

    ORA-31154: Ungultiges XML-Dokument ORA-19202: Fehler bei XML-Verarbeitung LSX-00204: additional data am Ende von komplexem aufgetreten element

    Here is the schema snippet:

    <! - the address of a given party in fixed or free form possibly the two forms - >

    < xsd: complexType name = 'Subscription_type' xdb:SQLType = "ITX_FTC_ADDRESS_TYPE_O" xdb:maintainDOM = "false" >

    < xsd: annotation >

    < xsd: documentation XML: lang = "fr" >

    The user has the possibility to enter the data concerning the address of a party, either in a single long field or to distribute data on items up to eight or even to use both formats. If the user chooses the option to enter the necessary data in separate elements, the container for this item will be "AddressFix". If the user chooses the option to enter the necessary data in a way less structured in "AddressFree" all the available coordinates must be submitted as a string of bytes, empty or ' / ' (slash) or trolley line break return used as a delimiter between the parts of the address. PLEASE NOTE that the country code address is outside these two elements. The use of the fixed form is recommended as a general rule, to allow an easy match. However, the use of the free form is recommended if the sending State can surely identify and distinguish the different parts of the address. The user wants to use both formats for example if in addition which separates the logical part of the address he also wants to show a decent breakdown in print-lines of delimiters in the form of free text. In this case, "AddressFix" must precede the 'AddressFree '.

    < / xsd: documentation >

    < / xsd: annotation >

    < xsd: SEQUENCE >

    < xsd: element name = "PostalCode" type = "iso: CountryCode_Type ' xdb:SQLName = 'COUNTRY_CODE' / >

    < xsd: Choice >

    < xsd: element name = "AddressFree" type = "xsd: String" xdb:SQLName = "ADDRESS_FREE" / >

    < xsd: SEQUENCE >

    < xsd: element name = "AddressFix" type = "sfa:AddressFix_Type" xdb:SQLName = "ADDRESS_FIX" / >

    < xsd: element name = "AddressFree" type = "xsd: String" minOccurs = "0" xdb:SQLName = "ADDRESS_FREE" / >

    < / xsd: SEQUENCE >

    < / xsd: Choice >

    < / xsd: SEQUENCE >

    < xsd: attribute name = "legalAddressType" type = "stf:OECDLegalAddressType_EnumType" use = "optional" / >

    < / xsd: complexType >

    The problem occurs only when the second choice (when: "AddressFix" and "AddressFree") was given in the XML file. When only the first choice ("AddressFree") gave then the validation against schema very well recorded works.

    I think that the problem is based on the generation of all objects in the database of dbms_xmlschema.registerSchema.

    BTW, how is possible to get a more meaningful error message because the error I get is very common, and I can't imagine in which the problem occurs.

    Thanks in advance.

    Best regards

    Martin

    I have reproduced the issue on 11.2.0.4 using the Schémas XML FATCA.

    declare
    
      l_schemas  sys.odcivarchar2list :=
                sys.odcivarchar2list('isofatcatypes_v1.0.xsd',
                                     'oecdtypes_v4.1.xsd',
                                     'stffatcatypes_v1.1.xsd',
                                     'FatcaXML_v1.1.xsd');
    begin
    
      for i in 1 .. l_schemas.count loop
    
        dbms_xmlschema.registerSchema(
          schemaURL       => l_schemas(i)
        , schemaDoc       => xmltype(bfilename('FATCA_DIR', l_schemas(i)), nls_charset_id('AL32UTF8'))
        , genTypes        => true
        , genTables       => false
        , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
        );
    
      end loop;
    
    end;
    /
    

    As in schema extract that you provided, I've annotated subscription_type complexType with xdb:maintainDOM = "false".

    Then tried to validate the example NilFIReport.xml file after adding an AddressFix element:

    JP

    String

    String

    SQL> declare
      2    doc  xmltype := xmltype(bfilename('FATCA_DIR', 'NilFIReport.xml'), nls_charset_id('AL32UTF8'));
      3  begin
      4    doc.schemaValidate();
      5  end;
      6  /
    declare
    *
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00204: extra data at end of complex element
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at line 4
    

    Now, let's abandon patterns, remove the xdb:maintainDOM annotation (or set to true, the default) and re - register:

    SQL> declare
      2    doc  xmltype := xmltype(bfilename('FATCA_DIR', 'NilFIReport.xml'), nls_charset_id('AL32UTF8'));
      3  begin
      4    doc.schemaValidate();
      5  end;
      6  /
    
    PL/SQL procedure successfully completed.
    

    Works.

    Conclusion: set maintainDOM to false when using XS: Choice.

    There is probably a mess when the positional descriptor (attribute "$SYS_XDBPD") is missing in this case.

  • Direct manipulation of XMLTYPE with SQL / (XML)

    I have temporary XMLTYPEs in my PL/SQL code. I want to handle these temporary XMLs with SQL, as the UPDATE and UPDATEXML.

    I'm new to processing XML and what I find in the documentation is first to make a table, put the XML file into it, and then I can handle with SQL like this (pseudo-code):

    CREATE TABLE xml_table OF XMLTYPE;
    INSERT INTO xml_table values (l_xml);
    UPDATE xml_table SET = UPDATEXML(…) WHERE …;
    
    

    But I don't want to do (temporary) tables to organize my XML files. I just want to treat them directly as this (pseudo-code):

    UPDATE l_xml SET = UPDATEXML(…) WHERE ….;

    So my questions are:

    1. can even direct manipulation of XMLTYPE with SQL and
    2. What is the preferred method for XML processing (attribute values) if my functions are of the form "function(xml XMLTYPE) RETURN XMLTYPE"; (e.g. my überhaupt approach is sane?)

    Handling of XML with SQL using DOUBLE is SQL sentence.

    Of course, it is.

    But I understand what you mean.

    When I talked about manipulating XML with SQL I thought about something like this (pseudocode)

    Yes, what you had in mind is exactly that, pseudocode. It does not work like that.

    XQuery Update Facility is supported since 12cR1

    11.2.0.3 actually, but it does not matter in your case.

    Given your version, DOM is probably the best way, or a PL/SQL loop:

    SQL > declare

    2

    3 entry xmltype: = xmltype ('ABCXYZ');

    4

    5. start

    6

    7 r in)

    8 select id, val | '-' || TO_CHAR (ID) as new_val

    xmltable 9 ('/ / the root element' entrance passage)

    path number 10 columns id '@id '.

    11 road of varchar2 (30) val '.'

    12           )

    13)

    14 loop

    15 select updatexml (entry, "/ root/item[@id="' | r.id |) ([""] / text()', r.new_val)

    16 comments

    17 double;

    18 end of loop;

    19

    20 dbms_output.put_line (input.getclobval);

    21

    22 end;

    23.

    ABC-1 XYZ-2

    PL/SQL procedure successfully completed

    I spoke earlier of the different techniques:

    How to: Update the XML nodes with values from the same document. Odie Oracle blog

  • Resources to learn the XML DB

    Hello guys,.

    For some time now, I have tried to learn XML DB features, but has never managed to grasp the concepts.

    Currently, I'm reading and trying to understand 10.2 DB XML but still unable to understand. I understand that I am completely confused, probably a lot more thought into the internal understanding of XML processing. Therefore, I was wondering if someone could help me with basic tutorials/articles that will help me to start with a begineer level and I can then go to the Documentation to better understand.


    Pointers are appreciated!


    Thank you
    Laureline.

    Also have a look at (unless of course the XMLDB Developer Guide):

    -The howto and examples on http://www.liberidu.com/blog/index/ (www.xmldb.nl)
    -Nice examples of Odie on http://odieweblog.wordpress.com/
    -Examples of A_Non on http://anononxml.blogspot.nl/

    Start with suggestions from Mark but. The Oracle for example environmental virtualbox can be enlightening.

  • Validating XML against XSD LSX-00249: invalid date or time (ISODateTime)

    Hello again...
    After having problems with my schema validation, I have a new...
    Now the problem is with ISODateTime...

    Here's some code from XSD:
    The problem in the process of validation with 'CreDtTm '...
    - <xs:complexType name="GroupHeader39">
    - <xs:sequence>
      <xs:element name="MsgId" type="Max35Text" /> 
      <xs:element name="CreDtTm" type="ISODateTime" /> 
      <xs:element name="Authstn" type="Authorisation1Choice" minOccurs="0" maxOccurs="2" /> 
      <xs:element name="NbOfTxs" type="Max15NumericText" /> 
      <xs:element name="CtrlSum" type="DecimalNumber" minOccurs="0" /> 
      <xs:element name="InitgPty" type="PartyIdentification32" /> 
      <xs:element name="FwdgAgt" type="BranchAndFinancialInstitutionIdentification4" minOccurs="0" /> 
      </xs:sequence>
      </xs:complexType>
    Here's my pice of XML
    <GrpHdr>
             <MsgId>400340878</MsgId>
             <CreDtTm>2012-11-15T11:06:44</CreDtTm>
             <NbOfTxs>201</NbOfTxs>
             <CtrlSum>5790.82</CtrlSum>
    After validation, I get this error:

    ORA-31154: invalid XML document
    ORA-19202: an error has occurred in the processing of XML
    LSX-00249: invalid date or time "2012-11 - 15 T 11: 06:44, 000000.


    Database:
    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production


    Thanks for any help

    Published by: peterv6i.blogspot.com on November 16, 2012 13:49

    Very similar problem discussed in this thread: {: identifier of the thread = 2420160}

    SQL> declare
      2    l_xml xmltype;
      3  begin
      4    l_xml := xmltype(bfilename('TEST_DIR','sepa.xml'), nls_charset_id('AL32UTF8'));
      5    l_xml.schemaValidate();
      6  end;
      7  /
    declare
    *
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00249: invalid date or time "2009-09-04T14:25:00,000000"
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at line 5
    
    SQL> alter session set nls_numeric_characters = ".,";
    
    Session altered.
    
    SQL> declare
      2    l_xml xmltype;
      3  begin
      4    l_xml := xmltype(bfilename('TEST_DIR','sepa.xml'), nls_charset_id('AL32UTF8'));
      5    l_xml.schemaValidate();
      6  end;
      7  /
    
    PL/SQL procedure successfully completed.
    
  • Querying XML attributes

    I have Oracle 10 g. In a table with a single record, there is an a clob with the following XML.

    <>container
    < param name = "paramA" value = "a." / >
    < param name = "paramB" value = "b." / >
    ...
    < / container >

    How can I enumerate paramA, paramB upstairs?

    Your request failed to display the error message you received, which should have been

    select x.paramName, x.paramValue
      from test_xml t
         , xmltable('/container/param'
                    passing xmltype(t.xmlcontent)
                    columns
                    paramName varchar2(30) path '@type'
                  , paramValue varchar2(80) path '@value') x
    
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00234: namespace prefix "xsi" is not declared
    Error at line 2
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1
    

    Taking, you ask yourself how to declare the namespace and some research would turn out finally that
    (1) your XML code is not valid because it does not have a namespace prefix defined for xsi
    (2) you must use with XMLNamespaces in the XMLTable service [url http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions228.htm#SQLRF06232]

    Put them together, and assuming that you mean the standard URI for prefix xsi, your sample XML should look like

    
         
         
    
    

    and the query would resemble

    select x.paramName, x.paramValue
      from test_xml t
         , xmltable(XMLNamespaces('http://www.w3.org/2001/XMLSchema-instance' as "xsi"),
                   '/container/param'
                    passing xmltype(t.xmlcontent)
                    columns
                    paramName varchar2(30) path '@xsi:type'
                  , paramValue varchar2(80) path '@value') x;
    
  • XML Gateway Inbound invoice LPX-00103: structure of a document does not match DTD

    Hello

    We see the following error in the Transaction monitor while receiving an incoming invoice of NSOS to Oracle. Can someone advise please know how this problem can be solved?

    ORA-31011: failure ORA-19202 XML parsing: error in XML processing LPX-00103: WARNING: structure of a document does not match DTD error line 1

    Used mapping is '171_process_invoice_002 '.

    Thank you.

    Hello
    The implementation of accounts payable guide suggests the map to serve as AP_INVOICE_INBOUND. But failure with javaNullpointerException for this patch 9644960 must be applied.

    http://docs.Oracle.com/CD/E18727_01/doc.121/e12795/T434884T434889.htm#I_rx2DX78ML

    Thank you
    Adkins

  • Beginner XML questions

    Hello

    First post on the forums in a long time and the first here altogether. I hope it's okay jump in.

    I have a little experience of FM not structured for several years ago and use Ventura (13 years) to my company's books (long directories - 3 000 + / volume). I made some scripts in Ventura have so little experience in programming.

    We are looking to switch to XML rather than text files tagged Ventura can import because of its lack of support, problems, perhaps due to Win7, and the effort required to maintain files to import. I downloaded the trial FM 11 and have been experimenting a bit with XML back and forth and also import what we already have in XML. If a bit I'm sure very simple questions. and thanks in advance:

    I was going through the tutorials from Adobe and everything I can find online. It seem not to be well reviewed books on Amazon that deal with structured FM 9-11. Some that look promising for XML are about 10 years old - I think not that our needs are sharp, so should I get something this old, or stay with most recent although we complain? Any recommendations? If I can get the hang of it with something that is not specific FM will be really difficult to adapt this knowledge to the FM band?

    I find EDD, DTD and schema to be rather confusing. Someone explain the difference in simple terms or direct me to a video, etc.? Assuming that I start with an XML file that is created in one other purpose, not meant to be FM, need more than one of them? Do you do first?

    Ventura if I want to have two separate data elements (off the coast of the database) on the same line, say a left-aligned with the other right aligned, programmers put both with a tab, and that is controlled by a tag paragraph in Ventura with a tab on the right. With XML, if I understand it correctly, you wouldn't do that in the XML file - I'm probably not ready to understand the method, I just want to know if this is possible without doing something like having paragraph of second properties point to have no line breaks. If so, where that would be appropriate, ESD, DTD, etc.?

    XML in FM can include inline graphics? What about an Excel chart?

    Thank you

    Gary

    Hi Gary,.

    a lot of questions, he

    But lets start with the first things first.

    For your general understanding: XML separates basically content layout. You can add metadata to the content by adding attributes to some semantic purposes or to include information for your page layout process (or any information that you feel should be here).

    XML is essentially made up of elements, attributes and entities. Those that are defined in a DTD or a schema. ESD does the same for the management of content structured in FM. To stuff FM back and forth into XML and vice versa, you will need both a DSP for handling in FM and the DTD or schema of XML processing. Basically the two similar at first, but ESD will be also some layout information included as well as routines to facilitate the production of structured content (so called context rules).

    The translation between XML and FM requires also some reading/writing-rules governing the specific elements of the FM and values to create "correct" XML files

    Your layout (-> master pages), styles of paragraph and character, etc. pre-set styles of paintings, graphics and so on, are stored in a template file, which is used when you import an XML file to the FM band.

    These are the basics that you are handling.

    Everything that affects page layout will be on the side of the FM of things (if you use it to publish stuff).

    Everything that affects the structure is mainly done on the DTD and the reading/writing-rules side (but has an equivalent in ESD).

    So, for your search:

    XML books who have 10 years maybe not the best choice, because they will probably have a lot of references to SGML, which doesn't help much. But some who are about 5 years old will do just fine - not much changed on the side of XML (unless you decide to use the XML schema).

    For FM11, it is preferable to use guides for FM9 (those are the most comprehensive) and use this forum.

    If you insured the most, I would say to book some consultant for training on the creation of ESD. This will help avoid a lot of frustration later and pays really fast off the coast.

    It can also provide answers to specific questions such as the ones you posted above (Yes, graphics work).

    Once your done with that, you need to do a search, if one of the XML flavors already established already meet your needs in general (I'm talking about DITA, DocBook, S1000D and others) or if you want to develop your own structure (which needs a mayor of brainstorming, but could better meet your needs).

    Soon Alex

  • Schema validation fails on the transformed XML document

    OK, this is weird.

    I get XML files that are supposed to conform to a given XSD. There are dozens of different parties who send these files. To be more precise, I refer to the Ontario Energy Board (OEB) PIPE Documents.

    I found that at least one sender sends invalid files. I can't that fixes to the source, so I'm working around that.

    for example
    <?xml version="1.0" encoding="UTF-8"?>
    <PIPEDocument  xmlns="http://www.oeb.gov.on.ca" 
                              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                              xsi:schemaLocation="http://www.oeb.gov.on.ca/ PIPEDocument.xsd" 
                              Version="4.0" 
                              DocumentReferenceNumber="xxx" CreationDate="20110825100008000ES">
    <MarketParticipantDirectory>
    <Sender>
    ...
    Oracle is not like this:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00344: namespace values "http://www.oeb.gov.on.ca" and "http://www.oeb.gov.on.ca/" differ
    OK, so to work around this problem, before schema validation, I apply an XSLT transformation to clean the top-level element:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.oeb.gov.on.ca">
    <xsl:output method="xml" indent="no"/>
    
    <xsl:template match="/">
        <xsl:copy>
          <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="*">
        <xsl:if test="local-name() = name()">
                <xsl:element name="{local-name()}">
                  <xsl:apply-templates select="@*|node()"/>
                </xsl:element>
        </xsl:if>
    </xsl:template>
    
    <xsl:template match="@*">
        <xsl:if test="local-name() = name()">
                <xsl:attribute name="{local-name()}">
                  <xsl:value-of select="."/>
                </xsl:attribute>
        </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
    Nice: the fact that it is intended for:
    <?xml version="1.0" encoding="UTF-8"?>
    <PIPEDocument xmlns="http://www.oeb.gov.on.ca" 
                             Version="4.0" 
                             DocumentReferenceNumber="50520110825080908VA0001.EBT" 
                             CreationDate="20110825100008000ES">
    <MarketParticipantDirectory>
    <Sender>
    ...
    If I now the schema validate the above transformed XML, then it validates OK.

    Large? No, if I try to turn on the fly (i.e. without first transformation and followed by reading in the transformed data from the file), I get a strange error:
    declare
     v_xml xmltype := xmltype(bfilename('ERS_FILE_LOAD_308', 'DecryptedFile-30873604.xml'), 0).transform(XDBURIType('/ERS_TEST01/PIPE/XSLT/V1.0/pre_validate_XSLT.xsl').getXML());
     v_xsd_name varchar2(255) := 'PIPE/Power/V4.0/PIPEDocument.xsd'; 
    begin
    if v_xml.isSchemaValid(v_xsd_name) = 1 then 
           dbms_Output.put_line('valid');
        else
           dbms_Output.put_line('invalid');
           
           --in order to get specific error info for a non-schema message need to convert the XML to schema based
           
           v_xml := v_xml.createSchemaBasedXML(v_xsd_name);
          
           v_xml.schemaValidate();               
           
        end if;  
    end;
    /
    ORA-31043: Element '' not globally defined in schema ''
    Exsqueeze me? What element in the schema?

    The transformation itself works very well. Specifically, if I run the following:
    select xmltype(bfilename('ERS_FILE_LOAD_308', 'DecryptedFile-30873604.xml'), 0).transform(XDBURIType('/ERS_TEST01/PIPE/XSLT/V1.0/pre_validate_XSLT.xsl').getXML()).getclobval() from dual;
    ... I get the desired result. Of course, if I save the result file and validate the fact that it works:
    declare
     v_xml xmltype := xmltype(bfilename('ERS_FILE_LOAD_308', 'DecryptedFile-30873604_manually_saved.xml'), 0);
     v_xsd_name varchar2(255) := 'PIPE/Power/V4.0/PIPEDocument.xsd'; 
    begin
    if v_xml.isSchemaValid(v_xsd_name) = 1 then 
           dbms_Output.put_line('valid');
        else
           dbms_Output.put_line('invalid');
           
           --in order to get specific error info for a non-schema message need to convert the XML to schema based
           
           v_xml := v_xml.createSchemaBasedXML(v_xsd_name);
          
           v_xml.schemaValidate();               
           
        end if;  
    end;
    /
    I would like to join example XML file, but it contains customer data so I can't do that. I would fix the XSD but it is the nest of a rat of 50 XSD with includes and a 300 script online registration scheme, so I can't do that.

    What I'm missing here?

    Looks like an Oracle bug for me at this isSchemaValid binds to a beginning of the XML instance and not to the instance transformed.

    thoughts?

    (using database Oracle 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production under linux)

    Published by: Pollocks01 on October 18, 2011 16:11

    Hello

    Looks like an Oracle bug for me at this isSchemaValid binds to a beginning of the XML instance and not to the instance transformed.

    That wouldn't be surprising. There are "few" bugs on the XSL transformation.
    Here's a recently posted: {: identifier of the thread = 2245703}

    The solution was to serialize the output and analyze again.
    So, what you describe on 'reading of a works file' makes me think it's the same kind of problem.

    You can also view the contents of the variable just after that:

    v_xml := v_xml.createSchemaBasedXML(v_xsd_name);
    

    ?

  • Load Xml data

    male

    Here are the details of my table & serial number is generated to sequence

    Serial_number NUMBER - 1
    CLIENT_CODE VARCHAR2 (45) Yes.
    Client_name VARCHAR2 (45) Yes.
    NUMBER PHONE_NUMBER (12.0) Yes.

    When I download xml data in my table of his mistake of ths give

    ORA-31011: failure ORA-19202 XML parsing: error occurred in LPX-00210 of XML processing: expected ' < ' instead of 'P '.

    My xml data
    Client telephone Code customer name
    DJ1808 PLAPLAPLAPLA JEAN-JACQUES JAIN 9822054153
    DV559 DEMBELE MOUSTAPHA VYAVAHARE 997094167
    JM1717 CHRISTIANE BERNADETTE MUTHA
    KL940 KUNDAN M OLIVIER 9923871117


    can u help me
    Thank you
    Shyam

    The export to Excel as a CSV file, and then follow the instructions given by previous poster... APEX/Oracle cannot read XLS or XLSX files...

    Thank you

    Tony Miller
    Webster, TX

    Time passes fast like the wind, but the flies from fruits such as bananas.

    If you answer this question, please mark the thread as closed and give points where won...

  • XML file too large or too large XML element

    I try to import an xml file into the repository and have it shred in the object-relational tables. I signed up a diagram and it created types, triggers and object-relational xml_tables. The complete xml file is > 80 MB. XDB created all fields VARCHAR2 (4000).

    error code when you import the complete XML file. That's what I need to fix in the end.
    DECLARE
      res BOOLEAN;
    BEGIN
      res := DBMS_XDB.createResource('/home/pharma/drugbank.xml', 
                    bfilename('XMLPHARMA', 'drugbank.xml'),
                    nls_charset_id('AL32UTF8'));
    END;
    /
    COMMIT;
    
    XML file encounters errors on the import.
    An error was encountered performing the requested operation
    ORA-30951: Element or attribute at Xpath references exceeds maximum length
    ORA-06512 at "XDB.DBMS_XDB", line 315
    ORA-06512 at line 4
    30951.00000 - "Element or attribute at Xpath %x exceeds maximum length"
    *Cause: An attempt was made to insert a node of length exceeding the maximum length (specified by the maxLength facet) into an XML document.
    *Action: Do not attempt to add a node exceeding the maximum length to XML documents.
    Vendor code 30951Error at Line:18
    I guess that some fields have lengths > 4000 max. I intend to annotate the schema with SQLType = 'CLOB', but there are fields to change. I could copy the xml file and reduce this xml file to a record of any in the tables. My plan was to write a review on the bfile to get the lengths of some fields, annotate the .xsd with CLOB when needed and then import it again. To do this, I have a 1 imported in a table and as a bfile type recording file.

    Here is my code selection length in a generated object-relational table as a single folder.
    CREATE OR REPLACE VIEW pharma.drugs_vw AS
    SELECT d.*
    FROM drugs, XMLTABLE
      ('/drugs' PASSING OBJECT_VALUE COLUMNS
        drugbank_id        VARCHAR2(20)   PATH 'drug/drugbank-id',
        name               VARCHAR2(50)   PATH 'drug/name',
        description        VARCHAR2(4000) PATH 'drug/description'    
      ) d
    /
    
    select max(length(drugbank_id)) as dbidlen,
          max(length(name)) as nmlen,
          max(length(description)) as desclen
    from drugs_vw;
    
            DBIDLEN           NMLEN         DESCLEN
    --------------- --------------- ---------------
                  7               9             229
    
    1 row selected.
    Here's the code for the bfile. Same results, but using deprecated functions. I read the white paper, Oracle XML DB: best practices for optimal performance of queries XML. It is said that the function extract(), extractvalue(), Table (XMLSequence ()) and XMLType() are deprecated in 11 GR 2.
    -- Note extractvalue is deprecated in 11gr2 replaced by W3C standard
    --                                          XMLCast(XMLQuery())
    -- TABLE(XMLSequence) is replaced by XMLTable
    -- XMLType() is replaced by XMLParse()
    SELECT max(length(extractvalue(column_value, '/drug/drugbank-id'))) dbidlen,
           max(length(extractvalue(column_value, '/drug/name'))) nmlen,
           max(length(extractvalue(column_value, '/drug/description'))) desclen
    FROM TABLE(XMLSequence(XMLTYPE(bfilename('XMLPHARMA',
    'db00001.xml'),nls_charset_id('AL32UTF8')).extract('/drugs/drug'))) d
    WHERE ROWNUM <= 5;
    
            DBIDLEN           NMLEN         DESCLEN
    --------------- --------------- ---------------
                  7               9             229
    Is this better code to get the maximum length of a bfile type xml fields? Here's what I have so far. It works on a simple drugbank id.
    SELECT max(length(drugbank_id)) AS dbidlen,
           max(length(name)) AS nmlen,
           max(length(description)) AS desclen
    FROM (XMLTABLE('*'
                    PASSING (XMLType(bfilename('XMLPHARMA', 'db00001.xml'),nls_charset_id('AL32UTF8')))
                    COLUMNS
        drugbank_id        VARCHAR2(20)   PATH 'drug/drugbank-id',
        name               VARCHAR2(50)   PATH 'drug/name',
        description        VARCHAR2(4000) PATH 'drug/description'
      )
    );
    I try to run it on the full file and get this error
    Error report:
    SQL Error: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00007: unexpected end-of-file encountered
    31011. 00000 -  "XML parsing failed"
    *Cause:    XML parser returned an error while trying to parse the document.
    *Action:   Check if the document to be parsed is valid.
    The code to create patterns and object-relational tables. It worked well.
    set serveroutput on
    -- Create resource file for schema
    DECLARE
      res BOOLEAN;
    BEGIN
      res := DBMS_XDB.createResource('/home/pharma/drugbank.xsd', 
                    bfilename('XMLPHARMA', 'drugbank.xsd'),
                    nls_charset_id('AL32UTF8'));
      COMMIT;
    END;
    /
    
    -- optional debugging of create types and tables if you want a trace
    ALTER SESSION SET EVENTS = '31098 TRACE NAME CONTEXT FOREVER';
    
    BEGIN
      DBMS_XMLSCHEMA.registerSchema(
          SCHEMAURL => 'http://localhost:8080/home/pharma/drugbank.xsd',
          SCHEMADOC => bfilename('XMLPHARMA', 'drugbank.xsd'),
          CSID      => nls_charset_id('AL32UTF8'),
          LOCAL     => TRUE,
          GENTYPES  => TRUE,
          GENTABLES => TRUE,
          OWNER     => 'PHARMA');
      COMMIT;
    END;
    /
    SQL> select * from v$version;
    BANNER
    ---------------------------------------------------------------
    Oracle Database 11g Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    Follows the xml schema. Sorry for the length, but I think I might break something if I he snipped.
    <?xml version="1.0" encoding="UTF-8"?>
         <xs:schema  
         xmlns:xs="http://www.w3.org/2001/XMLSchema"  
         xmlns:xdb="http://xmlns.oracle.com/xdb"
         >
    
         <!-- General type definitions -->
         <xs:simpleType name="DecimalOrEmptyType">
              <xs:union memberTypes="xs:decimal EmptyStringType"/>
         </xs:simpleType>
         <xs:simpleType name="EmptyStringType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value=""/>
              </xs:restriction>
         </xs:simpleType>
    
         <!-- Element Definitions -->
         <!-- Drug secondary accession number definition begins -->
         <xs:element name="secondary-accession-numbers" xdb:defaultTable="SECONDARY_ACCESSION_NUMBERS">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element name="secondary-accession-number" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug secondary accession number definition ends -->
         <!-- Drug groups definition begins -->
         <xs:element name="groups" xdb:defaultTable="GROUPS">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element name="group">
                             <xs:simpleType>
                                  <xs:restriction base="xs:string">
                                       <xs:enumeration value="approved"/>
                                       <xs:enumeration value="illicit"/>
                                       <xs:enumeration value="experimental"/>
                                       <xs:enumeration value="withdrawn"/>
                                       <xs:enumeration value="nutraceutical"/>
                                  </xs:restriction>
                             </xs:simpleType>
                        </xs:element>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug groups definition ends -->
         <!-- Drug taxonomy definition begins -->
         <xs:element name="substructure">
              <xs:complexType>
                   <xs:simpleContent>
                        <xs:extension base="xs:string">
                             <xs:attribute name="class" type="xs:string" use="required"/>
                        </xs:extension>
                   </xs:simpleContent>
              </xs:complexType>
         </xs:element>
         <xs:element name="substructures" xdb:defaultTable="SUBSTRUCTURES">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element ref="substructure"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="taxonomy" xdb:defaultTable="TAXONOMY">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="kingdom" type="xs:string"/>
                        <xs:element ref="substructures"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug taxonomy definition ends -->
         <!-- Drug brands definition begins -->
         <xs:element name="brands" xdb:defaultTable="BRANDS">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element name="brand" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug brands definition ends -->
         <!-- Drug mixtures definition begins -->
         <xs:element name="mixture">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name" type="xs:string"/>
                        <xs:element name="ingredients" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="mixtures" xdb:defaultTable="MIXTURES">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element ref="mixture"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug mixtures definition ends -->
         <!-- Drug packagers definition begins -->
         <xs:element name="packager">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name" type="xs:string"/>
                        <xs:element name="url" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="packagers" xdb:defaultTable="PACKAGERS">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element ref="packager"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug packagers definition ends -->
         <!-- Drug manufacturers definition begins -->
         <xs:element name="manufacturer">
              <xs:complexType>
                   <xs:simpleContent>
                        <xs:extension base="xs:string">
                             <xs:attribute name="generic" type="xs:string" use="required"/>
                        </xs:extension>
                   </xs:simpleContent>
              </xs:complexType>
         </xs:element>
         <xs:element name="manufacturers" xdb:defaultTable="MANUFACTURERS">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element ref="manufacturer"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug manufactures definition ends -->
         <!-- Drug pricing definition begins -->
         <xs:element name="cost">
              <xs:complexType>
                   <xs:simpleContent>
                        <xs:extension base="xs:string">
                             <xs:attribute name="currency" type="xs:string" use="required"/>
                        </xs:extension>
                   </xs:simpleContent>
              </xs:complexType>
         </xs:element>
         <xs:element name="price">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="description" type="xs:string"/>
                        <xs:element ref="cost"/>
                        <xs:element name="unit" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="prices" xdb:defaultTable="PRICES">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element ref="price"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug pricing definition ends -->
         <!-- Drug categories definition begins -->
         <xs:element name="categories" xdb:defaultTable="CATEGORIES">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element name="category" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug categories definition ends -->
         <!-- Drug affected orgainsms definition begins -->
         <xs:element name="affected-organisms" xdb:defaultTable="AFFECTED_ORGANISMS">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element name="affected-organism" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug affected organisms definition ends -->
         <!-- Drug dosage definition begins -->
         <xs:element name="dosage">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="form" type="xs:string"/>
                        <xs:element name="route" type="xs:string"/>
                        <xs:element name="strength" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="dosages" xdb:defaultTable="DOSAGES">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element ref="dosage"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug dosages definition ends -->
         <!-- Drug ATC codes definition begins -->
         <xs:element name="atc-codes" xdb:defaultTable="ATC_CODES">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element name="atc-code" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug ATC codes definition ends -->
         <!-- Drug AHFS codes definition begins -->
         <xs:element name="ahfs-codes" xdb:defaultTable="AHFS_CODES">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element name="ahfs-code" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug AHFS codes definition ends -->
         <!-- Drug Patent definition begins -->
         <xs:element name="patent">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="number" type="xs:string"/>
                        <xs:element name="country" type="xs:string"/>
                        <xs:element name="approved" type="xs:string"/>
                        <xs:element name="expires" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="patents" xdb:defaultTable="PATENTS">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element ref="patent"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug patent definition ends -->
         <!-- Drug food interactions definition begins -->
         <xs:element name="food-interactions" xdb:defaultTable="FOOD_INTERACTIONS">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="food-interaction" type="xs:string" maxOccurs="unbounded" minOccurs="0"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug food interactions definition ends -->
         <!-- Drug drug interactions definition begins -->
         <xs:element name="drug-interaction">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="drug" type="xs:integer"/>
                        <xs:element name="description" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="drug-interactions" xdb:defaultTable="DRUG_INTERACTIONS">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element ref="drug-interaction"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug drug interactions definition ends -->
         <!-- Drug protein sequences (biotech) definition begins -->
         <xs:element name="protein-sequences" xdb:defaultTable="PROTEIN_SEQUENCES">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element name="protein-sequence" type="SequenceType"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug protein sequences (biotech) definition ends-->
         <!-- Drug external links definition begins -->
         <xs:element name="external-link">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="resource" type="xs:string"/>
                        <xs:element name="url" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="external-links" xdb:defaultTable="EXTERNAL_LINKS">
              <xs:complexType>
                   <xs:sequence maxOccurs="unbounded" minOccurs="0">
                        <xs:element ref="external-link"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug external links definition ends -->
         <!-- Drug targets definition begins -->
         <xs:element name="targets" xdb:defaultTable="TARGETS">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="target" type="TargetBondType" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug targets definition ends -->
         <!-- Drug enzymes definition begins -->
         <xs:element name="enzymes" xdb:defaultTable="ENZYMES">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="enzyme" type="BondType" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug enzmes definition ends -->
         <!-- Drug transporters definition begins -->
         <xs:element name="transporters" xdb:defaultTable="TRANSPORTERS">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="transporter" type="BondType" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug transporters definition ends -->
         <!-- Drug carriers definition begins -->
         <xs:element name="carriers" xdb:defaultTable="CARRIERS">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="carrier" type="BondType" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Drug carriers definition ends -->
         <!-- Partner  Pfams definition begins -->
         <xs:element name="pfam">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="identifier" type="xs:string"/>
                        <xs:element name="name" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="pfams" xdb:defaultTable="PFAMS">
              <xs:complexType>
                   <xs:sequence minOccurs="0" maxOccurs="unbounded">
                        <xs:element ref="pfam"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Partner  Pfams definition end -->
         <!-- Partner  GO Classification definition begins -->
         <xs:element name="go-classifier">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="category" type="xs:string"/>
                        <xs:element name="description" type="xs:string"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="go-classifiers" xdb:defaultTable="GO_CLASSIFIERS">
              <xs:complexType>
                   <xs:sequence minOccurs="0" maxOccurs="unbounded">
                        <xs:element ref="go-classifier"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <!-- Partner  GO Classification definition ends -->
         <!-- Partner Essentiality definition begins -->
         <xs:element name="essentiality">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:enumeration value="Essential"/>
                        <xs:enumeration value="Non-Essential"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <!-- Partner Essentiality definition ends -->
         
         <!-- Complex Type Definitions -->
         <xs:complexType name="SequenceType">
              <xs:sequence>
                   <xs:element name="header" type="xs:string"/>
                   <xs:element name="chain" type="xs:string"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="PropertyType">
              <xs:sequence>
                   <xs:element name="kind">
                        <xs:simpleType>
                             <xs:restriction base="xs:string">
                                  <xs:enumeration value="logP"/>
                                  <xs:enumeration value="logS"/>
                                  <xs:enumeration value="logP/hydrophobicity"/>
                                  <xs:enumeration value="Water Solubility"/>
                                  <xs:enumeration value="caco2 Permeability"/>
                                  <xs:enumeration value="pKa"/>
                                  <xs:enumeration value="IUPAC Name"/>
                                  <xs:enumeration value="Molecular Weight"/>
                                  <xs:enumeration value="Monoisotopic Weight"/>
                                  <xs:enumeration value="SMILES"/>
                                  <xs:enumeration value="Molecular Formula"/>
                                  <xs:enumeration value="InChI"/>
                                  <xs:enumeration value="InChIKey"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:element>
                   <xs:element name="value" type="xs:string"/>
                   <xs:element name="source">
                        <xs:simpleType>
                             <xs:restriction base="xs:string">
                                  <xs:enumeration value="JChem"/>
                                  <xs:enumeration value="ALOGPS"/>
                                  <xs:enumeration value=""/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="PropertiesType">
              <xs:sequence>
                   <xs:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="SynonymsType">
              <xs:sequence maxOccurs="unbounded" minOccurs="0">
                   <xs:element name="synonym" type="xs:string"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="IdentifiersType">
              <xs:sequence maxOccurs="unbounded" minOccurs="0">
                   <xs:element name="external-identifier">
                        <xs:complexType>
                             <xs:sequence>
                                  <xs:element name="resource" type="xs:string"/>
                                  <xs:element name="identifier" type="xs:string"/>
                             </xs:sequence>
                        </xs:complexType>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="BondActionsType">
              <xs:sequence maxOccurs="unbounded" minOccurs="0">
                   <xs:element name="action" type="xs:string"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="BondType">
              <xs:sequence>
                   <xs:element name="actions" type="BondActionsType"/>
                   <xs:element name="references" type="xs:string"/>
              </xs:sequence>
              <xs:attribute name="position" type="xs:integer" use="optional"/>
              <xs:attribute name="partner" type="xs:integer"/>
         </xs:complexType>
         <xs:complexType name="TargetBondType">
              <xs:complexContent>
                   <xs:extension base="BondType">
                        <xs:sequence>
                             <xs:element name="known-action">
                                  <xs:simpleType>
                                       <xs:restriction base="xs:string">
                                            <xs:enumeration value="yes"/>
                                            <xs:enumeration value="no"/>
                                            <xs:enumeration value="unknown"/>
                                       </xs:restriction>
                                  </xs:simpleType>
                             </xs:element>
                        </xs:sequence>
                   </xs:extension>
              </xs:complexContent>
         </xs:complexType>
         
         <xs:complexType name="PartnerType">
              <xs:sequence>
                   <xs:element name="name" type="xs:string"/>
                   <xs:element name="general-function" type="xs:string"/>
                   <xs:element name="specific-function" type="xs:string"/>
                   <xs:element name="gene-name" type="xs:string"/>
                   <xs:element name="locus" type="xs:string"/>
                   <xs:element name="reaction" type="xs:string"/>
                   <xs:element name="signals" type="xs:string"/>
                   <xs:element name="cellular-location" type="xs:string"/>
                   <xs:element name="transmembrane-regions" type="xs:string"/>
                   <xs:element name="theoretical-pi" type="DecimalOrEmptyType"/>
                   <xs:element name="molecular-weight" type="DecimalOrEmptyType"/>
                   <xs:element name="chromosome" type="xs:string"/>
                   <xs:element ref="essentiality"/>
                   <xs:element name="references" type="xs:string"/>
                   <xs:element name="external-identifiers" type="IdentifiersType"/>
                   <xs:element name="synonyms" type="SynonymsType"/>
                   <xs:element name="protein-sequence" type="SequenceType" minOccurs="0"/>
                   <xs:element name="gene-sequence" type="SequenceType" minOccurs="0"/>
                   <xs:element ref="pfams"/>
                   <xs:element ref="go-classifiers"/>
              </xs:sequence>
              <xs:attribute name="id" type="xs:integer" use="required"/>
         </xs:complexType>
         <xs:complexType name="DrugType">
              <xs:sequence>
                   <xs:element name="drugbank-id" type="xs:string"/>
                   <xs:element name="name" type="xs:string"/>
                   <xs:element name="description" type="xs:string"/>
                   <xs:element name="cas-number" type="xs:string"/>
                   <xs:element name="general-references" type="xs:string"/>
                   <xs:element name="synthesis-reference" type="xs:string"/>
                   <xs:element name="indication" type="xs:string"/>
                   <xs:element name="pharmacology" type="xs:string"/>
                   <xs:element name="mechanism-of-action" type="xs:string"/>
                   <xs:element name="toxicity" type="xs:string"/>
                   <xs:element name="biotransformation" type="xs:string"/>
                   <xs:element name="absorption" type="xs:string"/>
                   <xs:element name="half-life" type="xs:string"/>
                   <xs:element name="protein-binding" type="xs:string"/>
                   <xs:element name="route-of-elimination" type="xs:string"/>
                   <xs:element name="volume-of-distribution" type="xs:string"/>
                   <xs:element name="clearance" type="xs:string"/>
                   <xs:element ref="secondary-accession-numbers"/>
                   <xs:element ref="groups"/>
                   <xs:element ref="taxonomy"/>
                   <xs:element name="synonyms" type="SynonymsType"/>
                   <xs:element ref="brands"/>
                   <xs:element ref="mixtures"/>
                   <xs:element ref="packagers"/>
                   <xs:element ref="manufacturers"/>
                   <xs:element ref="prices"/>
                   <xs:element ref="categories"/>
                   <xs:element ref="affected-organisms"/>
                   <xs:element ref="dosages"/>
                   <xs:element ref="atc-codes"/>
                   <xs:element ref="ahfs-codes"/>
                   <xs:element ref="patents"/>
                   <xs:element ref="food-interactions"/>
                   <xs:element ref="drug-interactions"/>
                   <xs:element ref="protein-sequences" minOccurs="0"/><!-- Only present for biotech drugs -->
                   <xs:element name="calculated-properties" type="PropertiesType" minOccurs="0"/><!-- Only present for small molecule drugs -->
                   <xs:element name="experimental-properties" type="PropertiesType"/>
                   <xs:element name="external-identifiers" type="IdentifiersType"/>
                   <xs:element ref="external-links"/>
                   <xs:element ref="targets"/>
                   <xs:element ref="enzymes"/>
                   <xs:element ref="transporters"/>
                   <xs:element ref="carriers"/>
              </xs:sequence>
              <xs:attribute name="type" use="required">
                   <xs:simpleType>
                        <xs:restriction base="xs:string">
                             <xs:enumeration value="small molecule"/>
                             <xs:enumeration value="biotech"/>
                        </xs:restriction>
                   </xs:simpleType>
              </xs:attribute>
              <xs:attribute name="updated" type="xs:string" use="required"/>
              <xs:attribute name="created" type="xs:string" use="required"/>
              <xs:attribute name="version" type="xs:decimal" use="required"/>
         </xs:complexType>
         
         <xs:element name="drugs"  xdb:defaultTable="DRUGS">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="drug" type="DrugType" minOccurs="0" maxOccurs="unbounded" />
                        <xs:element name="partners">
                             <xs:complexType>
                                  <xs:sequence>
                                       <xs:element name="partner" type="PartnerType" minOccurs="0" maxOccurs="unbounded" />
                                  </xs:sequence>
                             </xs:complexType>
                        </xs:element>
                   </xs:sequence>
              </xs:complexType>
         
              <xs:keyref name="targetPartnerIdKeyRef" refer="partnerIdKey">
                   <xs:selector xpath="drug/targets/*"/>
                   <xs:field xpath="@partner"/>
              </xs:keyref>
              <xs:keyref name="enzymePartnerIdKeyRef" refer="partnerIdKey">
                   <xs:selector xpath="drug/enzymes/*"/>
                   <xs:field xpath="@partner"/>
              </xs:keyref>
              <xs:keyref name="transporterPartnerIdKeyRef" refer="partnerIdKey">
                   <xs:selector xpath="drug/transporters/*"/>
                   <xs:field xpath="@partner"/>
              </xs:keyref>
              <xs:keyref name="carrierPartnerIdKeyRef" refer="partnerIdKey">
                   <xs:selector xpath="drug/carriers/*"/>
                   <xs:field xpath="@partner"/>
              </xs:keyref>
              <xs:key name="partnerIdKey">
                   <xs:selector xpath=".//partner"/>
                   <xs:field xpath="@id"/>
              </xs:key>
         </xs:element>     
    </xs:schema>
    Optimization white paper request
    http://www.Oracle.com/technetwork/database/features/xmldb/xmlqueryoptimize11gr2-168036.PDF

    Well Yes... You need not put GENTABLES-online TRUE when recording object relational. There are no structures in XML schema that require tables on online storage...

    SQL> DECLARE
      2    V_XMLSCHEMA XMLTYPE := xmltype(bfilename('&USERNAME', 'drugbank.xsd'),nls_charset_id('AL32UTF8'));
      3  BEGIN
      4          DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XMLSCHEMA);
      5          DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDOM(V_XMLSCHEMA);
      6          DBMS_XMLSCHEMA_ANNOTATE.setSQLType(V_XMLSCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'BondType',DBMS_XDB_CONSTANTS.XSD_ELEMENT,'references','CLOB',TRUE);
      7          DBMS_XMLSCHEMA_ANNOTATE.setSQLType(V_XMLSCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'PartnerType',DBMS_XDB_CONSTANTS.XSD_ELEMENT,'references','CLOB',TRUE);
      8          DBMS_XMLSCHEMA_ANNOTATE.setSQLType(V_XMLSCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'DrugType',DBMS_XDB_CONSTANTS.XSD_ELEMENT,'general-references','CLOB',TRUE);
      9          DBMS_XMLSCHEMA_ANNOTATE.setSQLType(V_XMLSCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'SequenceType',DBMS_XDB_CONSTANTS.XSD_ELEMENT,'chain','CLOB',TRUE);
     10    DBMS_XMLSCHEMA.registerSchema(
     11        SCHEMAURL => :SCHEMAURL,
     12        SCHEMADOC => V_XMLSCHEMA,
     13        LOCAL     => TRUE,
     14        GENTYPES  => TRUE,
     15        GENTABLES => TRUE);
     16  END;
     17  /
    old   2:   V_XMLSCHEMA XMLTYPE := xmltype(bfilename('&USERNAME', 'drugbank.xsd'),nls_charset_id('AL32UTF8'));
    new   2:   V_XMLSCHEMA XMLTYPE := xmltype(bfilename('PHARMA', 'drugbank.xsd'),nls_charset_id('AL32UTF8'));
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:01.65
    SQL> CREATE TABLE drugs_xmltype OF XMLTYPE
      2  XMLSCHEMA "http://lims.drugbank.ca/docs/drugbank.xsd"
      3  ELEMENT "drugs"
      4  /
    
    Table created.
    

    results in

    SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 29 16:14:00 2011
    
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> select table_name from user_xml_tables;
    
    TABLE_NAME
    ------------------------------
    DRUGS_XMLTYPE
    
    SQL> select count(*) from user_nested_tables;
    
      COUNT(*)
    ----------
            36
    
    SQL>
    
  • How to insert an XML document to the database table

    Here's one my XML document example I want to import into database

    Example XML Document
    <? XML version = "1.0"? >
    rowset <>
    < ROW >
    < DEPTXML department_id = "10" >
    SALES of < DEPARTMENT_NAME > < / DEPARTMENT_NAME >
    < EMPLIST >
    < EMP_T EMPLOYEE_ID = "30" >
    Scott < LAST_NAME > < / LAST_NAME >
    < / EMP_T >
    < EMP_T EMPLOYEE_ID = "31" >
    Marie < LAST_NAME > < / LAST_NAME >
    < / EMP_T >
    < / EMPLIST >
    < / DEPTXML >
    < / ROW >
    < ROW >
    < DEPTXML department_id = "20" >
    < DEPARTMENT_NAME > ACCOUNTING < / DEPARTMENT_NAME >
    < EMPLIST >
    < EMP_T EMPLOYEE_ID = "40" >
    John < LAST_NAME > < / LAST_NAME >
    < / EMP_T >
    < EMP_T EMPLOYEE_ID = "41" >
    Jerry < LAST_NAME > < / LAST_NAME >
    < / EMP_T >
    < / EMPLIST >
    < / DEPTXML >
    < / ROW >
    < / LINES >
    ********End***********

    Table in which I want to import this file

    hr_new_emp
    (
    department_id number,
    department_name varchar2 (50).
    Number of employe_id
    last_name varchar2 (50)
    )

    If your XML code is in a file, the easiest is to load as a CLOB in the file (google search will give you lots of results to load a file into a CLOB, so I won't detail it here). Once you have it as a CLOB you can fairly easily convert that XMLTYPE for example

      v_xml := XMLTYPE(v_clob);
    

    (assuming that v_xml is declared as XMLTYPE and v_clob is declared as a CLOB)

    Once you have it as an XMLTYPE that is simple to use XMLTABLE to break the XML into its components using SQL...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select xmltype('
      2  
      3  
      4  
      5  SALES
      6  
      7  
      8  Scott
      9  
     10  
     11  Mary
     12  
     13  
     14  
     15  
     16  
     17  
     18  ACCOUNTING
     19  
     20  
     21  John
     22  
     23  
     24  Jerry
     25  
     26  
     27  
     28  
     29  ') as xml from dual)
     30  --
     31  -- END OF TEST DATA
     32  --
     33  select x.department_id, x.department_name, y.employee_id, y.last_name
     34  from t
     35      ,xmltable('/ROWSET/ROW'
     36                passing t.xml
     37                columns department_id   number       path '/ROW/DEPTXML/@DEPARTMENT_ID'
     38                       ,department_name varchar2(30) path '/ROW/DEPTXML/DEPARTMENT_NAME'
     39                       ,emplist         xmltype      path '/ROW/DEPTXML/EMPLIST'
     40               ) x
     41      ,xmltable('/EMPLIST/EMP_T'
     42                passing x.emplist
     43                columns employee_id     number       path '/EMP_T/@EMPLOYEE_ID'
     44                       ,last_name       varchar2(30) path '/EMP_T/LAST_NAME'
     45*              ) y
    SQL> /
    
    DEPARTMENT_ID DEPARTMENT_NAME                EMPLOYEE_ID LAST_NAME
    ------------- ------------------------------ ----------- ------------------------------
               10 SALES                                   30 Scott
               10 SALES                                   31 Mary
               20 ACCOUNTING                              40 John
               20 ACCOUNTING                              41 Jerry
    

    ... and once you have selected the data as it is quite easy to use an INSERT statement around it to insert data into a table, as in a regular INSERT... Select...

    If you are dealing with large amounts of data or a more complex XML structure, you can consider using an XML schema to shred the data in tables.

    Example here...

    Re: XML processing in oracle file

    And you can also load XML data easily by using the function XDB (WebDAV) to Oracle. Details in the Oracle documentation for that or you could find help in the forum XML DB, which also has a FAQ detailing the different methods how to load XML shred data...

    DB XML FAQ

  • Prepopulate the drop-down lists with xml file

    Hello world

    I'm trying to prepopulate a dropdown list using an xml file. There are many tutorials on the internet that allows me to do from the overview of the Designer tab. However, when I did it worked well, but I am not able to 'embed' the xml file so that the values appear in the workspace when the user starts a process.

    I tried to load the xml file with the contents of resource reading in the action profile of the first task and put the result in the "xmlPrepareData" but the problem is that I can't put all the values of the xmlPrepareData after because the xml model is not exactly the one used by LiveCycle.

    Any thoughts? Someone is already managed to prepopulate a dropdown list with an XML within the process?

    Kind regards

    Thomas

    OK gr8...

    Assuming you're able to get the XML process LC to your XDP/PDF form field.

    You can fix the XML from the drop-down under-

    clear the drop-down list box
    * DROPDOWN_Field.clearItems ();

    choiceList = XMLData.parse (* XML_Field.rawValue, false);

    divide the choiceList in an array of values

    choice = choiceList.resolveNodes("root.element[*].*NODENAME");

    var numchoices = choices.length;

    Adds an array of values in drop-down list
    for (var i = 0; i)< numchoices;="">

    {
    * DROPDOWN_Field.addItem (choices.item (i) .value);
    }

    * DROPDOWN_Field - is your field drop-down list.

    * XML_Field - is your XML data stored in a TextField.

    * NODENAME - is the name of the node in your XML to solve.

    I hope that Hepls...

    Regards-

    Chalukya.

Maybe you are looking for