Using PLSQL to merge XML docs

Hi All, I am looking for a general approach to how I can merge data in one xml file into another xml file that has the schema imbeded in it. I am sure XSLT is in here somewhere but just a bit unfamiliar with the approach.
Here is what we are doing. We have a MS Word doc, in WordML. I has an attached schema and the document has been marked up with this schema. We extract data from the database in this schema format and now want to merge the two to produce a word document.
thanks
Don

When I worked with populating MS Word Mail merge fields from a database it was quite gnarly (the documents contained repeating groups and we ended up with lots of macros driving embedded SQL) but the basic principle was:
(1) A template with placeholders (the mail merge fields)
(2) A data set
This seems to be a perfectly simple model and one that's ideal for XML too.
Your problem is that you have
(1) An XML document with a structure you want but not the data
(2) A different XML document with data you want but not in the right structure
Whilst this does look a bit like a mail merge model you must admit the differences are more compelling than the similarities.
I guess I am asking why you just don't hollow out the Word document and populate it directly from the database. That seems to me the simplest solution.
If you have good reasons for doing it the way you say then I suggest a database forum is the wrong place to be asking for guidance. You really ought to be asking in a Java/C#/XSLT forum. I have no expereince with WordML but this post suggests what seems to me a sound approach: creating XML fragments and integrating them into the body of a WordML doc.
Cheers, APC

Similar Messages

  • Merging XML Doc's

    Hi
    I have a servlet that builds up two different connections. The 2 databases holds the same type of data, ie the select statement is the same, it just brings back different time period values. I need to combine these two XML docs into one XML document, massage it a bit, apply style sheet and send to browser.
    I have now succeeded in doing the XML doc , massage and sending. However, I'am battling to combine the two xml doc's into one. any help appreciated.
    Tks
    Andre
    Here is the Servler code:
    String query = queryBuff.toString();
    OracleXMLQuery q1 = new OracleXMLQuery(conn1, query);
    q1.useLowerCaseTagNames();
    q1.setRowsetTag("CARDSLOADED");
    q1.setRowTag("CARDREC");
    XMLDocument xmldoc1 = (XMLDocument)q1.getXMLDOM();
    // now 2nd
    OracleXMLQuery q2 = new OracleXMLQuery(conn2, query);
    q2.useLowerCaseTagNames();
    q2.setRowsetTag("CARDSLOADED");
    q2.setRowTag("CARDREC");
    XMLDocument xmldoc2 = (XMLDocument)q2.getXMLDOM();
    So I need to combine xmldoc1 and xmldoc2. The stylesheet will do the Order by for me.
    Tks

    Hi - got it going ...tks
    You need to step down into the XMLDOC to get the nodes and not start at the beginning
    Sameple code -
    try
    String query = queryBuff.toString();
    System.out.println("query is >"+query);
    OracleXMLQuery q = new OracleXMLQuery(conn2, query);
    q.useLowerCaseTagNames();
    q.setRowsetTag("CARDSLOADED");
    q.setRowTag("CARDREC");
    xmldoc2 = (XMLDocument)q.getXMLDOM();
    // num_rows = q.getNumRowsProcessed();
    } //end try
    catch (Exception exc)
    out.println(exc.toString());
    // Now attemt to merge the two xml docs
    try
    NodeList list = xmldoc1.getElementsByTagName("CARDSLOADED");
    Node root = list.item(0);
    NodeList list1 = xmldoc2.getElementsByTagName("CARDREC");
    // now loop from pos 0 to end and add each node
    int noOfRecs = list1.getLength();
    for (int i=1; i <= noOfRecs -1; i++)
    Node child=list1.item(i);
    Node copy = xmldoc1.importNode(child, true);
    root.appendChild(copy);
    catch (Exception exc)
    System.out.println("Error merging "+exc.toString());

  • How to use Xpath to query elements loaded from different xml docs?

    I have a big DBLP XML doc (95mb), to load into the container, i splitted the doc into many small xml docs by the publication types, such as articles, books, inproceedings, etc.
    I tried to use xpath query such as
    query 'collection()/dblp[article/author]/book[title]'
    I got empty answers.
    but if i use XQuery such as
    query 'let $r:=collection()/dblp,$a :=$r/inproceedings/author
    for $l2 in $r/book
    where $a and $l2/title
    return <result> {$l2}{$a}</result>'
    i got answers. However, if i remove {$a} from the return clause, i still got empty answers.
    is there any problem with my Xpath query and flwor Xquery?
    regards,
    xiaoying

    Hi John,
    Following is the procedure i have used to load the xml docs (after the indexes have been created):
    private static void loadXmlFiles(File path2DbEnv,String theContainer, File file) throws Throwable {
         //Open a container in the db environment
              XmlManager theMgr = null;
              XmlContainer openedContainer = null;
              myDbEnv env;
              try {
              env = new myDbEnv(path2DbEnv);
         theMgr = new XmlManager(env.getEnvironment(), new XmlManagerConfig());
         //use node container
         theMgr.setDefaultContainerType(XmlContainer.NodeContainer);
                   try{
                   openedContainer = theMgr.createContainer(theContainer);
                   }catch (XmlException e){
                        //if the container alreay exist, then open it;     
                        openedContainer = theMgr.openContainer(theContainer);
              //Get an update context.
              XmlUpdateContext updateContext = theMgr.createUpdateContext();
                   String theFile = file.toString();
                   String docName=file.getName();
              //Get the input stream.
              XmlInputStream theStream = theMgr.createLocalFileInputStream(theFile);
              System.out.println("Adding " + theFile + " to container " +
                             theContainer);
         //     Do the actual put
              openedContainer.putDocument(docName, // The document's name
              theStream, // The actual document.
              updateContext, // The update context
         //     (required).
              null); // XmlDocumentConfig object
              System.out.println("done.");
              //XmlException extends DatabaseException, which in turn extends Exception.
              // Catching Exception catches them all.
              } catch (XmlException e){
                   System.err.println("Error loading files into container " + theContainer);
                   System.err.println(" Message: " + e.getMessage());
                   //In the event of an error, we abort the operation
                   // The database is left in the same state as it was in before
                   // we started this operation.
                   throw e;
              finally {
              cleanup(theMgr, openedContainer);
    Unfortunately, i waited for around 20 hours 148mb doc was not loaded; so i gave up.
    Could you please give me some suggestions on how to load the large doc efficiently ? thanks.
    regards,
    xiaoying

  • Generete xml doc with dtd form

    Hi,
    I am trying to generate xml doc based on dtd kind format.
    I use following code to get my xml doc is ok based on dtd like
    -----------dtd file---------------
    <!ELEMENT client_data (client_job*, person*)>
    <!ELEMENT client_job (job_cd, job_title?, primary_responsibilities?, grade_cd?, br_job_cd, eeo_job_group_id, effective_date?, end_date?)>
    <!ATTLIST client_job errMsg CDATA #IMPLIED>
    <!ATTLIST client_job deleteFlag ( Y | N ) 'N'>
    <!ELEMENT job_cd (#PCDATA)>
    <!ELEMENT job_title (#PCDATA)>
    <!ELEMENT primary_responsibilities (#PCDATA)>
    <!ELEMENT br_job_cd (#PCDATA)>
    <!ELEMENT eeo_job_group_id (#PCDATA)>
    -----------------end dtd--------------
    OracleXMLQuery qry = new OracleXMLQuery(conn, sql);
    qry.setRowsetTag("client_data");
    qry.setRowIdAttrName(null);
    // qry.useNullAttributeIndicator(true);
    qry.useLowerCaseTagNames();
    qry.setRowTag("client_job");
    xmlDocToReturn = qry.getXMLDOM();
    But if my dtd like following, i.g. has tree level, and data from multiple tables, the above code doesn't work for thes case
    --------------tree level dtd----------------
    <!ELEMENT person (person_name)>
    <!ATTLIST person person_id CDATA #REQUIRED>
    <!ATTLIST person hire_date CDATA #IMPLIED>
    <!ATTLIST person effective_date CDATA #IMPLIED>
    <!ATTLIST person end_date CDATA #IMPLIED>
    <!ELEMENT person_name (formatted_name*, given_name*, prefered_given_name?, middle_name?, family_name*, affix*)>
    <!ELEMENT formatted_name EMPTY>
    <!ATTLIST formatted_name type ( presentation | legal | sortOrder) 'presentation'>
    <!ELEMENT given_name (#PCDATA)>
    <!ELEMENT prefered_given_name (#PCDATA)>
    <!ELEMENT middle_name (#PCDATA)>
    <!ELEMENT family_name (#PCDATA)>
    <!ATTLIST family_name primary ( true | false | undefined ) 'undefined'>
    -----------------end dtd -------------------
    I try to use XMLDocumentFragment to create xml doc and appendChild , but the xml doc is not the format of the dtd required. Can you give me a Java sample?
    Thanks in advance.
    Yan

    Why don't you use XSLT?

  • Any jdbc examples inserting XML doc

    Newbie to xmldb/jdbc/java
    I'm looking for some sample java code that uses jdbc to insert xml docs into the 10g xml db.
    Also looking for sample code that does xquery using JDBC on 10g xmldb.
    (using eclipse on windows)
    any help appreciated

    Does this help, assume that you have an instance of
    public XMLType makeXMLType(OracleConnection conn,Document xmlDocument)
    throws NamingException
    try {
    XMLType xml = null;
    if (xmlDocument != null)
    xml = XMLType.createXML(conn,xmlDocument);
    return xml;
    catch (SQLException sqle)
    NamingException ne = new NamingException(SQLCache.UNEXPECTED_SQL_EXCEPTION);
    ne.setRootCause(sqle);
    throw ne;
    You can then bind the XMLType to an insert statement using setObject.

  • Validating xml doc using schema

    I was wondering if you can the following validation of an xml document using schema:
    <parent>
        <child>Jogn</child>
        <child>Hanna</child>
        <child>Blake</child>
        <childCount>3</childCount>
    <parent>the childcountValue equals the number of child node. is this possible using
    schema or do do i have to use an application to do this?
    thanx in advance

    thanx dvohra, but i already know how to validate schema using a parser.
    I'm looking for a way in the schema that specified thhat the total number of child elemnt equals to the integer value of the childTotal element. I don't even know if this is possible. If possible, what (tag) would i use. i don't need answer..hint would be nice.
    my other solution is to write an application that use a SAX parser to parse the xml doc. Although this is relatively easy, i would like to keep the validation within on file (the schema)..rather than have it be in the schema and a ContentHandler.

  • Attaching two XML docs together using XPath

    Hi,
    I have a conceptual question about whether something can be done in Oracle XML DB.
    I have two XML docs, doc1 and doc2. I want to attach doc2 to doc1 at some particular subelement of doc1's root element. I know the path to this subelement because I have an XPath which uniquely identifies that subelement. Assuming that these two docs are XMLTYPEs, is there a way to do this using XML DB functions, given only the XPath? Also, keep in mind that I don't know the structure of the documents at development time
    To better explain my question here is a stupid-simple example:
    doc1:
    <company>
    <department name="Sales"/>
    <department name="Marketing"/>
    </company>
    doc2:
    <employees>
    <employee name="Fred"/>
    <employee name="Jim"/>
    </employees>
    I want to attach doc2 into doc1 under doc1's <department name="Sales"/> element.
    I know that the XPath to this element is "/company/department[@name='Sales']"
    Is there any kind of Oracle magic that, given only doc1, doc2 and this XPath, would give me doc3:
    <company>
    <department name="Sales">
    <employees>
    <employee name="Fred"/>
    <employee name="Jim"/>
    </employees>
    </department>
    <department name="Marketing"/>
    </company>
    Although it seems kind of silly, whether or not this is possible will have to determine whether I use Oracle XML DB for my application. Also, in some situations the subelement I am attaching under may be nested 3, 4 or more elements below the root.
    Thanks in advance for any help,
    -Brad

    Yep ... exactly what I'm trying to do ... but it still don't work. This is what I get when I paste that into my SQL*Plus interface:
    SQL> set long 100000
    SQL> select updateXML(
    2 xmltype('
    3 <Document>
    4 <DocInfo>
    5 <EntityRef>EntityName</EntityRef>
    6 </DocInfo>
    7 <Body>
    8 <EntityRef>Entity2</EntityRef>
    9 </Body>
    10 </Document>'),
    11 '//EntityRef[text()="Entity2"]',
    12 XMLType('<NewRef>Something New</NewRef>')) from dual;
    UPDATEXML(XMLTYPE('<DOCUMENT><DOCINFO><ENTITYREF>ENTITYNAME</ENTITYREF></DOCINFO
    <Document>
    <DocInfo>
    <EntityRef>EntityName</EntityRef>
    </DocInfo>
    <Body>
    <EntityRef>Entity2</EntityRef>
    </Body>
    </Document>
    Is there a version of something or a pointer or a wrong package or something that I should be looking for? It's acting almost as though the functionality is stubbed out or not casting right or something.
    Here's an even odder deal:
    SQL> set long 100000
    SQL> select updateXML(
    2 xmltype('
    3 <Document>
    4 <DocInfo>
    5 <EntityRef>EntityName</EntityRef>
    6 </DocInfo>
    7 <Body>
    8 <EntityRef>Entity2</EntityRef>
    9 </Body>
    10 </D[i]Long postings are being truncated to ~1 kB at this time.

  • Need help on processing XML doc using Java store procedure

    I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
    --createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
    Thank you in advance if anyone can give some hints.

    I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
    --createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
    Thank you in advance if anyone can give some hints.

  • Compare 2 XML Docs using JAXB

    Hello List,
    I use JAXB for parsing and generating XML docs. It works well after some time to learn to use it.
    But now I want compare 2 xml docs.
    I think the equal function is the right way, but I can't find any implementation from this function in the generated classes.
    Do I look right? Is it possible to compare xml docs with JAXB?
    Any other hints.
    regards Dietmar

    Earlier this year, I needed such a tool and finally wrote one after not being able to find one. It was a lot of work. It compared two DOM documents.
    In our case, we were testing a new server implementation to create XML result files from requests from our client. I connected to a new server and an old server and sent the identical input to both. I then validated the two results using DTD's (which is all we had) and then did a brute force comparison of the two Document objects.
    To make things more difficult, there were some known differences. The new version returned a few new tags and attributes in certain cases. I had to avoid using these as a reason to declare a mismatch. Also, there were timestamps and URLs returned in the files I was processing, so I had to ignore these tags as well.
    Another thing to consider is that attributes do not have to be presented in any sequence, so I had to compare in a non-order-specific way. I built two HashMaps, and first looked up each old attribute in the HashMap for new attributes. If I found a match, I removed this attribute from BOTH HashMaps, when I got to the end, anything lef t over in either HashMap was an orphan.
    It was a lot of work, and my solution is probably not usable outside of its environment, and I don't have permission to release the source anyway.
    Dave Patterson

  • Extract xml file with rowset schema using plsql

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

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

  • XML:selecting the value of a xml tag using plsql

    Hi,
    I have a table xx_table with one of the column xx_column which is of type XMLTYPE.I inserted the xml data into this column with xml data as below.
    <userComments xmlns:ns1="http://xmlns.oracle.com/XXXX_AccountDistribution"
    xmlns="http://xmlns.oracle.com/XXXXX_AccountDistribution">
    <task:userComment
    xmlns:task="http://xmlns.oracle.com/bpel/workflow/task">
    <task:comment>*********** Rejecting invoice **********</task:comment>
    <task:updatedBy>
    <task:id>r</task:id>
    <task:displayName></task:displayName>
    <task:systemVersionFlag></task:systemVersionFlag>
    </task:updatedBy>
    <task:updatedDate>2010-05-19T14:09:15-07:00</task:updatedDate>
    <task:displayNameLanguage></task:displayNameLanguage>
    <task:action></task:action>
    <task:systemVersionFlag></task:systemVersionFlag>
    </task:userComment>
    </userComments>
    My question ,how do i select the value of the tag "comment" from the above xml data using plsql? Can we write a query to select the value of the tag "comment" to fetch "*********** Rejecting invoice **********" as value.
    Regards,
    Sandeep

    If you have rights to modify tabular model then, you can create a measure in your Tabular model which returns previous week and then use this measure in Pivot Table.
    Thanks,
    Sagar K 
    (Blog: http://datamazik.blogspot.in/)

  • Loading Large XML files  using plsql

    I have a process where there is a need to load large xml files (i.e. easily over 500k or more) into Oracle via an interface. Preference would be to use plsql or some plsql based utility if possible. I am looking for any suggestions on the best method to accomplish this. Currently running on 9.2.0.6. Thanks in advance.

    I have a process where there is a need to load large xml files (i.e. easily over 500k or more) into Oracle via an interface. Preference would be to use plsql or some plsql based utility if possible. I am looking for any suggestions on the best method to accomplish this. Currently running on 9.2.0.6. Thanks in advance.

  • Is it possible to create indexes & use them on xml docs with namespaces?

    I have put an XML doc in a BDBXML container which looks like this:
    *<ns1:note xmlns:ns1="http://www.testsch.org/ns">*
    *<ns1:to>Eric</ns1:to>*
    *<ns1:from>Brendan</ns1:from>*
    *<ns1:msg>How r u?</ns1:msg>*
    *</ns1:note>*
    Now, I am creating an index on the element "to", as:
    addIndex "ns1" "to" node-element-equality-string
    Though the index has been shown as getting created using the listIndexes command, if I lookup that index with the following command:
    lookupIndex node-element-equality-string "ns1" "to"
    the output is:
    *0 objects returned for eager index lookup 'node-element-equality-string'*
    Whereas, if I do the whole procedure without the namespaces in the document & the commands, the result is fine:
    *1 object returned for eager index lookup 'node-element-equality-string'*
    Can someone please tell me whether using namespaces, the indexes can be created or not? If yes, how?
    Thanks,
    Dev
    Edited by: user11871332 on Sep 7, 2009 3:53 PM

    Hi Dev,
    When using XML, the prefix for the namespace is really just syntactic sugar. The actual namespace in your example is "http://www.testsch.org/ns", and that's the value that you need to use when creating your index:
    addIndex "http://www.testsch.org/ns" "to" node-element-equality-stringJohn

  • Loading/breaking large files containing multiple XML documents using plsql

    Hi I have a requirement where in the client sends the multiple xml payloads/documents in a single text file. I need to load that into the xmltype varialbe. How to do this?
    I'm able to load the entire document into a clob object, here.. all the xml payloads are loaded into a single row. When I try to access this I get a error
    ORA-31001: Invalid resource handle or path name "/MobileInventoryResponse.dtd"
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1
    This error is due to the dtd present in the xml document : <!DOCTYPE MobileInventoryResponse SYSTEM "MobileInventoryResponse.dtd">
    But if I load the data into a clob after removing the doctype reference then I get the following error. Here to mulitple xml documents are loaded into a single clob row.
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00209: PI names starting with XML are reserved
    Error at line 81
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1
    When try to access this by using select xmltype(x) from t
    where x is column type of clob.
    Please let me know any method or type loading the multiple xml documents by using plsql. Only plsql method. There is a way by using SAX Loader. But can it be used in plsql or its a java method of loading.
    Regards,
    Naveen
    Edited by: MAN on Oct 18, 2008 9:21 PM

    sorry for that...
    There was enter character between some tags. From there I'm not receiving that particular error.
    Now what I get is
    ORA-31001: Invalid resource handle or path name "/MobileInventoryResponse.dtd"
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1
    ORA-06512: at line 39
    This is because there is a doctype at the start of the xml payload.
    But if there is no <!DOCTYPE MobileInventoryResponse SYSTEM "MobileInventoryResponse.dtd"> this statement then it works fine.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE MobileInventoryResponse SYSTEM "MobileInventoryResponse.dtd">
    <MobileInventoryResponse>
    And this exercise I'm doing in my Windows xp loaded operating system with a local instance of oracle ... Do i need to do any other setting.
    Along with that I followed your method mentioned @ Re: LPX-00209: PI names starting with XML are reserved
    ignore:=dbms_xdb.createResource('/MobileInventoryResponse.dtd',bfilename('XML_DIR','MobileInventoryResponse.dtd'));
    And I'm not getting how it will refer the this resource.
    this above partilcular statement . should it be executed when ever we insert into the table ? But in the dtd there is no word saying "MobileInventoryResponse".
    got this error.
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00104: Warning: element "MobileInventoryResponse" is not declared in the DTD
    Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1
    ORA-06512: at line 21
    This is how I'm doing in the block
    DECLARE
    l_filehandle UTL_FILE.FILE_TYPE;
    l_filename VARCHAR2(50):='test.xml';
    l_rec_data VARCHAR2(500);
    l_rec_trim_data VARCHAR2(500);
    l_rec_trim_upper VARCHAR2(500);
    l_rec_full_data CLOB;
    ignore boolean;
    BEGIN
    l_filehandle := UTL_FILE.FOPEN('XML_DIR',l_filename,'R');
    --dbms_xdb.deleteResource('/MobileInventoryResponse.dtd',dbms_xdb.DELETE_RESOURCE   );
    LOOP
    ignore:=dbms_xdb.createResource('/MobileInventoryResponse.dtd',bfilename('XML_DIR','MobileInventoryResponse.dtd'));
    commit;
    UTL_FILE.GET_LINE(l_filehandle, l_rec_data);
    --dbms_output.put_line('l_rec_data : '|| l_rec_data);
    -- Trim the record to remove spaces
    l_rec_trim_data := TRIM(l_rec_data);
    l_rec_trim_upper := UPPER(l_rec_trim_data);
    l_rec_full_data := l_rec_full_data||l_rec_data;
    IF l_rec_trim_upper LIKE '</MOBILEINVENTORYRESPONSE>' THEN
    dbms_output.put_line('l_rec_full_data : '||l_rec_full_data);
    INSERT INTO library_xml VALUES(xmltype(l_rec_full_data));
    l_rec_full_data:=NULL;
    END IF;
    dbms_xdb.deleteResource('/MobileInventoryResponse.dtd',dbms_xdb.DELETE_RESOURCE );
    commit;
    END LOOP;
    UTL_FILE.FCLOSE(l_filehandle);
    COMMIT;
    --exception just for testing purpose
    EXCEPTION
    WHEN no_data_found THEN
    NULL;
    commit;
    END;
    Edited by: MAN on Oct 21, 2008 2:47 AM

  • Conversion of xml doc using xsl

    hai,
    i have a following xml document.i have to write a xsl template which only the content
    between the <FUSIONHUB_MESSAGE> AND </FUSIONHUB_MESSAGE> TAGS.
    CAN ANY BODY GIVE THE TEMPLATE FOR ME ?
    I HAVE WRITTEN A TEMPLATE WHICH IS NOT WORKING PROPERLY.
    HERE IS THE XML DOC:
    <?xml version="1.0"?>
    <FUSIONHUB>
    <FUSIONHUB_INFO>
    <FUSIONHUB_COMPANY_ID>s0001 </FUSIONHUB_COMPANY_ID>
    <FUSIONHUB_REC_COMPANY_ID>r0001</FUSIONHUB_REC_COMPANY_ID>
    <FUSIONHUB_MESSAGE_CATEGORY_CODE>m1</FUSIONHUB_MESSAGE_CATEGORY_CODE>
    </FUSIONHUB_INFO>
    <FUSIONHUB_MESSAGE>
    <SALESORDER>
    <ROW num="1">
    <S_ORDER_NO>o19001</S_ORDER_NO>
    <CLIENT_NO>c00001</CLIENT_NO>
    </ROW>
    <ROW num="2">
    <S_ORDER_NO>o19002</S_ORDER_NO>
    <CLIENT_NO>c00002</CLIENT_NO>
    </ROW>
    </SALESORDER>
    </FUSIONHUB_MESSAGE>
    </FUSIONHUB>
    i just want the output like this:
    <FUSIONHUB_MESSAGE>
    <SALESORDER>
    <ROW num="1">
    <S_ORDER_NO>o19001</S_ORDER_NO>
    <CLIENT_NO>c00001</CLIENT_NO>
    </ROW>
    <ROW num="2">
    <S_ORDER_NO>o19002</S_ORDER_NO>
    <CLIENT_NO>c00002</CLIENT_NO>
    </ROW>
    </SALESORDER>
    </FUSIONHUB_MESSAGE>
    null

    I think your question is wrong.
    XML parser is supposed to check for well-formness of a document, meaning make sure all the tags are open/closed properly. Optionally a parser can perform validations on a document based on its DTD. If there is no DTD available there is no validations required.
    null

Maybe you are looking for

  • ITunes 7.0.2 unknown error [-50]

    I have a 4 gen ipod and was quite happy with it until the weekend. I was using itunes 6 something and had no issues. I decided that I wanted something smaller so I went and bought 2 gig nano. All excited I brought it home and have had nothing but pro

  • If you're ipod shuffle will not turn on....Try this!

    Okay everyone after reading all your posts that were similar to mine I'm hoping that you can also use what woHope this helps others out there with the same issues. Here's my problem....I've got an ipod shuffle that mysteriously stopped playing after

  • Display Mutlisim11 file on Multisim7

    I currently use Multisim11 on my computer but the school I attend uses Multisim7. I have tried to save the file on my computer as a .ms7 and open it at my school but it reads an error. Is there a way to be able to edit my files on multisim7? Is there

  • Using Numbers with Lion and iOS

    Hi, I'm interested in using Numbers to share and update documents across my Apple devices (iMac, Macbook Pro, iPhone and iPad) via iCloud. I have Numbers 09 installed on my iMac and Macbook. I get that I will need to install Numbers on my iPhone and

  • Upgrading from CS5 to 5.5

    I'm frustrated with Adobe over the $400 cost of uprading from CS5 to 5.5. I purchased CS5 for $1500 last March and already am asked to pay another $400 to be compatible with client files. If this were a full upgrade I might understand, but a .5 upgra