Reading XML document

Hey programmers,.

I opened a thread yesterday regarding recovery code XML from a server (http://supportforums.blackberry.com/t5/Java-Development/How-to-retrieve-XML-from-server-response/m-p...) and got several nice answers and so I thought that the problem had disappeared. In fact, he only changed form.

So I have another question for you: how to recover data from a Document and display it on the screen?

Number of points:

-J' tried function getType() as suggested in the post mentioned, I get a text/xml response.

-J' have tried to use the getTextContent() on the document to put it in a TextField, it might be a rookie mistake.

-J' I tried to put my stream to a string, but then I get something like "rim.blabla.blabla@812371".

-J' tried to simply open a dialog with the document.getTextContent () method, but a dialog box empty is displayed.

-J' read this post (http://supportforums.blackberry.com/t5/Java-Development/cannot-read-nodes-in-xml/m-p/324562), I would do something like this to read my XML?

Here are some relevant parts of my code (_http is my connection):

DocumentBuilderFactory plant = DocumentBuilderFactory.newInstance ();
DocumentBuilder builder = factory.newDocumentBuilder ();
Doc document = builder.parse (_http.openInputStream ());
_HTTP. Close();

If (doc! = null) Dialog.inform ("reading the document"); Which appears still, so I guess that is not null

I don't really know much to XML and any help would be much appreciated.

Yet once, I give a lot of congratulations!

I got my answer, it works when adapt you the code in XMLDemo with the solution provided by Jcarty in the post mentioned in the original post.

In the end, it came to this:

-Open the connection http and everything

-retrieve data with:

DocumentBuilderFactory plant = DocumentBuilderFactory.newInstance ();
DocumentBuilder builder = factory.newDocumentBuilder ();
Doc document = builder.parse (_http.openInputStream ());
_HTTP. Close();

-change the constructor of the XMLDemoScreen class so there Document as an argument:

public XMLDemoScreen (Document doc) {...}

-change the document acquired the manufacturer as:

Document document = doc;

But I suspect that it worked because the XML was fairly simple.

In any case, thank you very much for your help Simon, Bravo to you as promised...

Tags: BlackBerry Developers

Similar Questions

  • XSL file to format XML Document

    Hey programmers,.

    This thread is referring to this one (http://supportforums.blackberry.com/t5/Java-Development/Reading-XML-document/m-p/512637) which was resolved yesterday.

    A little history: I ripped with success of XML from a server in response to a post message, I was able to put it inside a document using InputStream and was able to read the text content of this XML on the Blackberry screen.

    Now I would use a .xsl file to format the XML document and then display it on the screen as HTML. Is this possible? How would I go to do this?

    I found this piece of code on the internet (java, not specific to the blackberry associated):

    public class CreationHTML {}
    public static void createHTML (xml, xsl string string, string html) bird Exception {}
    Create the source of DOM
    DocumentBuilderFactory FabriqueD = DocumentBuilderFactory.newInstance ();
    DocumentBuilder builder = fabriqueD.newDocumentBuilder ();
    File fileXml = new File (xml);
    Document document = builder.parse (fileXml);
    Source source = new DOMSource (text);

    Creation of the output file
    File fileHtml = new File (html);
    Result result = new StreamResult (fileHtml);

    Configuration of the transformer
    FabriqueT TransformerFactory = TransformerFactory.newInstance ();
    StreamSource stylesource = new StreamSource (xsl);
    Transformer transformer = fabriqueT.newTransformer (stylesource);
    transformer.setOutputProperty (OutputKeys.METHOD, "html");
            
    Transformation
    transform. Transform (source, result);
    }
    Public Shared Sub main (String [] args) {}
    try {}
    createHTML ("Annuaire.xml", "Annuaire.xsl", "Annuaire.html");
    } catch (Exception e) {e.printStackTrace () ;}
    }
    }

    But actually I have a .xsl, not a string file, do you think that I could adapt it to meet my needs?

    Many thanks for any help!

    If you implement TransformerFactory on blackberry: sure, no problem.

    In the opposite case: rather not.

  • Reading XML using java

    Hi all
    To read XML document is:

    < customer name = 'A' >
    FA1 < FileToBeProcessed > < / FileToBeProcessed >
    FA2 < FileToBeProcessed > < / FileToBeProcessed >
    SA3 < FileToBeProcessed > < / FileToBeProcessed >
    < / customer >

    < customer name = "B" >
    FB1 < FileToBeProcessed > < / FileToBeProcessed >
    FB2 < FileToBeProcessed > < / FileToBeProcessed >
    FB3 < FileToBeProcessed > < / FileToBeProcessed >
    < / customer >


    I want to get all the names of files to be treated by A client in an array of java. How can I read and search in this type of xml file using java?

    If this is then can not the correct way of writing in xml you suggest other alternative and corresponding Java solutions to read this kind of xml format?

    Thanks in advance... :-)

    Take a look at javax.xml.xpath. Very suitable for this type of application.

  • XML document read by DOM

    I'm reading an XML document, like this:

    declare
    XMLType xml_doc: = httpuritype('http://xxx.xx.x.xxx/temp/document.xml').getxml();

    Start
    insert into tablekode (kode, kodeliste, kodetext)
    Select * from xmltable ("Datenexport/Entry" passing xml_doc columns
    path varchar2 (20) of kode "Code."
    kodeliste number path "Nr."
    kodetext varchar2 (2000) path "Decodierung");
    end;

    It works very well.
    But I want to read the XML document whis DOM because I want to use a while loop
    and want / need to work hasNext element.
    Unfortunately, I've found so far no proper documentation.
    Maybe someone has a link or an example for me?

    You mean like this?

    SQL> SELECT x1.codelist
      2       , x2.*
      3  FROM XMLTable(
      4   '$doc/Datenexport/Codeliste'
      5   passing xmltype(:xmldoc) as "doc"
      6   columns codelist number path '@Nr'
      7         , entries  xmltype path 'Entry'
      8  ) x1,
      9  XMLTable(
     10   'for $i in /Entry
     11    return
     12     for $j in $i/child::*
     13     let $d := local-name($j)
     14     where substring-before($d,"_") = "Decodierung"
     15     return element r {
     16       $i/Code
     17     , element Lang {substring-after($d,"_")}
     18     , element CodeText {$j/text()}
     19     }'
     20   passing x1.entries
     21   columns
     22     code   varchar2(20)   path 'Code'
     23   , speech varchar2(2)    path 'Lang'
     24   , text   varchar2(2000) path 'CodeText'
     25  ) x2
     26  WHERE codelist = 3
     27  AND code = 'AD'
     28  ;
    
      CODELIST CODE                 SPEECH TEXT
    ---------- -------------------- ------ ---------------------------------
             3 AD                   DE     Andorra
             3 AD                   EN     Andorra
     
    
  • I really need professional help in the analysis of XML to the XML Document, or I want to read XML

    Hi all

    I'm really looking for your sweet help. I have suffered for two days. I'm working on Blackberry java app. I have the xml file is located in "file:///store/home/user/myNotes.xml".

    I want to be able to parse the XML into XMLDocument to confront the NodeList and ChildNode.

    I always get Eception Exception RunTimeError

    NOTE the following prayer:

    1 - my JDK is 1.7.0.5.5 (SE) only

    2. I don't have "XMLSerializer" or "Transformer", or "TransformerFactory', 'KXML.

    3. all I want is just to be able to read XML above and analyzed to XMLDocument.

    Find my Java code below:

    =====================================================================================

    Private Sub parseXmlFile() raises {RuntimeException
    try {}

    XMLDocument DOM = null;
    private static final String fileN = "file:///store/home/user/myNotes.xml";
    FileConnection fc = (FileConnection) Connector.open (fileN);
    fc.openDataInputStream ();
    DocumentBuilderFactory plant = DocumentBuilderFactory.newInstance ();
    DocumentBuilder builder = factory.newDocumentBuilder ();
    InputStream is = getClass () .getResourceAsStream (fileN);
    DOM = builder.parse (is);
        
    } catch (Exception pce) {}
    Dialog.Alert (PCE. ToString());
    }
            
    }

    ======================================================================

    End of my Code

    Thank you very much for your time of reading and you answer to help me.

    I appreciate really.

    Dear all,

    Hello and thank you from the bottom of my heart. This works. My problem was absent "normalization."

    Thank you once again I ng3epa enjoyed your valuable contribution.

  • ORA-03113 "reading" XML of CLOB

    Hello

    I use XMLTable for reading XML to insert data into the DB table. I have:

    PROCEDURE IMPORT_XML)

    p_plik VARCHAR2,

    p_tp_id NUMBER,

    number of p_commit_po: = 500) IS

    l_blob_id TERYT_PLIKI.tp_blob_id%type;

    l_blob BLOB;

    XMLTYpe l_teryt_xml;

    L_Name varchar2 (100);

    l_type varchar2 (100);

    l_date varchar2 (100);

    -l_part varchar2 (100);

    XMLType l_rows;

    l_commit number (6);

    l_cnt_rows NUMBER: = 0;

    procedure do_commit is

    Start

    l_commit: = l_commit + 1;

    l_cnt_rows: = l_cnt_rows + 1;

    If l_commit > = p_commit_po then

    commit;

    l_commit: = 0;

    end if;

    end do_commit;

    BEGIN

    -# variable l_BLOB contains BLOB from a column of table #.

    Err.d ("convert BLOB CLOB type...', 'IMPORT_XML', 70 ');

    declare

    dest_lob CLOB.

    src_lob BLOB;

    the sum integer: = DBMS_LOB. LOBMAXSIZE;

    dest_offset integer: = 1;

    offset integer: = 1;

    number of blob_csid: = nls_charset_id ('AL32UTF8');

    lang_context integer: = 0;

    the warning integer: = DBMS_LOB. WARN_INCONVERTIBLE_CHAR;

    Start

    dest_lob: = empty_Clob();

    DBMS_LOB. CREATETEMPORARY (dest_lob, false);

    DBMS_LOB. OPEN (dest_lob, DBMS_LOB. LOB_READWRITE);

    DBMS_LOB. OPEN (l_blob, DBMS_LOB. LOB_READONLY);

    DBMS_LOB. () CONVERTTOCLOB

    dest_lob,

    l_blob,

    amount,

    dest_offset,

    offset,

    blob_csid,

    lang_context,

    (caveat);

    DBMS_LOB. Close (l_blob);

    l_teryt_xml: = XMLType (dest_lob);

    commit;

    DBMS_LOB. FREETEMPORARY (dest_lob);

    end;

    l_rows: = l_teryt_xml.extract('/teryt/catalog/row');

    l_commit: = 0;

    If l_name = "TERC" then

    Err.d ("name =" |) L_Name, cm, 80);

    for r in (SELECT x.*

    FROM XMLTable ('/ rank ' ADOPTION l_rows)

    ["COLUMNS"WOJ"PATH of the VARCHAR2 (20) ' col[@name="WOJ "]',

    ["VARCHAR2 (20)"POW"PATH" col[@name="POW"]',

    ["Path"GMI"VARCHAR2 (20) ' col[@name="GMI "]',

    PATH of VARCHAR2 (2) "RODZ" "col[@name="RODZ"]',"

    PATH of VARCHAR2 (50) "NAME" "col[@name="NAZWA"]',"

    PATH of VARCHAR2 (50) "NAZDOD" "col[@name="NAZDOD"]',"

    "[" "STAN_NA PATH" VARCHAR2 (10) ' col[@name="STAN_NA"] "

    ) x

    ) loop

    INSERT INTO TERYT_TERC (WOJ, POW, GMI, RODZ, NAME, NAZDOD, STAN_NA, TP_ID)

    VALUES (r.WOJ, r.POW, r.GMI, r.RODZ, r.NAZWA, r.NAZDOD, r.STAN_NA, P_TP_ID);

    do_commit;

    end loop;

    elsif l_name = "SIMC" then

    Err.d ("name =" |) L_Name, cm, 80);

    for r in (SELECT x.*

    FROM XMLTable ('/ rank ' ADOPTION l_rows)

    "WOJ" VARCHAR2 COLUMNS (3) path "col[@name="WOJ"]',"

    ["" POW"VARCHAR2 (3) path" col[@name="POW"]',

    "GMI" VARCHAR2 (3) PATH "col[@name="GMI"]',"

    PATH of VARCHAR2 (2) "RODZ_GMI" "col[@name="RODZ_GMI"]',"

    ["" RM"VARCHAR2 (3) path" col[@name="RM"]',

    "MZ' VARCHAR2 (3) PATH" col[@name="MZ"]', "

    PATH of VARCHAR2 (60) "NAME" "col[@name="NAZWA"]',"

    "SYM' VARCHAR2 (7) PATH" col[@name="SYM"]', "

    PATH of VARCHAR2 (7) "SYMPOD" "col[@name="SYMPOD"]',"

    PATH of VARCHAR2 (10) "STAN_NA" "col[@name="STAN_NA"]"

    ) x

    ) loop

    INSERT INTO TERYT_SIMC (WOJ, POW, GMI, RODZ_GMI, RM, MZ, NAME, SYMBOL, SYMPOD, STAN_NA, TP_ID)

    VALUES (r.WOJ, r.POW, r.GMI, r.RODZ_GMI, r.RM, r.MZ, r.NAZWA, r.SYM, r.SYMPOD, r.STAN_NA, P_TP_ID);

    do_commit;

    end loop;

    elsif l_name = "ULIC" then

    Err.d ("name =" |) L_Name, cm, 80);

    for r in (SELECT x.*

    FROM XMLTable ('/ rank ' ADOPTION l_rows)

    "WOJ" VARCHAR2 COLUMNS (3) path "col[@name="WOJ"]',"

    ["" POW"VARCHAR2 (3) path" col[@name="POW"]',

    "GMI" VARCHAR2 (3) PATH "col[@name="GMI"]',"

    PATH of VARCHAR2 (2) "RODZ_GMI" "col[@name="RODZ_GMI"]',"

    "SYM' VARCHAR2 (7) PATH" col[@name="SYM"]', "

    PATH of VARCHAR2 (7) "SYM_UL" "col[@name="SYM_UL"]',"

    PATH of VARCHAR2 (5) "CECHA" "col[@name="CECHA"]',"

    PATH of VARCHAR2 (50) "NAZWA_1" "col[@name="NAZWA_1"]',"

    PATH of VARCHAR2 (50) "NAZWA_2" "col[@name="NAZWA_2"]',"

    PATH of VARCHAR2 (10) "STAN_NA" "col[@name="STAN_NA"]"

    ) x

    ) loop

    INSERT INTO TERYT_ULIC (WOJ, POW, GMI, RODZ_GMI, SYM, SYM_UL, CECHA, NAZWA_1, NAZWA_2, STAN_NA, TP_ID)

    VALUES (r.WOJ, r.POW, r.GMI, r.RODZ_GMI, r.SYM, r.SYM_UL, r.CECHA, r.NAZWA_1, r.NAZWA_2, r.STAN_NA, P_TP_ID);

    do_commit;

    end loop;

    elsif l_name = "WMRODZ" then

    Err.d ("name =" |) L_Name, cm, 80);

    for r in (SELECT x.*

    FROM XMLTable ('/ rank ' ADOPTION l_rows)

    "RM" VARCHAR2 COLUMNS (5) path "col[@name="RM"]',"

    PATH of VARCHAR2 (50) "NAZWA_RM" "col[@name="NAZWA_RM"]',"

    PATH of VARCHAR2 (10) "STAN_NA" "col[@name="STAN_NA"]"

    ) x

    ) loop

    INSERT INTO TERYT_WMRODZ (RM, NAZWA_RM, STAN_NA, TP_ID)

    VALUES (r.RM, r.NAZWA_RM, r.STAN_NA, P_TP_ID);

    do_commit;

    end loop;

    end if;

    validation work;


    When I'm loading file of type "SIMC" (the file size is approximately 32 MB), all right.

    When I am trying to load the "NEW" type (size file is about 80 MB), there's an ORA-03113.


    The problem is with the LOOP SELECTION, because

    Err.d ("name =" |) L_Name, cm, 80);

    connects name = ULIC


    What can I do to fix this?

    My DB is: Oracle Database 11 g Release 11.2.0.4.0 - 64 bit Production

    As Jason said, there are a bunch of useless stuff in there:

    -The VALIDATION inside the loop: do not do, commit only once, after that the job is done.

    -FOR lines: do not do this, use only one (possibly multi-table) INSERT SELECT.

    -BLOB CLOB conversion: not necessary, use the XMLTYPE constructor.

    -Extract from the XML document, that the work of the intermediate parties do in the whole structure directly.

    Basically, your procedure can be simplified to this couple of statements:

    -- insert XML into a temporary binary XMLType table, for performance :
    insert into tmp_xml values ( xmltype(l_blob, nls_charset_id('AL32UTF8')) );
    
    -- multitable insert into the target tables :
    INSERT FIRST
    WHEN l_name = 'TERC' THEN INTO
      TERYT_TERC (WOJ, POW, GMI, RODZ, NAZWA, NAZDOD, STAN_NA, TP_ID)
      VALUES (WOJ, POW, GMI, RODZ, NAZWA, NAZDOD, STAN_NA, P_TP_ID)
    WHEN l_name = 'SIMC' THEN INTO
      TERYT_SIMC (WOJ, POW, GMI, RODZ_GMI, RM, MZ, NAZWA, SYM, SYMPOD, STAN_NA, TP_ID)
      VALUES (WOJ, POW, GMI, RODZ_GMI, RM, MZ, NAZWA, SYM, SYMPOD, STAN_NA, P_TP_ID)
    WHEN l_name = 'ULIC' THEN INTO
      TERYT_ULIC (WOJ, POW, GMI, RODZ_GMI, SYM, SYM_UL, CECHA, NAZWA_1, NAZWA_2, STAN_NA, TP_ID)
      VALUES (WOJ, POW, GMI, RODZ_GMI, SYM, SYM_UL, CECHA, NAZWA_1, NAZWA_2, STAN_NA, P_TP_ID)
    WHEN l_name = 'WMRODZ' THEN INTO
      TERYT_WMRODZ (RM, NAZWA_RM, STAN_NA, TP_ID)
      VALUES (RM, NAZWA_RM, STAN_NA, P_TP_ID)
    SELECT x.*
    FROM tmp_xml t
       , XMLTable('/teryt/catalog/row'
           PASSING t.object_value
           COLUMNS "WOJ"      VARCHAR2(20) PATH 'col[@name="WOJ"]',
                   "POW"      VARCHAR2(20) PATH 'col[@name="POW"]',
                   "GMI"      VARCHAR2(20) PATH 'col[@name="GMI"]',
                   "RODZ"     VARCHAR2(2)  PATH 'col[@name="RODZ"]',
                   "NAZWA"    VARCHAR2(50) PATH 'col[@name="NAZWA"]',
                   "NAZDOD"   VARCHAR2(50) PATH 'col[@name="NAZDOD"]',
                   "STAN_NA"  VARCHAR2(10) PATH 'col[@name="STAN_NA"]',
                   "RODZ_GMI" VARCHAR2(2)  PATH 'col[@name="RODZ_GMI"]',
                   "RM"       VARCHAR2(3)  PATH 'col[@name="RM"]',
                   "MZ"       VARCHAR2(3)  PATH 'col[@name="MZ"]',
                   "SYM"      VARCHAR2(7)  PATH 'col[@name="SYM"]',
                   "SYMPOD"   VARCHAR2(7)  PATH 'col[@name="SYMPOD"]',
                   "SYM"      VARCHAR2(7)  PATH 'col[@name="SYM"]',
                   "SYM_UL"   VARCHAR2(7)  PATH 'col[@name="SYM_UL"]',
                   "CECHA"    VARCHAR2(5)  PATH 'col[@name="CECHA"]',
                   "NAZWA_1"  VARCHAR2(50) PATH 'col[@name="NAZWA_1"]',
                   "NAZWA_2"  VARCHAR2(50) PATH 'col[@name="NAZWA_2"]',
                   "NAZWA_RM" VARCHAR2(50) PATH 'col[@name="NAZWA_RM"]'
         ) x
    ;
    

    where TMP_XML is defined as follows:

    create global temporary table tmp_xml of xmltype
    xmltype store as securefile binary xml;
    
  • Load and read XML file size more than 4 GB

    Hi all

    My environment is Oracle 10.2.0.4 on Solaris and I process to work with the XML file as below the detail of PL/SQL

    1. I read the XML file on the HTTP port in the XMLTYPE column to table.

    2. I read value n ° 1 of the table and extract of y to insert another table

    On test db, everything is working but I got below error when I use the XML production

    ORA-31186: Document contains too many nodes

    Current XML size about 100 MB, but the procedure must take over the size of XML file over 4 GB in the future.

    Below are some of my code for your info.

    1. reading XML by line in variable and inserting into table

    LOOP
    Utl_http.READ_TEXT (http_resp, v_resptext, 32767);
    DBMS_LOB. WriteAppend (v_clob, LENGTH (v_resptext), v_resptext);

    END LOOP;

    INSERT INTO XMLTAB VALUES (XMLTYPE (v_clob));

    2. read the value of the cell in the XML column and extract to insert into another table

    DECLARE
    CURSOR c_xml IS
    (SELECT trim (y.cvalue)
    FROM XMLTAB xt.
    XMLTable ('/ Table, rows, cells, cell ' PASSAGE xt.) XMLDoc
    COLUMNS
    cvalueVARCHAR (50)PATH ' / ');

    :

    :

    BEGIN

    :

    :

    OPEN c_xml;
    SEEK c_xml INTO v_TempValue;
    < generate the insert statement in another table >
    OUTPUT WHEN c_xml % NOTFOUND;
    NARROW C_xml;

    :

    END

    And another problem is performance problem when the XML file is great, first step to XML content loading to XMLTYPE column slowly.

    Could you please suggest any solution to read large XML file and improve performance?

    Thank you in advance.

    Hiko

    Finally, change us source file to XML, CSV format and instead load the XML using SQL Loader.

  • Error when loading an XML document using a structured application

    Hello

    I try to load an XML document using a structured application defined in the default structapps.fm

    My code is shown, extracted from the sample code API FDK.

    Problem, I still got the same message:

    "Cannot find the file named e:\xml\AdobeFrameMaker10\file. Make sure that the file exists. "

    Where "e:\xml\AdobeFrameMaker10\" is my installation directory.

    So I guess that govern trying to find the structapps.fm file but can't find it.

    What else can we?

    Does anyone known how elements achieve this simple task using extendScript?

    Thanks for all comments, Pierre

    function openXMLFile (myLastFile) {}

    var filename = myLastFile.openDlg ("XML file choose...", "*.xml", false);

    If (filename! = null) {}

    / * Default Get open the properties. Back so it can not be affected. */

    var params = GetOpenDefaultParams();

    / * Set properties to open an XML document * /.

    / * Specify XML as the type of file to open * /.

    var i = GetPropIndex (params, Constants.FS_OpenAsType)

    params [i].propVal.ival = Constants.FV_TYPE_XML;

    / * Specify the XML application to use when opening the text.

    I have = GetPropIndex (params, Constants.FS_StructuredOpenApplication)

    params [i].propVal.sval = "myApp";

    I have = GetPropIndex (params, Constants.FS_FileIsOldVersion)

    params [i].propVal.ival = Constants.FV_DoOK

    I have = GetPropIndex (params, Constants.FS_FontNotFoundInDoc)

    params [i].propVal.ival = Constants.FV_DoOK

    I have = GetPropIndex (params, Constants.FS_FileIsInUse)

    params [i].propVal.ival = Constants.FV_DoCancel

    I have = GetPropIndex (params, Constants.FS_AlertUserAboutFailure)

    params [i].propVal.ival = Constants.FV_DoCancel

    / * The file structapps.fm that contains the specified app must have

    already been read. The default structapps.fm file is read when FrameMaker is

    open so this shouldn't be a problem if the application to use is

    listed in the structapps.fm fichier.*.

    var retParm = new PropVals()

    var fileObj = Open (filename, params, retParm);

    return fileObj

    } else {}

    Returns a null value.

    }

    }

    Stone,

    According to the "myLastFile" object, the method openDlg may not yet exist (if the myLastFile object is not an object file, for example). And I do not see the myLastFile be necessary anyway, you present a dialog box to select a file to open. I recommend to use the global method of ChooseFile () instead. This will give you a file name as string in the notation of full path, or null if no file has been selected in the dialog box. I'm not sure of what your States of the return value for ChooseFile ExtendScript documentation, but if that differs from what I tell you here, won't the documentation. For example, if you change the first lines of your code by the following it should work:

    function () {} openXMLFile

    var filename = ChooseFile ('choose XML file... ("," ","*.xml", Constants.FV_ChooseSelect);

    While writing this, I see that Russ already gave you the same advice. Use the value of symbolic constant, I stated to use the ChooseFile dialog box to select a single file (it can also be used to select a directory or open a file - but you want control you the logon process). Note that this method allows you to define a directory for the dialog (second parameter). The ESTK autocompletion also gives you a fifth parameter "helplink" who is undocumented and may be ignored.

    Good luck

    Jang

  • Schema validation fails on the transformed XML document

    OK, this is weird.

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

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

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

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

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

    What I'm missing here?

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

    thoughts?

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

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

    Hello

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

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

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

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

    v_xml := v_xml.createSchemaBasedXML(v_xsd_name);
    

    ?

  • Reading XML clob field

    Hi guys

    I want to read XML file that is stored as a clob in the database table (test_clob) in column (xml_file).

    <?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by xmlspy.com)-->
    <mslv-sa:orEvent xmlns:mslv-sa="http://www.metav.com/oss/Sctivation/2003" xmlns:tls="http://www.meolv.com/oss/Sctivation/2003" xmlns:co="http://java.sun.com/products/oss/xml/Common" xmlns:sa="http://java.sun.com/products/oss/xml/Sivation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <co:applicationDN/>
         <co:eventTime>2006-07-17T03:21:13</co:eventTime>
         <sa:currentState>closed.completed</sa:currentState>
         <sa:orderKey>
              <co:applicationDN/>
              <co:type/>
              <sa:primaryKey>SUAUG20_1ADSLCON-268554296-JOB-ISPSERVICE23</sa:primaryKey>
         </sa:orderKey>
         <sa:reason/>
         <mslv-sa:externalSystemId/>
         <mslv-sa:eventId>36</mslv-sa:eventId>
         <mslv-sa:eventStatus>1</mslv-sa:eventStatus>
         <mslv-sa:except>N</mslv-sa:except>
         <mslv-sa:rollbackExcept>N</mslv-sa:rollbackExcept>
         <mslv-sa:services>
              <mslv-sa:item>
                   <mslv-sa:serviceKey>
                        <co:applicationContext>
                             <co:factoryClass/>
                             <co:url/>
                             <co:systemProperties/>
                        </co:applicationContext>
                        <co:applicationDN/>
                        <co:type>ACT_POSTPAID</co:type>
                        <sa:primaryKey>aitorc01_5100719489001</sa:primaryKey>
                        <mslv-sa:serviceSequenceNumber>1</mslv-sa:serviceSequenceNumber>
                   </mslv-sa:serviceKey>
                   <mslv-sa:serviceState>active.completed</mslv-sa:serviceState>
              </mslv-sa:item>
         </mslv-sa:services>
    </mslv-sa:orderCompleteEvent>
    I use the following query just to read data from the file.
    select x.time
    FROM test_clob
            ,XMLTABLE('/mslv-sa:orderCompleteEvent/co:applicationDN/' 
                  PASSING XMLTYPE(test_clob.xml_file)
                  COLUMNS time VARCHAR2(100)PATH '/mslv-sa:orderCompleteEvent/mslv-sa:orderCompleteEvent/co:eventTime')x
    But its giving following error
    21:22:53  LPX-00801: XQuery syntax error at 'EOF'
    21:22:53  1   /mslv-sa:orderCompleteEvent/co:applicationDN/
    Please provide details


    See you soon

    Sexy

    Hi Vanessa,

    I see several issues here.

    -L' example of XML document you gave is not well-formed.
    -Some XPath expressions are false, i.e. they address anything in the document.
    -You must also declare the namespaces that you use in XMLTable.

    Assuming that the root element is actually "mslv - its: orderCompleteEvent", it should be better:

    SELECT x.eventtime
    FROM test_clob t
       , XMLTable(
           XMLNamespaces(
             'http://www.metav.com/oss/Sctivation/2003' as "mslv-sa"
           , 'http://java.sun.com/products/oss/xml/Common' as "co"
           )
         , '/mslv-sa:orderCompleteEvent'
           PASSING XMLTYPE(t.xml_file)
           COLUMNS eventtime timestamp PATH 'co:eventTime'
         ) x
    ;
    
  • CDATA xml document links

    Hi all

    I am trying to add a html link within a parapgraph of the text which is loaded by an xml document. I did some research and it seems that I have to put my actionscript to read the html code. When I add the href attribute in the text it literally reads like the code instead of create a hyperlink in the paragraph. My problem is that I have not configured the original flash document and I have little course where add the htmlText = true; and so on.

    Here is the link. The problem is in the section "press." last line of the paragraph of text. You can see the aref code does not.

    http://atelierdelalain.com/index_test.html

    Thanks in advance for any help!

    Sandra

    XML data:

    <? XML version = "1.0" encoding = "utf-8" standalone = "yes"? >

    < images >

    < pic >

    < image > http://atelierdelalain.com/press/01.jpg < / image >

    < title > <! [CDATA [WHAT IS JAMES WEARING?]] > < / title >

    < desc > <! [CDATA [as you know by now, I like to integrate the work of the people of artisans and crafts fine inside I create for my clients and myself, a craft object individually can really make a space.]]

    This brings me to the cabinetmaker Emmanuel Delalain and its society Delalain workshop that make the most wonderful things in wood and metal. Elegant clean lines, highly regarded as feature and a rich sensual poetry in his work, he does not surprise us to learn Delalain has perfected his art as a young man in the workshop of coastal South of his French father and his grandfather, construction of sailboats.

    " To view the full article click here. < a href =" http://www.strutdenver.com [[ "target ="_blank"> < /a > of Strut]] > < / desc >

    < darkens > <! [CDATA []] > < / dark >

    < Comment > <! [CDATA []] > < / note >

    < miniature > http://atelierdelalain.com/press/thumbs/01.jpg < / thumbnail >

    < width > 600 < / width >

    < > 47 thumbwidth < / thumbwidth >

    < subpics >

    < / subpics >

    < / pic >

    < / images >

    ActionScript code:

    Mx.transitions import. *;

    Import mx.transitions.easing. *;

    displayWidth = Stage.width;

    function loadXML (loaded) {}

    If {(responsible)

    xmlNode = this.firstChild;

    image = [];

    title = [];

    DESC = [];

    If stump = [];

    Note = [];

    thumbnails = [];

    imageW = [];

    subimage = [];

    subthumb = [];

    subW = [];

    Subarray = new Array();

    Total = xmlNode.childNodes.length;

    for (i = 0; i < total; i ++) {}

    image [i] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [0].firstChild.nodeValue;

    title [i] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [1].firstChild.nodeValue;

    DESC [i] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [2].firstChild.nodeValue;

    DIMS [i] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [3].firstChild.nodeValue;

    Note [i] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [4].firstChild.nodeValue;

    thumbnails [i] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [5].firstChild.nodeValue;

    imageW [i] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [6].firstChild.nodeValue;

    If (i == 0) {}

    thisX = 0;

    w = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [7].firstChild.nodeValue;

    } else {}

    thisX = Number (w) + Number (2);

    thisW = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [7].firstChild.nodeValue;

    w = (thisX) Number + Number (thisW);

    }

    number of subpics

    total_subpics = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [8].childNodes.length;

    If (total_subpics! = undefined) {}

    Subarray [i] = new Array();

    for (x = 0; x < total_subpics; x ++) {}

    Subarray [i] [x] = new Array();

    Subarray [i] [x] [0] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [8] Sublst.ChildNodes(1).ChildNodes(0) [x] Sublst.ChildNodes(1).ChildNodes(0) [0].firstChild.nodeValue;

    Subarray [i] [x] [1] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [8] Sublst.ChildNodes(1).ChildNodes(0) [x] Sublst.ChildNodes(1).ChildNodes(0) [1].firstChild.nodeValue;

    subArray [i] [x] [2] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [8] Sublst.ChildNodes(1).ChildNodes(0) [x] Sublst.ChildNodes(1).ChildNodes(0) [2].firstChild.nodeValue;

    Subarray [i] [x] [3] = xmlNode.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [8] Sublst.ChildNodes(1).ChildNodes(0) [x] Sublst.ChildNodes(1).ChildNodes(0) [3].firstChild.nodeValue;

    }

    }

    thumbnails_fn (i, thisX);

    }

    firstImage();

    } else {}

    Content = "file not loaded! ';

    }

    }

    xmlData = new XML();

    xmlData.ignoreWhite = true;

    xmlData.onLoad = loadXML;

    xmlData.load("flash/press.xml");

    /////////////////////////////////////

    Listen = new Object();

    listen.onKeyDown = function() {}

    If (Key.getCode () == Key.LEFT) {}

    prevImage();

    } ElseIf (Key.getCode () == Key.RIGHT) {}

    nextImage();

    }

    };

    Key.addListener (listen);

    previous_btn.onRelease = function() {}

    prevImage();

    };

    next_btn.onRelease = function() {}

    nextImage();

    };

    /////////////////////////////////////

    p = 0;

    this.onEnterFrame = function() {}

    size of the file = picture.getBytesTotal ();

    load = picture.getBytesLoaded ();

    Preloader._visible = true;

    If (load! = filesize) {}

    Preloader.preload_bar._xscale = 100 * load/size of the file.

    } else {}

    Preloader._visible = false;

    If (picture._alpha < 100) {}

    Picture._alpha += 10;

    subHolder._alpha += 10;

    }

    }

    };

    function nextImage() {}

    If (p <(total-1)) {}

    p ++ ;

    If (load == filesize) {}

    void thumbs.

    subHolder.removeMovieClip ();

    If (subArray [p]! = undefined) {}

    createEmptyMovieClip ("subHolder", 10);

    subHolder._x = 800;

    for (z = 0; z < subarray [p] .length; z ++) {}

    subthumbs_fn (p, z);

    }

    createEmptyMovieClip ("line", 1);

    lineLen = z * 60 + z * 5;

    Line.lineStyle (1, 0x492F92, 100);

    Line.moveTo (795, 0);

    Line.lineTo (795, lineLen);

    createEmptyMovieClip ("line 2", 2);

    Line2.LineStyle (1, 0x492F92, 100);

    Line2.MoveTo (895, 0);

    Line2.lineTo (895, lineLen);

    } else {}

    Line._alpha = 0;

    Line2._alpha = 0;

    }

    subHolder._alpha = 0;

    EndSub thumbs.

    Picture._alpha = 0;

    picture.loadMovie (image [p], 1);

    displayWidth = Stage.width;

    imageWidth = imageW [p];

    RES = displayWidth-imageWidth.

    place = res/2;

    Picture._x = place;

    title_txt.htmlText = true;

    title_txt.htmlText = title [p];

    "desc_txt.htmlText = desc [p] + ' ' + fades [p] + '. "+ note [p];

    picture_num();

    }

    }

    }

    function prevImage() {}

    If (p > 0) {}

    p-- ;

    void thumbs.

    subHolder.removeMovieClip ();

    If (subArray [p]! = undefined) {}

    createEmptyMovieClip ("subHolder", 10);

    subHolder._x = 800;

    for (z = 0; z < subarray [p] .length; z ++) {}

    subthumbs_fn (p, z);

    }

    createEmptyMovieClip ("line", 1);

    lineLen = z * 60 + z * 5;

    Line.lineStyle (1, 0x492F92, 100);

    Line.moveTo (795, 0);

    Line.lineTo (795, lineLen);

    createEmptyMovieClip ("line 2", 2);

    Line2.LineStyle (1, 0x492F92, 100);

    Line2.MoveTo (895, 0);

    Line2.lineTo (895, lineLen);

    } else {}

    Line._alpha = 0;

    Line2._alpha = 0;

    }

    subHolder._alpha = 0;

    EndSub thumbs.

    Picture._alpha = 0;

    picture.loadMovie (image [p], 1);

    displayWidth = Stage.width;

    imageWidth = imageW [p];

    RES = displayWidth-imageWidth.

    place = res/2;

    trace("DW:"+DisplayWidth+"IW:"+ImageWidth+"x:"+place);

    Picture._x = place;

    title_txt.htmlText = true;

    title_txt.htmlText = title [p];

    "desc_txt.htmlText = desc [p] + ' ' + fades [p] + '. "+ note [p];

    picture_num();

    }

    }

    function firstImage() {}

    If (load == filesize) {}

    void thumbs.

    subHolder.removeMovieClip ();

    If (subArray [p]! = undefined) {}

    createEmptyMovieClip ("subHolder", 10);

    subHolder._x = 800;

    for (z = 0; z < subarray [p] .length; z ++) {}

    subthumbs_fn (p, z);

    }

    createEmptyMovieClip ("line", 1);

    lineLen = z * 60 + z * 5;

    Line.lineStyle (1, 0x492F92, 100);

    Line.moveTo (795, 0);

    Line.lineTo (795, lineLen);

    createEmptyMovieClip ("line 2", 2);

    Line2.LineStyle (1, 0x492F92, 100);

    Line2.MoveTo (895, 0);

    Line2.lineTo (895, lineLen);

    } else {}

    Line._alpha = 0;

    Line2._alpha = 0;

    }

    subHolder._alpha = 0;

    EndSub thumbs.

    Picture._alpha = 0;

    picture.loadMovie (image [0], 1);

    displayWidth = Stage.width;

    imageWidth = imageW [0];

    RES = displayWidth-imageWidth.

    place = res/2;

    Picture._x = place;

    title_txt.htmlText = true;

    title_txt.htmlText = title [p];

    "desc_txt.htmlText = desc [p] + ' ' + fades [p] + '. "+ note [p];

    picture_num();

    }

    }

    function picture_num() {}

    current_pos = p + 1;

    pos_txt. "Text = current_pos +" / "+ total;

    }

    function thumbNailScroller() {}

    the thumbnail code!

    this.createEmptyMovieClip ("tscroller", 1000);

    scroll_speed = 10;

    tscroller.onEnterFrame = function() {}

    If ((_root._ymouse > = thumbnail_mc._y) & & (_root._ymouse < = thumbnail_mc._y + thumbnail_mc._height)) {}

    If ((_root._xmouse > =(hit_right._x-60)) & & (thumbnail_mc.hitTest (hit_right))) {}

    thumbnail_mc._x = scroll_speed;

    } else if ((_root._xmouse < = (hit_left._x + 60)) & & (thumbnail_mc.hitTest (hit_left))) {}

    thumbnail_mc._x += scroll_speed;

    }

    } else {}

    delete tscroller.onEnterFrame;

    }

    };

    }

    function thumbnails_fn (k, xpos)}

    thumbnail_mc.createEmptyMovieClip ("t" + k, thumbnail_mc.getNextHighestDepth ());

    tlistener = new Object();

    tlistener.onLoadInit = {function (target_mc)}

    target_mc._x = xpos;

    target_mc.pictureValue = k;

    target_mc.onRelease = function() {}

    p = this.pictureValue - 1;

    nextImage();

    };

    target_mc.onRollOver = function() {}

    This ._alpha = 80;

    thumbNailScroller();

    };

    target_mc.onRollOut = function() {}

    This ._alpha = 100;

    };

    };

    image_mcl = new MovieClipLoader();

    image_mcl. AddListener (tlistener);

    image_mcl.loadClip (thumbnails [k], "thumbnail_mc.t" + k);

    }

    function scrollLeft() {}

    the thumbnail code!

    this.createEmptyMovieClip ("tscroller", 1000);

    If (thumbnail_mc.hitTest (hit_right)) {}

    thisX = thumbnail_mc._x;

    Dist = hit_right._x - thumbnail_mc._x;

    r = thumbnail_mc._width - dist;

    If (r > = 200) {}

    Agree = thumbnail_mc._x - 200;

    } else {}

    Agree = thumbnail_mc._x - r;

    }

    new Tween (thumbnail_mc, "_x", Regular.easeOut, thisX, agree,.5, true);

    }

    }

    function scrollRight() {}

    the thumbnail code!

    this.createEmptyMovieClip ("tscroller", 1000);

    If (thumbnail_mc.hitTest (hit_left)) {}

    thisX = thumbnail_mc._x;

    Dist = hit_left._x - thumbnail_mc._x;

    If (dist > = 200) {}

    Agree = thumbnail_mc._x + 200;

    } else {}

    Agree = thumbnail_mc._x + dist;

    }

    new Tween (thumbnail_mc, "_x", Regular.easeOut, thisX, agree,.5, true);

    }

    }

    buttonRight.onRelease = function() {}

    scrollLeft();

    };

    buttonLeft.onRelease = function() {}

    scrollRight();

    };

    function subthumbs_fn (d, z) {}

    subHolder.createEmptyMovieClip ("sub" + z, subHolder.getNextHighestDepth ());

    sublistener = new Object();

    sublistener.onLoadInit = {function (targ_mc)}

    targ_mc._x = 800;

    targ_mc._y = 60 * z + 5 * z;

    ////

    thumbWidth = subarray [p] [z] [3];

    thumbRes = 90-thumbWidth;

    thumbPlace = thumbRes/2;

    targ_mc._x = thumbPlace;

    trace (targ_mc._x);

    targ_mc.onRelease = function() {}

    p = this.pictureValue - 1;

    nextImage();

    Picture._alpha = 0;

    picture.loadMovie (subarray [p] [z] [0], 1);

    displayWidth = Stage.width;

    imageWidth = subarray [p] [z] [2];

    RES = displayWidth-imageWidth.

    place = res/2;

    Picture._x = place;

    This ._alpha = 30;

    picture_num();

    };

    targ_mc.onRollOver = function() {}

    targ_mc._alpha = 80;

    trace (targ_mc);

    };

    targ_mc.onRollOut = function() {}

    This ._alpha = 100;

    };

    };

    sub_mcl = new MovieClipLoader();

    sub_mcl. AddListener (sublistener);

    sub_mcl.loadClip (subarray [p] [z] [1], "subHolder.sub" + z);

    }

    Try this

    title_txt.html = true;
    title_txt.htmlText = title[p];
    
    desc_txt.html = true;
    desc_txt.htmlText = desc[p]+" "+dims[p]+". "+note[p];
    
  • Validation of an XML document to a schema using ColdFusion

    It's something I've never tried.  We have created an XML schema to define XML documents, that we expect to receive from various entities.   When we receive the document, we would like to validate prior to processing.  I think that ColdFusion is so far from reading the documentation, but we did not get anything that works yet.

    When we try and xmlParse() our test XML file against the XML schema, we get the following error.  When we use a web based XML validation tool and feed him the same XML file and schema that it validates fine.

    An error occurred during parsing of an XML document.
    [Error]: 2:6: cvc - elt.1: cannot find the declaration of element "pure."

    The error occurred in D:\playground\warren\ppur_file_import.cfm: line 57
    55:
    56:
    57: < cfset xmldoc = XmlParse (ExpandPath (filepath), true, ExpandPath (validator)) / >
    58: cfdump var = "#xmldoc #" >
    59: < cfabort >

    Looking for the error gave me useful advice.  Can anyone here?

    I was able to get the document of the sample to be analyzed by adding namespaces to the sample file.  I'm not an XML expert, so I can't provide a clear explanation for this.  "I used Altova XML Spy to create an example of XML document based on your schema, and he added the xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance"xsi: noNamespaceSchemaLocation sections in the XML file."  Note that the value of noNamespaceSchemaLocation is normally the way to the XSD file.  I left the empty value and sample analysis always in ColdFusion 8.

    I suspect that the underlying issue is related to how Java CF based XML parser expects to be dealt with in the documents XML, namespaces, but it's just a theory.

    "" "xsi: noNamespaceSchemaLocation http://www.w3.org/2001/XMLSchema-instance" = "" >
         foo
         bar

      http://www.w3.org/2001/XMLSchema">
        
             
                                 
             
                        


                       
                  
             
        


  • How to navigate through an XML document?

    I try to use an XML document to describe conditional text ID can be assigned to a section of text. For this I need to read the child nodes for a given node in the XML file and assign values to these children node in a table.

    API document DW8 does not seem to support JavaScript DOM XML functions such as loadXMLDoc(), or as dom.getSelectedNode () functions supported by xpath expressions. The childNodes object is only the immediate children of the document object and does not correctly as xmlDOM.getElementsByTagName("TopicSku").childNodes.

    How to browse a document XML using the API extension DW8?

    Thank you

    -Scott

    Oh, wait. I was not using getElementsByTagName("TopicSku").childNodes. It works with xmlDOM.getElementsByTagName ("TopicSku") [iter] Sublst.ChildNodes(1).ChildNodes(0). I'm back on the rails.
    -Scott

  • Merge the XML document in a table

    Hello
    I want to merge some of the values of an xml document in a table "Project_Table".

    CREATE TABLE Project_Table
    (
    TASK_ID NUMBER (15),
    TASK_NAME VARCHAR2 (100 BYTE),
    START_DATE DATE,
    )

    I am using the following procedure, that I adapted from another post. It inserts null values, I think because I'm not showing the nodes correctly.

    DECLARE
    BFILE v_bfile: = BFILENAME ("'DTEMP","test.xml");
    v_clob CLOB.
    BEGIN
    -Create directory DTEMP as "C:\TEMP";
    -grant read the < schema > DTEMP directory;

    DBMS_LOB.CREATETEMPORARY (v_clob, TRUE);
    DBMS_LOB. OPEN (v_bfile, DBMS_LOB.lob_readonly);
    DBMS_LOB. LoadFromFile (v_clob, v_bfile, DBMS_LOB.lobmaxsize);
    Dbms_output.put_line (v_clob);
    MERGE IN project_table t
    USING (SELECT TO_NUMBER (EXTRACTVALUE (VALUE (x), ' / task ')) task_id,)
    To_date (EXTRACTVALUE (value (x), "/ start"), 'DD-MM-YYYY') start_date,
    EXTRACTVALUE (value (x), "/ name") TaskName
    (SELECT XMLTYPE (v_clob) XML
    THE DOUBLE).
    TABLE (XMLSEQUENCE (EXTRACT (xml, ' / project'))) x) r
    WE (t.task_id = r.task_id)
    WHEN MATCHED THEN
    UPDATE
    SET t.start_date = r.start_date, t.task_name = r.task_name
    WHEN NOT MATCHED THEN
    INSERT (task_id, start_date, taskname)
    VALUES (r.task_id, r.start_date, r.task_name);
    COMMIT;
    END;

    This is the document of test.xml.

    <? XML version = "1.0" encoding = "UTF-8"? >
    -name of the project 'ProjectName' company 'Company' webLink = = = "" view-date = '2009-12-14"see-index '0' = gantt-Divider-location = '300' resource-divider-card ="300"version ="2.0">"
    < description / >
    < zoom-view state = "default: 8" / >
    -<!
    ->
    -< calendars >
    -day-types >
    < day-type id = '0' / >
    < day-type id = "1" / >
    -< Calendar id = "1" name = "default" >
    < Sun weeks default = '0' LUN '0' = TEU = '0' kills = '0' game = '0' Fri '0' = Saturday = '0' / >
    < overloaded-day-types / >
    < days / >
    < / calendar >
    < / day-types >
    < / calendars >
    -task color = "#8cb6ce" >
    -< taskproperties >
    < taskproperty id = "tpd0" name = 'type' type = 'default' valuetype = "icon" / >
    < taskproperty id = "TDP1" name = 'priority' type = 'default' valuetype = "icon" / >
    < taskproperty id = "tpd2" name = 'info' type = 'default' valuetype = "icon" / >
    < taskproperty id = "tpd3" name = "name" type = 'default' valuetype = "text" / >
    < taskproperty id = "tpd4" name = "begindate" type = 'default' valuetype = "date" / >
    < taskproperty id = "tpd5" name = "enddate" type = 'default' valuetype = "date" / >
    < taskproperty id = "tpd6" name = "Duration" type = 'default' valuetype = "int" / >
    < taskproperty id = "tpd7" name = "completion" type = 'default' valuetype = "int" / >
    < taskproperty id = "tpd8" name = "Coordinator" type = 'default' valuetype = "text" / >
    < taskproperty id = "tpd9" name = "predecessorsr" type = "default" valuetype = "text" / >
    < / taskproperties >
    < job id = '0' name = 'TaskA"color =" #0099cc "form = meeting"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"="false"start ="2010-01-28"duration ="1"complete ="0"priority ="1"expand ="true"/ >
    < task id = "1" name = "TaskB" color = "#ff0000" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-01-28" duration = "1" complete = "100" priority = "1" expand = "true" / >
    < job id = "2" name = 'Day' color = "#ff9933" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-02-01" duration = "19" complete = "0" priority = "1" expand = "true" / >
    < job id = "3" name = "TaskD" color = "#ff0000" form = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" meeting = "false" start = "2010-02-01" duration = "32" full = "100" priority = "1" expand = "true" / >
    < job id = "4" name = "TaskE" color = "#66ff99" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-02-01" duration = "67" complete = "0" priority = "1" expand = "true" / >
    < job id = "5" name = "TaskF" color = "#66ff99" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-02-01" duration = "46" complete = "10" priority = "1" expand = "true" / >
    < job id = "6" name = "TaskG" color = "#00cccc" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-03-15" duration = "30" complete = "0" priority = "1" expand = "true" / >
    < job id = "7" name = "TaskH" color = "#00cccc" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = "2010-03-15" duration = "103" full '1' = '1' priority = expand = "true" / >
    < job id = "8" name = "TaskI" color = "#0000ff" form = meeting "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" = "false" start = '2010-04-26' length = "11" complete = "0" priority = "1" expand = "true" / >
    < job id = '9' name = 'TaskJ"color =" #0000ff "form = meeting"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"="false"start = '2010-04-26' length ="11"complete ="0"priority ="1"expand ="true"/ >
    < job id = "10" name = "TaskK" color = "#000000" meeting = 'false' start time = "2010-07-12" = "65" full = "0" priority = "1" expand = "true" / >
    < / tasks >
    < resources / >
    < allowances / >
    < holiday / >
    -< taskdisplaycolumns >
    < displaycolumn property id = "tpd3" order = "0" width = "75" / >
    < displaycolumn property id = "tpd4" order = "1" width = "75" / >
    < displaycolumn property id = "tpd5" order = "2" width = "75" / >
    < displaycolumn property id = "tpd7" order = "3" width = "75" / >
    < / taskdisplaycolumns >
    < Previous / >
    < roles roles-name = "Default" / >
    < / project >

    Any ideas how to change the procedure, in order to merge the data in the xml document in the table?

    Thank you

    Hello

    Here's what you need in your USING clause:

    SELECT to_number(extractvalue(column_value, 'task/@id'))                as task_id,
           to_date(extractvalue(column_value, 'task/@start'), 'YYYY-MM-DD') as start_date,
           extractvalue(column_value, 'task/@name')                         as task_name
    FROM TABLE(
      XMLSEQUENCE(
        EXTRACT(xmltype(v_clob), '//task')
      )
    )
    

    Since you want nodes "task" request, just extract them directly. In addition, 'id', 'start', 'name' is attributes, you must access them with an '@'.

    You can also take a look at function XMLTABLE (which tends to replace construction TABLE (XMLSEQUENCE (...))):

    SELECT *
    FROM XMLTABLE(
     '//task'
     passing xmltype(v_clob)
     columns task_id    number(15)    path '/task/@id',
             start_date date          path '/task/@start',
             task_name  varchar2(100) path '/task/@name'
    )
    

    Edit: the XMLType constructor overload taking a BFILE type as an argument, so you can simplify the code a bit more:

    DECLARE
    
     v_xml XMLTYPE := XMLTYPE( BFILENAME('DTEMP', 'test.xml'), nls_charset_id('AL32UTF8') );
    
    BEGIN
    
    MERGE INTO project_table t
    USING (
      SELECT *
      FROM XMLTABLE(
       '//task'
       passing v_xml
       columns task_id    number(15)    path '/task/@id',
               start_date date          path '/task/@start',
               task_name  varchar2(100) path '/task/@name'
      )
    ) r
    ON (t.task_id = r.task_id)
    WHEN MATCHED THEN ...
    WHEN NOT MATCHED THEN ...
    ;
    
    ...
    
    END;
    

    HTH

    Published by: odie_63 on March 18, 2010 12:13

    Published by: odie_63 on March 18, 2010 12:15

  • Convert flat file to XML document and store it in the Oracle database

    First of all:
    I have a flatfile and created an external table to read this file in Oracle
    Now, I want to create an XML document for each line and insert in the Oracle database, I think as XMLtype.
    Could you please give me some information/steps.

    Second:
    Are there performance issues, because every day, I need to check that the XML document stored in the database against the next file.
    Thank you.

    I won't tell it not in the same words that Marco used, but your solution is impassable and an invitation for bad things to happen.

    Wait miserable performance, and you will not be disappointed.

    The concept of total flexibility works up a code that you depend on has no idea what to do with what is playback.
    Will happen to enough short term and is roughly the equivalent of the absurdity of Java to be independent of the database.

    I would recommend you take the concept and consider, with your data volumes, something more likely to succeed.

Maybe you are looking for

  • How to remove the default Firefox 38.0.1 yahoo search (Macintosh)

    How can I remove the automatic reset of Firefox for the terrible yahoo search engine? I want Google as default search engine. Here's what I've tried:a. choose Google over yahoo and then remove the yahoo of preferences: Firefox always springs back to

  • Satellite R630-13 t - lack of recognition of USB

    Hello I have a portable Satellite R630-13 t. sometimes when I insert a USB key into the USB port, Windows 7 recognizes it, but he loses in a few seconds, as the discoveries it once again and loses it and all even more. When this happens, two USB port

  • 3 11 yoga rotation - Auto and Auto - 10 Windows Tablet

    Updated the 3 for windows 10 yoga... After a bit of tweaking got working outside most of the things... Automatic tablet mode when you flip and automatic rotation of images does not at all... Any help is appreciated... Thank you!

  • The system cannot find the specified file

    Encounter this error when installing my application on another pc (win xp). Works ok on my pc (win7, LabVIEW2013 SP1) to develop. There is no error code, or the name of the file. Someone at - he had this error before? The installation program does no

  • How to use a chart control to enter data?

    I have a GUI that contains a chart control.  By making no use of events graphic I was able to add and remove a data point on my chart by clicking the chart control and then handle the event in the vi... no problem.  What I would really like to do now