Traversing XML Doc

I have an XML Document as follows
<?xml version="1.0" encoding="ISO-8859-1" ?>
<WebInfo>
<Prj>
<Name>TEST</Name>
<Version>0.5</Version>
</Prj>
<!-- === Db Specific Info === -->
<Database name="Db1">
<!-- Min pool size -->
<minPoolSize>10</minPoolSize>
<!-- Database password -->
<password>pass1</password>
<!-- Database login name -->
<loginname>log1</loginname>
</Database>
<Database name="Db2">
<!-- Min pool size -->
<minPoolSize>15</minPoolSize>
<!-- Database password -->
<password>pass2</password>
<!-- Database login name -->
<loginname>log2</loginname>
</Database>
</WebDialog>
I can extract the Prj information ok, by doing the following (in Java):
System.out.println ( xmlDoc.valueOf("//Prj/Name") );
Now I want to extract the Database information. I can get each db name by doing the following:
NodeList aDBs = xmlDoc.selectNodes("//Database");
for (int a=0; a< aDBs.getLength(); a++)
XMLElement aDBElement = (XMLElement)aDBs.item(a);
String DBAlias = aDBElement.getAttribute("name");
System.out.println ("DBNAME = " + DBAlias);
} // for
... but how do I obtain the other information about the database e.g loginname and password?
I'm completely stuck at the moment, and basically guessing, and getting nowhere.
Any info would be gratefully appreciated.
Thanks,
Andy

You're 95% of the way there.
// More efficient to avoid "//" if possible
NodeList aDBs = xmlDoc.selectNodes("/WebInfo/Database");
// More efficient to not call getLength() each time
int matches = aDBs.getLength();
for (int a=0; a < matches; a++)
XMLElement aDBElement = (XMLElement)aDBs.item(a);
String DBAlias = aDBElement.getAttribute("name");
System.out.println ("DBNAME = " + DBAlias);
// Use valueOf() of the aDBElement current node
String minPoolSize = aDBElement.valueOf("minPoolSize"); // Relative XPath expr
String username = aDBElement.valueOf("username"); // Relative XPath expr
// etc.
} // for

Similar Messages

  • 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

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

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

  • Problems while writing xml doc to a  file

    Hi all , in my project (of distributed xml databases) i need to write the xml files from the main server to the clients.
    These xml files i had formed by fragmenting one xml doc and i did the fragmentation using ....
    TransformerFactory tf = TransformerFactory.newInstance();
              Transformer transformer = tf.newTransformer();
              transformer.transform(new DOMSource(root),
              new StreamResult(new FileOutputStream(outputFile)));
    Now the problem is that on the client where these fragments reside..i m not able to do the indexing of the document properly ie...
    some extra text nodes with no values are coming in the index...
    i dont know how to deal wid the extra nodes that i m getting after parsing the file and craeting an index for the same..
    may be its coz of the transformer func i m using....don know(???)
    Note : i m fragmenting the xml files into text files using the above function and then sending thm to the client via sockets.
    Also,after fragmenting i am getting sumthng like
    <?xml version="1.0" encoding="UTF-8"?>
    in all the files..is this a source of any problem....
    plz reply soon....

    You have not described how you "index" the files and what you mean by that.
    Are you processing them with SAX or DOM, or one of the variations of those means?
    Is there a chance that the "extra" nodes are simply text nodes with newlines ("\n")? There are usually a lot of extra text nodes in a file each containing only one newline.
    If you are using SAX, there is no requirement for the parser to collect all of the text inside an element into a single block before calling the characters method. You may get several calls to characters between the start of an element and the end. If you change parsers, you may even get a different number of calls, but the character data will always be the same.
    Dave Patterson
    As to the <?xml version="1.0" encoding="UTF-8"?> line, that is perfectly fine. It means that your file thinks it is valid XML. Whether or not it REALLY is valid depends on a validation of the file.

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

  • Converting XML doc to TreeNode object

    Hi,
    I am trying to build a Tree in Workshop 8.1 using netui:tree tag (for data in
    an XML file).
    The BEA docs say that we have to assign the TreeNode object to the 'tree' attribute
    in the netui:tree tag.
    What is the best way to translate the XML doc into a TreeNode object(s)?
    Thanks, Ajay

    HTML to PDF with Java, using OpenOffice.org - example here: [http://www.dancrintea.ro/html-to-pdf/|http://www.dancrintea.ro/html-to-pdf/]
    You can use OpenOffice.org, running as a server and command it remotely for document convertion.
    Besides HTML to PDF, there are also possible other convertions:
    doc --> pdf, html, txt, rtf
    xls --> pdf, html, csv
    ppt --> pdf, swf
    Code example:
    import officetools.OfficeFile; // this is my tools package
    FileInputStream fis = new FileInputStream(new File("c:/test.html"));
    FileOutputStream fos = new FileOutputStream(new File("c:/test.pdf"));
    // suppose OpenOffice.org runs on localhost, port 8100
    OfficeFile f = new OfficeFile(fis,"localhost","8100", true);
    f.convert(fos,"pdf");
    -----------------------------------------------------------------------------------------------------------------------------------------

  • Table number xrefs disappear when roundtripping the XML doc back to FM

    I'm using FM 7.2p158 running on Windows XP on a Dell Optiplex GX520 with 1GB RAM. I've converted my legacy FM docs to structured FM, but my (CALS-formatted) table number xrefs disappear when I roundtrip the XML docs back to FM. How can I remedy this?
    Initially, I used my own conventions to name the table part elements as I have about 10-15 specific table types and I used those Table Tag names as table elements names (Invisible2, Invisible4, StepTable, ...), so I had 10-15 elements that were true "is fm table element" types in the EDD, DTD, and R/W rules. The table number xrefs worked as they should after roundtripping FM-XML-FM and the tables' shading, ruling, and Table Tags were correct.
    I consulted our XSLT developer for proper browser display of the XML files, and he suggested that I should use the CALS table model. I studied the Struct Dev Gd, then I searched this forum for postings on CALS tables and related topics and used suggestions offered by many of you good folks to create an EDD, DTD, and R/W rules to that end.
    I've run some tests using many iterations of my files (both CALS and non-CALS types) to roundtrip the FM files, but I cannot get the xrefs of the table number from the CALS-version table title element to display when I roundtrip the XML doc and open it in FM. I get this:
    -- In the XML doc text opened in FM, instead of "Table 1-1" for the xref, it leaves a blank space (although the source numbered table title is there).
    -- In the Structure View of the same XML doc, I see the following:
    - The CROSSREF element text says WHITESPACE.
    - Both the CROSSREF element and its source element continue to have the (matching) "Idref" and "Id" number displayed in this view.
    - The Idref attribute is disconnected from the CROSSREF element.
    - The "table" element is disconnected from its container element (TableAnchor).
    Once I apply the File/Import/Element Definitions command in the XML doc in FM, the XML becomes valid and both the CROSSREF Idref attribute and the table element are reconnected, but my xref of the table number is still WHITESPACE.
    The XML-converted doc source text reads:
    If you're using WebDrive, you will want to use the options shown
    in [CROSSREF Idref = "BEHJCAJB" format = "Table Number"/] on the [IndexEntry
    type = "Index" text = "WebDrive options"/]WebDrive control panel.[/Para]
    [TableAnchor]
    [table tabstyle = "Expressroom2" cols = "2"
    colwidths = "2.198in 3.500in" colsep = "1" rowsep = "1"
    frame = "all"]
    [title Id = "BEHJCAJB"][?FM MARKER [Cross-Ref] 86302: TableTitle: Table 1-1
    WebDrive control panel options?]WebDrive login values[/title]
    [tgroup cols = "2" colsep = "1" rowsep = "1"]
    [colspec colnum = "1" colname = "1" colwidth = "2.198in"]
    [/colspec][colspec colnum = "2" colname = "2" colwidth = "3.500in"]
    [/colspec][thead]
    [row rowsep = "1"]
    [entry colname = "1"][CellHeading]Field[/CellHeading][/entry]
    [entry colname = "2"][CellHeading]Value[/CellHeading][/entry]
    [/row]
    [/thead]
    But when I open the same XML-converted doc back in FM, I get the following:
    "If you're using WebDrive, you will want to use the options shown in on the WebDrive control panel."
    The CROSSREF Idref "BEHJCAJB" is [WHITESPACE] in the Structure View, so it's a blank space within the actual text in FM.
    I have excerpts from my EDD, DTD, and R/W rules that I can post, but would make this even more lengthy. (Sorry about the current length.) What do I need to change to make the xrefs work when I roundtrip the files?
    [I don't know whether it makes any difference or not, but I have changed the element names since I originally used a conversion table (to structure my legacy FM files); however, I persisted those element name changes throughout the EDD, DTD, and R/W rules files.]

    I'm using FM 7.2p158 running on Windows XP on a Dell Optiplex GX520 with 1GB RAM. I've converted my legacy FM docs to structured FM, but my (CALS-formatted) table number xrefs disappear when I roundtrip the XML docs back to FM. How can I remedy this?
    Initially, I used my own conventions to name the table part elements as I have about 10-15 specific table types and I used those Table Tag names as table elements names (Invisible2, Invisible4, StepTable, ...), so I had 10-15 elements that were true "is fm table element" types in the EDD, DTD, and R/W rules. The table number xrefs worked as they should after roundtripping FM-XML-FM and the tables' shading, ruling, and Table Tags were correct.
    I consulted our XSLT developer for proper browser display of the XML files, and he suggested that I should use the CALS table model. I studied the Struct Dev Gd, then I searched this forum for postings on CALS tables and related topics and used suggestions offered by many of you good folks to create an EDD, DTD, and R/W rules to that end.
    I've run some tests using many iterations of my files (both CALS and non-CALS types) to roundtrip the FM files, but I cannot get the xrefs of the table number from the CALS-version table title element to display when I roundtrip the XML doc and open it in FM. I get this:
    -- In the XML doc text opened in FM, instead of "Table 1-1" for the xref, it leaves a blank space (although the source numbered table title is there).
    -- In the Structure View of the same XML doc, I see the following:
    - The CROSSREF element text says WHITESPACE.
    - Both the CROSSREF element and its source element continue to have the (matching) "Idref" and "Id" number displayed in this view.
    - The Idref attribute is disconnected from the CROSSREF element.
    - The "table" element is disconnected from its container element (TableAnchor).
    Once I apply the File/Import/Element Definitions command in the XML doc in FM, the XML becomes valid and both the CROSSREF Idref attribute and the table element are reconnected, but my xref of the table number is still WHITESPACE.
    The XML-converted doc source text reads:
    If you're using WebDrive, you will want to use the options shown
    in [CROSSREF Idref = "BEHJCAJB" format = "Table Number"/] on the [IndexEntry
    type = "Index" text = "WebDrive options"/]WebDrive control panel.[/Para]
    [TableAnchor]
    [table tabstyle = "Expressroom2" cols = "2"
    colwidths = "2.198in 3.500in" colsep = "1" rowsep = "1"
    frame = "all"]
    [title Id = "BEHJCAJB"][?FM MARKER [Cross-Ref] 86302: TableTitle: Table 1-1
    WebDrive control panel options?]WebDrive login values[/title]
    [tgroup cols = "2" colsep = "1" rowsep = "1"]
    [colspec colnum = "1" colname = "1" colwidth = "2.198in"]
    [/colspec][colspec colnum = "2" colname = "2" colwidth = "3.500in"]
    [/colspec][thead]
    [row rowsep = "1"]
    [entry colname = "1"][CellHeading]Field[/CellHeading][/entry]
    [entry colname = "2"][CellHeading]Value[/CellHeading][/entry]
    [/row]
    [/thead]
    But when I open the same XML-converted doc back in FM, I get the following:
    "If you're using WebDrive, you will want to use the options shown in on the WebDrive control panel."
    The CROSSREF Idref "BEHJCAJB" is [WHITESPACE] in the Structure View, so it's a blank space within the actual text in FM.
    I have excerpts from my EDD, DTD, and R/W rules that I can post, but would make this even more lengthy. (Sorry about the current length.) What do I need to change to make the xrefs work when I roundtrip the files?
    [I don't know whether it makes any difference or not, but I have changed the element names since I originally used a conversion table (to structure my legacy FM files); however, I persisted those element name changes throughout the EDD, DTD, and R/W rules files.]

Maybe you are looking for

  • MacBook Pro core i7 Logic Board Replacement But ?

    Hi I'm planning on giving my MacBook Pro to Apple to replace the logic board but I have run into a issue Apple are saying they won't give me the old logic board back witch is a bit stupid if my Mac's out of warranty then the logic board belongs to me

  • Deleting a pages template?????

    Can someone please help me locate my pages templates so that I can delete them? I have OS X, Version 10.9 and my templates are Pages '09 version 4.3. I looked in finder for my library but can't seem to locate it, even while holding down the option ke

  • 10.3.9 - 10.4.6 upgrade - now no users!!!!!!!!!! can't login

    I've been running 10.3.9 for a long time with no problems. A recent app needed 10.4. So I puchased 10.4.6 from my local apple dealer. Inserted the disc. Clicked upgrade. Restart - can't login using my root login and password Select change password fr

  • The way to put videos in my ipod HELP PLEASE!!!

    Hello all i just purchased 30gig ipod video, and i have no idea how to put my videos from my digital camera to my ipod. My clips from digital camera are in Windows Media format. Can some one please tell me how to put these in my files into itunes and

  • Pictures don't show up in the movie

    Hi I'm doing my first project with iMovie. The pictures I added from iPhoto don't show up in the movie. Instead it says that the "original clip is missing". I added them as it is explained in the guidelines... Thank you!