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());

Similar Messages

  • 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

  • Need to merge xml o/p from different sources to generate BIP Report from OA page

    Hi,
    Currently in our product Quoting , we are using many VO queries to generate the Report
    Now we have created one data template file to combine all VO queries to generate xml o/p
    The problem we are facing is that we didn't added Contracts VO query in our DT file so we need to merge
    xml o/p coming from DT file and Contracts VO and pass to Process Template XDO api to generate the report
    Please tell how to merge the xml o/p in OAF ?

    Thanks Shridhar for reply ,  you provided code for xml coming from two VO
    but I am having scenario where getting one xml o/p from data template file and seconf xml o/p getting from contracts api as -
    ByteArrayOutputStream l_docXML = new ByteArrayOutputStream(1024);
    // Here getting xml o/p from DT file
    l_docXML = (ByteArrayOutputStream)this.getDataTemplateXML(transaction,"ASO","ASOPD",parameters1,null);
    // Here getting xml o/p from contacts api
    ContractTermsXMLGenerator.writeXML(PrintQuote,
                        (OutputStream) l_conXML,
       true,
       documentType,
       new Number(params[8]),
       new Number("0"));
    // code to merge two xml into one xml m_docXML
    try{
                 if (l_conXML.size() > 0)
                      DOMParser dp = new DOMParser();
                      l_docIP = new ByteArrayInputStream(l_docXML.toByteArray()); 
                      dp.parse(l_docIP);
                      XMLDocument xDoc = dp.getDocument();
                      l_conIP = new ByteArrayInputStream(l_conXML.toByteArray());
                      dp.parse(l_conIP);
       XMLDocument cDoc = dp.getDocument();
       Node cNode = cDoc.getDocumentElement();
                      if (cNode != null)
                           Node xDocConNode = xDoc.adoptNode(cNode);
                           Node conData = xDoc.createElement("CONTRACT_DATA");
                           conData.appendChild(xDocConNode);
                           xDoc.getDocumentElement().appendChild(conData);
                         xDoc.print(m_docXML);
                         writeLog("GenerateCLMDoc::XMLMerge Complete");
               catch(Exception e)
           writeLog("GenerateCLMDoc:: Doc contract XML Merge - " + e.getMessage());
                      throw e;
        finally{
                        l_docIP.close();
                        l_conIP.close();
    Please check if it is correct code , do I need to change it with code provided by you
    can we chat over any messenger ?
    once again thanks for your reply

  • Error While Loading XMl Doc into Oracle Database 10g

    Hi all,
    I have a task that , I have to make a utillity by which we can load XML Doc into a Table. While searching on Internet i found following Procedure on ASK Tom
    CREATE OR REPLACE
    procedure insert_xml_emps(
    p_directory in varchar2, p_filename in varchar2, vtableName in varchar2 )
    as
    v_filelocator bfile;
    v_cloblocator clob;
    l_ctx dbms_xmlsave.ctxType;
    l_rows number;
    begin
    dbms_lob.createtemporary(v_cloblocator,true);
    v_filelocator := bfilename(p_directory, p_filename);
    dbms_lob.open(v_filelocator, dbms_lob.file_readonly);
    DBMS_LOB.LOADFROMFILE(v_cloblocator, v_filelocator,
    dbms_lob.getlength(v_filelocator));
    l_ctx := dbms_xmlsave.newContext(vTableName);
    l_rows := dbms_xmlsave.insertxml(l_ctx,v_cloblocator);
    dbms_xmlsave.closeContext(l_ctx);
    dbms_output.put_line(l_rows || ' rows inserted...');
    dbms_lob.close(v_filelocator);
    DBMS_LOB.FREETEMPORARY(v_cloblocator);
    end ;
    when i try to run this procedure
    BEGIN
    insert_xml_emps('XML_LOAD','load.xml','IBSCOLYTD');
    END;
    it gaves me following Error
    ORA-29532: java call terminated by uncaught java exception : Oracle.xml.sql.OracleXMLSQLException:No
    rows to modify-- the row enclosing tag missing. Specify the correct row enclosing tag.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 115
    ORA-06512: at "EXT_TEST.INSERT_XML_EMPS", line 18
    ORA-06512: at line 2
    Can anyone describe me this error
    Thanks.
    Best Regards.

    SQL> /* Creating Your table */
    SQL> CREATE TABLE IBSCOLYTD
      2  (
      3  ACTNOI VARCHAR2 (8),
      4  MEMONOI NUMBER (7,0),
      5  MEMODTEI DATE,
      6  AMOUNTI NUMBER (8,0),
      7  BRCDSI NUMBER (4,0),
      8  TYPEI NUMBER (4,0),
      9  TRANSMONI NUMBER (6,0)
    10  );
    Table created.
    SQL> CREATE OR REPLACE PROCEDURE insert_xml_emps(p_directory in varchar2,
      2                                              p_filename  in varchar2,
      3                                              vtableName  in varchar2) as
      4    v_filelocator    BFILE;
      5    v_cloblocator    CLOB;
      6    l_ctx            DBMS_XMLSTORE.CTXTYPE;
      7    l_rows           NUMBER;
      8    v_amount_to_load NUMBER;
      9    dest_offset      NUMBER := 1;
    10    src_offset       NUMBER := 1;
    11    lang_context     NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
    12    warning          NUMBER;
    13  BEGIN
    14    dbms_lob.createtemporary(v_cloblocator, true);
    15    v_filelocator := bfilename(p_directory, p_filename);
    16    dbms_lob.open(v_filelocator, dbms_lob.file_readonly);
    17    v_amount_to_load := DBMS_LOB.getlength(v_filelocator);
    18    ---  ***This line is changed*** ---
    19    DBMS_LOB.LOADCLOBFROMFILE(v_cloblocator,
    20                              v_filelocator,
    21                              v_amount_to_load,
    22                              dest_offset,
    23                              src_offset,
    24                              0,
    25                              lang_context,
    26                              warning);
    27 
    28    l_ctx := DBMS_XMLSTORE.newContext(vTableName);
    29    DBMS_XMLSTORE.setRowTag(l_ctx, 'ROWSET');
    30    DBMS_XMLSTORE.setRowTag(l_ctx, 'IBSCOLYTD');
    31    -- clear the update settings
    32    DBMS_XMLStore.clearUpdateColumnList(l_ctx);
    33    -- set the columns to be updated as a list of values
    34    DBMS_XMLStore.setUpdateColumn(l_ctx, 'ACTNOI');
    35    DBMS_XMLStore.setUpdateColumn(l_ctx, 'MEMONOI');
    36    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'MEMODTEI');
    37    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'AMOUNTI');
    38    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'BRCDSI');
    39    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'TYPEI');
    40    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'TRANSMONI');
    41    -- Now insert the doc.
    42    l_rows := DBMS_XMLSTORE.insertxml(l_ctx, v_cloblocator);
    43    DBMS_XMLSTORE.closeContext(l_ctx);
    44    dbms_output.put_line(l_rows || ' rows inserted...');
    45    dbms_lob.close(v_filelocator);
    46    DBMS_LOB.FREETEMPORARY(v_cloblocator);
    47  END;
    48  /
    Procedure created.
    SQL> BEGIN
      2  insert_xml_emps('TEST_DIR','load.xml','IBSCOLYTD');
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM ibscolytd;
    ACTNOI      MEMONOI MEMODTEI     AMOUNTI     BRCDSI      TYPEI  TRANSMONI
    28004125     251942 05-SEP-92        400        513          1          0
    28004125     251943 04-OCT-92        400        513          1          0
    SQL>

  • Generated XML doc file contains comments from MFC source code

    Hello, in my project I use the option /doc to generate XML doc file from my source codes but unfortunately in the output XML file there are mixed also comments from original MFC source codes, see the part of generated xml file:
    Is there a solution to ignore these MFC cpp files?
    Many thanks
    Regards
    Petr Stejskal
    <?xml version="1.0"?>
    <style xmlns="http://www.w3.org/1999/xhtml">@namespace html url(http://www.w3.org/1999/xhtml); :root { font:small Verdana; font-weight: bold; padding: 2em; padding- } * { display: block; padding- } html|style { display: none; } html|span, html|a
    { display: inline; padding: 0; font-weight: normal; text-decoration: none; } html|span.block { display: block; } *[html|hidden], span.block[html|hidden] { display: none; } .expand { display: block; } .expand:before { content: '+'; color: red; } .collapse
    { display: block; } .collapse:before { content: '-'; color: red; } </style><doc><assembly><assembly>       
    "Console"    </assembly></assembly><members><members><member name="T:_RS"><member
    name="T:_RS">Reed-Solomon codec control block</member></member><member name="M:MMask_makeMask(System.Int32,System.Byte*,System.Int32,QRecLevel)"><member
    name="M:MMask_makeMask(System.Int32,System.Byte*,System.Int32,QRecLevel)">Mode indicator. See Table 2 in Appendix 1 of JIS X0510:2004, pp.107.</member></member><member
    name="M:CMFCControlRenderer.IsScaled"><member
    name="M:CMFCControlRenderer.IsScaled"><summary><summary>Tells whether this control
    renderer works with scaled (resized) images.</summary></summary><returns><returns>Returns TRUE if this control
    renderer works with resized (scaled) images.</returns></returns></member></member><member name="M:CMFCControlRenderer.SmoothResize(System.Double)"><member
    name="M:CMFCControlRenderer.SmoothResize(System.Double)"><summary><summary> 
    Smoothly resizes images.</summary></summary><param name="dblScale" /><param
    name="dblScale"> Scale ratio.</param><returns><returns>
    TRUE if resize succeeds; otherwise FALSE.</returns></returns></member></member><member name="M:CDrawingManager.CreateBitmap_32(HBITMAP__*,System.UInt32!System.Runtime.CompilerServices.IsLong)"><member
    name="M:CDrawingManager.CreateBitmap_32(HBITMAP__*,System.UInt32!System.Runtime.CompilerServices.IsLong)"><summary><summary>
    Creates a 32 bit bitmap from the specified bitmap.</summary></summary><returns><returns> A handle to created
    bitmap, or NULL, if creation fails.</returns></returns><param name="bitmap" /><param
    name="bitmap"> A handle to the original bitmap.</param><param name="clrTransparent"
    /><param
    name="clrTransparent"> An RGB value specifying transparent color of the original bitmap.</param></member></member><member
    name="M:CDrawingManager.CreateBitmap_32(CSize!System.Runtime.CompilerServices.IsConst*!System.Runtime.CompilerServices.IsImplicitlyDereferenced,System.Void**)"><member
    name="M:CDrawingManager.CreateBitmap_32(CSize!System.Runtime.CompilerServices.IsConst*!System.Runtime.CompilerServices.IsImplicitlyDereferenced,System.Void**)"><summary><summary>
    Creates an empty 32 bit bitmap.</summary></summary><returns><returns> A handle to created bitmap, or NULL,
    if creation fails.</returns></returns><param name="size" /><param
    name="size">Specifies bitmap size.</param><param name="pBits" /><param
    name="pBits">When the function returns contains a pointer to bitmap bits.</param></member></member><member
    name="M:CDrawingManager.DrawRotated(CRect,CDC*!System.Runtime.CompilerServices.IsImplicitlyDereferenced,System.Int32)"><member
    name="M:CDrawingManager.DrawRotated(CRect,CDC*!System.Runtime.CompilerServices.IsImplicitlyDereferenced,System.Int32)"><summary><summary>Rotates
    a source DC content inside the given rectangle by +/- 90 degrees</summary></summary><param name="rectDest" /><param
    name="rectDest">Destination rectangle</param><param name="dcSrc" /><param
    name="dcSrc">The source device content.</param><param name="bClockWise"
    /><param
    name="bClockWise">TRUE - rotate +90 degrees, FALSE - 90.</param></member></member><member
    name="M:AfxRegDeleteKey(HKEY__*,System.Char!System.Runtime.CompilerServices.IsConst*,ATL.CAtlTransactionManager*)"><member
    name="M:AfxRegDeleteKey(HKEY__*,System.Char!System.Runtime.CompilerServices.IsConst*,ATL.CAtlTransactionManager*)"><summary><summary>Deletes
    the specified registry key.</summary></summary><returns><returns>  If the function succeeds, the return
    value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h</returns></returns><param name="hKey" /><param
    name="hKey">A handle to an open registry key.</param><param name="lpSubKey"
    /><param
    name="lpSubKey">The name of the key to be deleted.</param><param name="pTM" /><param
    name="pTM">Pointer to CAtlTransactionManager object</param></member></member><member
    name="M:AfxRegOpenKeyEx(HKEY__*,System.Char!System.Runtime.CompilerServices.IsConst*,System.UInt32!System.Runtime.CompilerServices.IsLong,System.UInt32!System.Runtime.CompilerServices.IsLong,HKEY__**,ATL.CAtlTransactionManager*)"><member
    name="M:AfxRegOpenKeyEx(HKEY__*,System.Char!System.Runtime.CompilerServices.IsConst*,System.UInt32!System.Runtime.CompilerServices.IsLong,System.UInt32!System.Runtime.CompilerServices.IsLong,HKEY__**,ATL.CAtlTransactionManager*)"><summary><summary>Opens
    the specified registry key.</summary></summary><returns><returns>  If the function succeeds, the return
    value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in Winerror.h</returns></returns><param name="hKey" /><param
    name="hKey">A handle to an open registry key.</param><param name="lpSubKey"
    /><param
    name="lpSubKey">The name of a key that this function opens or creates.</param><param name="ulOptions"
    /><param
    name="ulOptions">This parameter is reserved and must be zero.</param><param name="samDesired" /><param
    name="samDesired">A mask that specifies the desired access rights to the key.</param><param
    name="phkResult" /><param
    name="phkResult">A pointer to a variable that receives a handle to the openedkey.</param><param
    name="pTM" /><param
    name="pTM">Pointer to CAtlTransactionManager object</param></member></member></members>

    Hi stejsky,
    Thank you for posting in MSDN forum.
    >>In my project I use the option /doc to generate XML doc file from my source codes but unfortunately in the output XML file there are mixed also comments from original MFC source codes.
    Based on your issue, could you please tell me how you use the option /doc to generate XML doc file from your source codes?
    If you use the option /doc to generate the XML doc file by right-click the your MFC project->Properties->Configuration Properties->C/C++->Output file->set the Generate XML document files as Yes(/doc) like the following screen shot.
    (1)If yes, since we could not reproduce your issue in mu side, so if possible, I suggest you could share me your MFC project so that we will further help you support this issue.
    You could upload your MFC project to the OneDrive and then copy link here.
    (2)If no, please try the above way to generate XML doc file and then check if you still get same issue.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Repository event handler doesn't work when inserting an xml-doc via ftp

    Hi,
    I want to add a 'schemaLocation'-attribute to an XML-document when I load it in the repository. Therefore, I use the precreate-repository event and created a Repository Event Handler (see code extract below).
    Everything works fine if I type the following code in SQL Plus:
    Declare
    v_return BOOLEAN;
    Begin
    v_return:=DBMS_XDB.createresource('/public/xml/test.xml', XMLType(bfilename('XMLDIR', 'test.xml'),nls_charset_id('AL32UTF8')));
    end;Unfortunately, when I try to insert an XML-document via ftp into the /public/xml folder it doesn´t work as expected and no 'schemaLocation'-attribute is added to the new resource.
    What's the reason for this strange behavior and how can I solve it?
    For your information: I use the Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
    Thank you very much for your help!!!
    Repository Event Handler code extract:_
    create or replace
    PACKAGE BODY schemalocation AS
    PROCEDURE handlePreCreate (eventObject DBMS_XEVENT.XDBRepositoryEvent) AS
    XDBResourceObj DBMS_XDBRESOURCE.XDBResource;
    var XMLType;
    l_return BOOLEAN;
    l_xmldoc dbms_xmldom.DOMDocument;
    l_docelem dbms_xmldom.DOMElement;
    l_attr dbms_xmldom.DOMAttr;
    c1 clob;
    node     dbms_xmldom.DOMNode;
    txid varchar2(100);
    dDoc DBMS_XMLDOM.DOMDocument;
    nlNodeList DBMS_XMLDOM.DOMNodeList;
    BEGIN
    XDBResourceObj := DBMS_XEVENT.getResource(eventObject);
    dbms_lob.createTemporary(c1,TRUE);
    var:=DBMS_XDBRESOURCE.getcontentxml(XDBResourceObj);
    l_xmldoc := dbms_xmldom.newDOMDocument(var);
    l_docelem := DBMS_XMLDOM.getDocumentElement(l_xmldoc);
    ------ add schemaLocation attribute
    l_attr := DBMS_XMLDOM.createAttribute(l_xmldoc, 'xsi:schemaLocation');
    DBMS_XMLDOM.setValue(l_attr, 'urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd');
    l_attr := DBMS_XMLDOM.setAttributeNode(l_docelem, l_attr);
    DBMS_XMLDOM.WRITETOCLOB(l_xmldoc, c1);
    ------- get the value of the TxId-tag
    dDoc := DBMS_XMLDOM.NEWDOMDOCUMENT(c1);
    nlNodeList := DBMS_XMLDOM.GETELEMENTSBYTAGNAME(dDoc, 'TxId');
    node := DBMS_XMLDOM.ITEM(nlNodeList, 0);
    txid:= dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(node));
    l_return:=DBMS_XDB.createresource('/public/ok/'||txid||'.xml', XMLType(c1));
    END;

    Marco,
    Here's an example of the problem :
    create or replace package handle_events
    as
      procedure handlePreCreate(p_event dbms_xevent.XDBRepositoryEvent);
    end;
    create or replace package body handle_events
    is
    procedure handlePreCreate (p_event dbms_xevent.XDBRepositoryEvent)
    is
      XDBResourceObj dbms_xdbresource.XDBResource;
      doc XMLType;
      res boolean;
    begin
      XDBResourceObj := dbms_xevent.getResource(p_event);
      doc := dbms_xdbresource.getContentXML(XDBResourceObj);
      select insertchildxml(
        doc
      , '/root'
      , '@xsi:schemaLocation'
      , 'urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd'
      , 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
      into doc
      from dual;
      res := dbms_xdb.CreateResource('/public/xml/result.xml', doc);
    end;
    end;
    declare
    res boolean;
    begin
    res := dbms_xdb.CreateFolder('/public');
    res := dbms_xdb.CreateFolder('/public/tmp');
    res := dbms_xdb.CreateFolder('/public/xml');
    end;
    declare
    res            boolean;
    resconfig      xmltype;
    my_schema      varchar2(30) := 'DEV';
    resconfig_path varchar2(300) := '/public/ResConfig.xml';
    resource_path  varchar2(300) := '/public/tmp';
    begin
      resconfig  := xmltype(
    '<ResConfig xmlns="http://xmlns.oracle.com/xdb/XDBResConfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/XDBResConfig.xsd http://xmlns.oracle.com/xdb/XDBResConfig.xsd">
      <event-listeners set-invoker="true">
        <listener>
          <description>My event handler</description>
          <schema>'||my_schema||'</schema>
          <source>HANDLE_EVENTS</source>
          <language>PL/SQL</language>
          <events>
            <Pre-Create/>
          </events>
          <pre-condition>
            <existsNode>
              <XPath>/r:Resource[r:ContentType="text/xml"]</XPath>
              <namespace>xmlns:r="http://xmlns.oracle.com/xdb/XDBResource.xsd"</namespace>
            </existsNode>
          </pre-condition>
        </listener>
      </event-listeners>
      <defaultChildConfig>
        <configuration>
          <path>'||resconfig_path||'</path>
        </configuration>
      </defaultChildConfig>
    </ResConfig>'
      res := dbms_xdb.CreateResource(resconfig_path, resconfig);
      dbms_resconfig.addResConfig(resource_path, resconfig_path, null);
    end;
    /Giving the following input XML file :
    <?xml version="1.0" encoding="utf-8"?>
    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>This works :
    SQL> declare
      2    res boolean;
      3  begin
      4    res := dbms_xdb.CreateResource('/public/tmp/test.xml',
      5               xmltype(bfilename('TEST_DIR','test.xml'), nls_charset_id('AL32UTF8')));
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SQL> select XMLSerialize(document xdburitype('/public/xml/result.xml').getXML()
    as clob indent size = 2)  result
      2  from dual
      3  ;
    RESULT
    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
    urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd
    "/>With the same document loaded via FTP, we get :
    SQL> select XMLSerialize(document xdburitype('/public/xml/result.xml').getXML()
    as clob indent size = 2)  result
      2  from dual
      3  ;
    ERROR:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00283: document encoding is UTF-16-based but default input encoding is not
    Error at line 1
    no rows selectedand the content looks like :
    < ? x m l   v e r s i o n = " 1 . 0 "   e n c o d i n g = " u t f - 8 " ? >
    < r o o t   x m l n s : x s i = " h t t p : / / w w w . w 3 . o r g / 2 0 0 1 / X M L S c h e m a - i n s t a n c e " / >As a workaround, I've found that serializing and re-parsing the document solves the problem :
      select insertchildxml(
        xmltype(doc.getclobval())
      , '/root'
      , '@xsi:schemaLocation'
      , 'urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd'
      , 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
      into doc
      from dual;
    ...We then get the expected result after FTP transfer :
    SQL> select XMLSerialize(document xdburitype('/public/xml/result.xml').getXML()
    as clob indent size = 2)  result
      2  from dual
      3  ;
    RESULT
    <?xml version="1.0" encoding="UTF-8"?>
    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
    urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd
    "/>The workaround also works for the DOM version presented above.
    Any ideas?

  • Java stored proc performance parsing XML docs

    Hi
    We are using ORACLE 8i(8.1.6). I have a JAVA Stored procedure that parses XML doc and returns tha values. If I am testing on the box, I get an avg. return time of 2 secs. If I have 20 users, my return time for all went to 25 to 35 secs?
    Are there any parameters on ORACLE I can modify to increase the performance. We are developing app for 1000 to 1500 users. I dont want to guess the time based on my test with 20 users.
    Any help will be greatly appreciated.
    Thank You
    Raju

    Raju,
    Oracle 8.1.7 should be better choice for you since it does have the XML stuff
    natively compiled.
    Regarding scaleability the JVM should scale
    very well. However let us know what you find.
    - Stefan

  • Problem inserting XML doc (character set)

    Hi all,
    I'm having trouble trying to insert XML either "posting" it (xsql) or "putting" it
    (OracleXML putXML).
    The error that I get: "not supported
    oracle-character-set-174".
    The environment is:
    Oracle 8i 8.1.5
    (NLS_CHARACTERSET EL8MSWIN1253 for greek)
    JDK 1.2.2
    Apache Web Server 1.3.11
    Apache JServ 1.1
    XSQL v 0.9.9.1 and
    XMLSQL, XML parser v2 that comes with it.
    I had dropped all java classes and reloaded
    them using oraclexmlsqlload batch file.
    But still getting the same error.
    The thing that is that I am
    able to insert XML doc that was generated
    with an authoring tool called W4F that extracts data from HTML pages and map them to
    XML document, even with greek characters
    in it. But when XML is generated using
    an editor or the servlet like the following:
    newschedule.xsql like
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="latestschedules.xsl"?>
    <page connection="dtv" xmlns:xsql="urn:oracle-xsql">
    <xsql:insert-request date-format="DD'/'MM'/'YYYY" table="schedule_details_view"
    transform="request-to-newschedule.xsl"/>
    <xsql:query table="schedule"
    tag-case="lower" max-rows="5" rowset-element="latestschedules"
    row-element="schedule">
    select *
    from schedules
    order by schedule_id desc
    </xsql:query>
    </page>
    request-to-newschedule.xsl like
    <?xml version = '1.0'?>
    <ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0">
    <xsl:for-each select="request/parameters">
    <ROW>
    <SCHEDULE_ID><xsl:value-of select="Schedule_id_field"/></SCHEDULE_ID>
    <DESCRIPTION><xsl:value-of select="Description_field"/></DESCRIPTION>
    <DETAILS>
    <DETAILS_ITEM>
    <STARTING_TIME><xsl:value-of select="Starting_Time_field_1"/></STARTING_TIME>
    <DURATION><xsl:value-of select="Duration_field_1"/></DURATION>
    </DETAILS_ITEM>
    <DETAILS_ITEM>
    <STARTING_TIME><xsl:value-of select="Starting_Time_field_2"/></STARTING_TIME>
    <DURATION><xsl:value-of select="Duration_field_2"/></DURATION>
    </DETAILS_ITEM>
    <DETAILS_ITEM>
    <STARTING_TIME><xsl:value-of select="Starting_Time_field_3"/></STARTING_TIME>
    <DURATION><xsl:value-of select="Duration_field_3"/></DURATION>
    </DETAILS_ITEM>
    <DETAILS_ITEM>
    <STARTING_TIME><xsl:value-of select="Starting_Time_field_4"/></STARTING_TIME>
    <DURATION><xsl:value-of select="Duration_field_4"/></DURATION>
    </DETAILS_ITEM>
    <DETAILS_ITEM>
    <STARTING_TIME><xsl:value-of select="Starting_Time_field_5"/></STARTING_TIME>
    <DURATION><xsl:value-of select="Duration_field_5"/></DURATION>
    </DETAILS_ITEM>
    </DETAILS>
    </ROW>
    </xsl:for-each>
    </ROWSET>
    Hope that someone could help me on this ...
    Any advice is highly appreciated.
    Thanks in advance
    Nicos Gabrielides
    email: [email protected]

    Hi,
    How about applying an XSL on the existing XML doc to create another XML doc to filter out the table column not found in the target db table, so that all the columns are matched and then use putXML to load?
    Hope that helps.
    OTN team@IDC

  • Merging XML and XDP files

    Hello!
    I must build this POC for a client and the idea is merge XML and XPD files to feed a LiveCycle Output process and create PDF files.
    I've built the XDP files and the XML to start things, now I need to figure out how to create the process to merge them in Workbench.
    Is there any tutorial to help me with this task?
    Thank you for any ideas!
    Marcos

    Thank you guys for helping a beginner in trouble.
    I hope I will soon be able to help others here and help the comnunity.
    Right now, I've so much to learn!
    Thank you!
    Marcos, Brazil

  • 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.

  • How to show an XML doc's node?/element in a dynamic textbox?

    Hello!
    I would like to show an XML doc's node?/element in a textbox. I am importing the XML data from a PHP page. My code looks like this:
    var xmlRequest:URLRequest = new URLRequest("adatatvitel.php");
    var xmlLoader:URLLoader = new URLLoader(xmlRequest);
    xmlLoader.addEventListener(Event.COMPLETE, init);
    function init(e:Event):void{ 
      var xmlDoc:XMLDocument = new XMLDocument();
      xmlDoc.ignoreWhite = true;
      var datasXML:XML = XML(xmlLoader.data);
      xmlDoc.parseXML(datasXML.toXMLString());
    This program would be a quiz. First I would like to write out the first data: Question with the appropriate Answers. If the player's answer is correct, the program would show the second set.  Thanks in advance!
    Here is my PHP code:
    <?php
    require("db.php");
    $sql = "SELECT * FROM kerdesvalasz";
    $result = mysql_query($sql) or die(mysql_error());
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    echo "<datas>";
    while($row = mysql_fetch_array($result))
      echo '<data>';
      echo '<question>'.$row['kerdes'].'</question>';
      echo '<answer1>'.$row['valasz1'].'</answer1>';
      echo '<answer2>'.$row['valasz2'].'</answer2>';
      echo '<answer3>'.$row['valasz3'].'</answer3>';
      echo '<answer4>'.$row['valasz4'].'</answer4>';
      echo '<correct>'.$row['helyes'].'</correct>';
      echo '</data>';
    echo "</datas>";
    ?>

    Hi Taly,
    Florian is right, you need to knwo / set a maximum columns ( i assumed he actually mean column) so that content being displayed will be visible on form.
    I would suggest you to reaccess to your solution again if this design and think what if you have 999 columns, how do you want to display the content in form .
    I would suggest to transpose your content to display as row in form, and let the content to flow.
    This should solve your issue.
    Hope this helps.
    regards,
    Xiang Li

  • I got an email with a XML doc and can't open it?

    How or can i open an XML doc in an email. I downloaded it but can't get it open.

    I would ask them for a file in a format that is commonly used, like PDF.
    I really don't think that is what they intended to send to you.
    There isn't a defined program to "open" an XML document, so expecting someone to be able to open and sign it is pretty silly.  XML is unformatted data. See here: http://www.w3schools.com/xml/default.asp
    The likely have a program that creates forms using XML. They sent you the raw markup instead of exporting it to a PDF or other useful format.

  • Capture data in 1D barcode upon merging XML with XDP?

    Hi,
    The scenario is:
    Forms Server 7.2.2 is being used for merging XML data with an XDP file to render a PDF (displaying a pre-filled form to user).
    On the XDP, there is a 1D Barcode and few fields are mapped to this barcode (the barcode is intended to capture form identification information).
    Upon merging, the barcode should capture the data of those fields (data is being fetched from a db and fed as XML to Forms server). This is required as the pre-filled form will be printed and then mailed to another location, where the barcode will be read using a decoder to capture form indentification.
    Will the 1D barcode captures data from those fields, after merging XML with XDP?
    The form is NOT Reader Extended. Is Reader Extending a necessity for enabling 1D barcode to capture data?
    Is this also applicable for 2D barcodes?
    Thanks a lot for your help! :)

    Thank you Hodmi,
    I had forgotten to define the Record name parameter in the PDF Output Options.
    As the XML structure changed, not upating this parameter was preventing the process from working.
    Now it is working just fine. Thank you!
    Marcos

  • 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.

  • Has anybody tried creating and validating a XML doc with XML Schema?

    Hi,
    Has anybody tried creating and validating a XML doc with XML Schema?

    With XMLBeans, an XML document may be created from and validated with an XML schema.

Maybe you are looking for