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">
    
         
                             
         
                    


                   
              
         
    


Tags: ColdFusion

Similar Questions

  • The statement on the xsd in an xml document

    Hello

    I had written in the root element in the XML, the lines to deceive:

    <? XML version = "1.0" encoding = "UTF-8"? >

    < MyRootElement MyAttribute1 = "MyAttributeValue1."

    MyAttribute2 = "MyAttributeValue2."

    MyAttribute3 = "MyAttributeValue3".

    " xmlns =" http://www.Oracle.com/XML/Test1.xsd"" "

                            xmlns : xsi = " http://www.w3.org/2001/xmlSchema-instance "

    " xsi: schemaLocation =" http://www.Oracle.com/XML/Test1.xsd xml_schema.xsd "> "



    but the problem is that the customer does not want to get the 3 lines (underlined), where I declare in the xsd document.

    Can I omit these 3 rows? or replace them with something else?


    Thanks in advance,

    Elad





    You can probably omit xsi: schemaLocation (and the declaration xmlns: xsi, if the prefix is not used in the doc), but the removal of the default namespace will change the semantics.

    If your client has said that he does not want a namespace by default, then so be, remove it from the document instance. You also need to remove the XSD targetNamespace declaration.

    Based on your other discussions recently posted, you then will have to modify your validation code and explicitly construct an instance XML based on a schema using the URL of the registered scheme.

  • Display the error when the xml document is not valid against the schema

    Hello

    I'm using isChemaValid() in a way that, to determine if the xml document is valid against the xml schema.

    This function returns only 0 or 1, and I want to display the error and the line number if the xml is not valid.

    How can I achieve this?

    Thanks in advance,

    Elad

    Use the XMLType schemaValidate() method. It will throw an exception whose message contains the validation error.

    Get a number of 'line' is not sensible as XML is concerned.

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

    ?

  • ORA-19030: invalid method for the schema not based XML Documents

    Hi everyone can u help me please when I am trying to execute query below his throw errror

    DECLARE

    doc xmltype.

    BEGIN

    SELECT

    XMLAGG (XMLElement ("employee",

    XMLAttributes)

                      ' http://www.Oracle.com/emp_simple.xsd ' AS 'xmlns',

                      ' http://www.w3.org/2001/XMLSchema-instance ' AS ' xmlns: xsi ",

                      ' http://www.Oracle.com/emp_simple.xsd

    http://www.oracle.com/emp_simple.xsd'

    AS "xsi: schemaLocation").

    XMLForest (e.employee_id LIKE "EmployeeId",

    Select AS "name."

    e.job_id AS "Job."

    e.manager_id "MANAGER."

    e.hire_date AS "Hire Date"

    e.Salary AS "wages."

    e.commission_pct AS 'The Commission',

    XMLForest)

    d.department_id AS "DeptNo."

    d.department_name AS "DeptName",.

    d.location_id AS 'Place') AS 'Dept')))

    in the doc

    E employees, departments d

    WHERE e.department_id = d.department_id;

    doc.schemaValidate ();

    END;

    /

    The error I get is following

    ORA-19030: invalid method for the schema not based XML Documents

    Yes, Odie meant something like that.

    
        
            
                
                    
                        
                            
                                
                                
                                
                                
                                
                                
                                
                                
                                    
                                        
                                            
                                            
                                            
                                        
                                    
                                
                            
                        
                    
                
            
        
    
    

    See how the employee node can now occur more than once in the employees node.

  • Multi attribute in xml - in the element schema root

    Hello

    I have several attribute in the xml file. all of them - in the root element.

    I know I have to put the declaration of the attribute in the lower part of the Diagram.

    When I put that one attribute in the schema - everything is OK.

    but I have more than one attribute (I have 8 attributes...), and I get this error:

    ORA-01460: LETTER, DEAD OR UNREASONABLE CONVERSION


    XML file:

    < MyRootElement Myattribute1 = 'MyValue1 '.

    MyAttribute2 = "MyValue2".

    MyAttribute3 = "MyValue3".

    "xmlns ="http://www.oracle.com/xml/test.xsd"

    xmlns ="http://www.w3.org/2001/xmlSchema-instance at the beginning of this line there should be written:" xmlns: xsi", but it's gone...".

    xsi: schemaLocation =http://www.oracle.com/xml/test.xsd my_schema_file.xsd' > '.

    XSD file:

    "" < schema targetNameSpace = "http://www.oracle.com/xml/test.xsd"

    "xmlns ="http://www.w3.org/2001/xmlSchema"

    xmlns: xdb = "http://xmlns.oracle.com/xdb."

    version = "1.0".

    elementFormDefault = "qualified" >

    < element name = "MyRootElement" >

    < complexType >

    < sequence >

    ----------------

    -the rest of the xsd file.

    ---------------------------------------------

    < / sequence >

    < attribute name = "MyAttribute1" type = "string" use = "required".

    < attribute name = "MyAttribute2" type = "string" use = "required".

    < / complexType >

    < / item >

    < / schema >

    Someone knows what's the problem?

    Thanks in advance,

    Elad

    Thank you.

    Okay... where to start? Almost everything is bad or at least very awkward

    (1) do not use the physical path with UTL_FILE, that has been obsolete for many years now. Use directory objects.

    And in fact, you don't even have UTL_FILE here.

    (2) the XML schema must be saved at once, in a separate script.

    Or do you expect to change them as often you must include the part of the record of the proceedings?

    (3) If your input XML document has an attribute xsi: schemaLocation, make sure that you save the schema using the same URL.

    In your example, there is a mismatch: 'my_schema_file.xsd' vs 'xml_schema.xsd' in the register command.

    So, to summarize:

    Create a directory:

    create or replace directory xml_dir as ' / home/myPath ";

    Save the schema (once):

    () dbms_xmlschema.registerschema

    schemaurl-online "my_schema_file.xsd."

    schemadoc-online xmltype)

    BFILENAME ('XML_DIR', '')

    , nls_charset_id ('AL32UTF8') - use the actual encoding of the file here

    )

    local-online true

    genTypes-online fake

    gentables-online fake

    enableHierarchy-online dbms_xmlschema.enable_hierarchy_none

    );

    So here's how I would rewrite the function:

    create or replace function schema_xml_333 (p_tested_xml in varchar2)

    return varchar2

    is

    doc xmltype: = xmltype (bfilename ('XML_DIR', p_tested_xml), nls_charset_id ('AL32UTF8'));

    Start

    return case when doc.isSchemaValid () = 1

    then "XML is valid.

    otherwise "XML is not valid.

    end;

    end;

    /

    Yet once, this will not work if the XML contains an attribute xsi: schemaLocation whose part URL pattern matches the URL used for recording.

    In this case, you don't need the createSchemaBasedXML method.

  • Generation of XML Document

    Dear all

    I have a requirement to generate the XML data as shown in the light of the definition of XML schema. I did it by using oracle developer report to generate put them in the xml document.

    My question is that it is important to attribute sequences for example

    XSD has attribute
    ------------------------
    Name
    Address
    phoneno
    ------------------------

    But when I generate the XML using oracle report developer he changes the order of the attributes like this

    -------------------------
    phoneno
    address
    name
    ------------------------


    Please guide this poor sequence of attribute have a problem during the validation of xml with xsd document.

    Concerning

    XML 1.0 specification:

    http://www.w3.org/TR/REC-xml/#sec-StartTags

    The name the start end-tags and gives the type of the element. [Definition: the name-AttValue pairs are referred to as the specification of attribute of the element], [definition: with the name in each pair referred to as the attribute name] and [definition: the content of the AttValue (the text between the "or"delimiters) as the attribute value.] Note that the order of specification of attribute in a start tag or empty element tag is not significant.

  • What is the difference between Facelets and JSP XML document?

    Hello

    When you create a new page, in the dialog box "Create a JSF Page" it is a choice called 'Type of Document' to select "Facelets" or "the JSP XML".

    May be he one please tell me what is the difference between them. And what should I choose if I want to include ajax code in my page.

    Thanks in advance

    Facelets creates a facelets page

    JSP creates a JSP page

    Facelets - is default and the official display for JSF, compact JSP pages Manager has been used to view JSF pages but don't bear all component Facelets comes in picture under open source APACHE license. It supprts all components used by JSF (Java Server Faces) user interface.

    Facelets has been developed by Jacob Hookom in 2005.

    If you create a Facelets fragment in taskflow bounded, taskflow must be abandoned in a JSF (the parent page) page not in the .jspx (JSP XML) page.

    If you try to deposit in the JSP XML page-

    JSP, XML - jspx is Variant XML of the JSP (Java Server Pages) to support XML document. The JSP XML fragments are used in ADF inorder to support the XML document and more powerful techniques of page validation.

    If you create xml jsp fragments in taskflow bounded, taskflow must be abandoned in a JSP XML (.jspx) (the parent page) page not in the JSF page.

  • How to insert an XML document to the database table

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

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

    Table in which I want to import this file

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

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

      v_xml := XMLTYPE(v_clob);
    

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

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

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

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

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

    Example here...

    Re: XML processing in oracle file

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

    DB XML FAQ

  • 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

  • Problem with loading of XML document

    Hello
    I have to load XML document uploaded on the web in XML DB and validate against the schema. The problem is, that:
    schemaLocation still looks like in the document like this:

    P1:schemaLocation = "SPDS. IFR.i009.pl http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL & amp; rs 3aFormat % = XML & amp; rc % 3aSchema = True'

    and cannot be changed.

    I registered schema by using the command:
    BEGIN
    DBMS_XMLSCHEMA.registerSchema
    (
    SCHEMAURL = >
    -UTL_URL. UNESCAPE
    ('http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL & amp; rs 3aFormat % = XML & amp; % 3aSchema rc = True'),
    SCHEMADOC = > BFILENAME ("TEST_DIR',"test.xsd").
    FORCE = > TRUE
    );
    END;

    (ORACLE inquired about the variable & amp, I set myself to & amp course :)))

    I used the FORCE to omit the error:
    ORA-31000: resource ' http://inetsqlcg:82/ReportServer?/ReportPublisher/spds.ifr.009.PL & amp; RS: Format = XML & amp; RC:schema = True' is not a document of schema XDB

    Now I have the schema with SCHEMA_URL
    Select SCHEMA_URL in the user_xml_schemas;
    http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.IFR.009.pl & amp; RS % 3aFormat = XML & amp; RC % 3aSchema = true

    but when I try to load the document like this
    INSERT INTO THE REP
    VALUES
    (
    XMLType
    (
    BFILENAME ("TEST_DIR", "test.xml"),
    NLS_CHARSET_ID ("AL32UTF8")
    )
    );

    There is an error:
    ORA-19007: Schema - does not http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL & amp; rs 3aFormat % = XML & amp; % 3aSchema rc = True expected.


    test.xsd is:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < xmlns = "spds.ifr.009.PL schema" xmlns: XS = "http://www.w3.org/2001/XMLSchema" xmlns:xdb = "http://xmlns.oracle.com/xdb" targetNamespace = "spds.ifr.009.PL" > "
    < xs: element name = "Report" xdb:defaultTable = "REP" >
    < xs: annotation >
    < intention > report < / intention >
    < / xs: annotation >
    < complexType xdb:SQLType = "REP_T" >
    < xs: Sequence minOccurs = "0" maxOccurs = "unbounded" >
    < xs: ELEMENT ref = "Detail" minOccurs = "0" maxOccurs = "unbounded" xdb:SQLName = "DETAILS" xdb:SQLCollType = "DETAILS_C" / >
    < / xs: SEQUENCE >
    < name XS: attribute = use 'REPORTNAME1' 'optional' = >
    < xs: annotation >
    XYZ abc < intention > < / intention >
    < / xs: annotation >
    < xs:simpleType >
    < xs:restriction base = "XS: String" / >
    < / xs:simpleType >
    < / xs: attribute >
    < / xs: complexType >
    < / xs: element >
    < xs: element name = "Details" xdb:defaultTable = "" >
    < xs: annotation >
    Details of < intention > < / intention >
    < / xs: annotation >
    < complexType xdb:SQLType = "DETAILS_T" >
    < name XS: attribute = "VALUATE" type = "xs: String" use = "optional" >
    < xs: annotation >
    < intention > Valuate < / intention >
    < / xs: annotation >
    < / xs: attribute >
    < name XS: attribute = "ISIN" use = "optional" >
    < xs: annotation >
    < intention > ISIN < / intention >
    < / xs: annotation >
    < xs:simpleType >
    < xs:restriction base = "XS: String" / >
    < / xs:simpleType >
    < / xs: attribute >
    < / xs: complexType >
    < / xs: element >
    < / xs: Schema >

    test.XML is:

    <? XML version = "1.0" encoding = "UTF-8"? >
    "< report xmlns:p1 ="http://www.w3.org/2001/XMLSchema-instance"xmlns ="spds.ifr.009.PL"p1:schemaLocation =" spds.ifr.009.PL http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL & amp; rs 3aFormat % = XML & amp; % 3aSchema rc = True "REPORTNAME1 ="abc abc abc">
    < detail ISIN = "AB0123456789" / >
    < detail ISIN = "XY0123456789" VALUE = "2" / >
    < / report >

    Version of the database is:
    11.1.0.7.0
    but probably I'll have to do the same thing on 10.2.0.3.0


    Any suggestion, please.

    And thanks in advance.

    Looks like we cannot manage this value of the schema location indicator... Not even sure we should, to be honest...

    You can use a workaround like this...

    SQL> VAR XMLSCHEMA CLOB
    SQL> VAR INSTANCE CLOB
    SQL> VAR SCHEMAURL VARCHAR2(700)
    SQL> --
    SQL> set define off
    SQL> --
    SQL> begin
      2     :SCHEMAURL := 'http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL&rs%3aFormat=XML&rc%3aSchema=True';
      3    :XMLSCHEMA :=
      4  '
      5  
      6     
      7             
      8                     Report
      9             
     10             
     11                     
     12                             
     13                     
     14                     
     15                             
     16                                     abc xyz
     17                             
     18                             
     19                                     
     20                             
     21                     
     22             
     23     
     24     
     25             
     26                     Details
     27             
     28             
     29                     
     30                             
     31                                     Valuate
     32                             
     33                     
     34                     
     35                             
     36                                     ISIN
     37                             
     38                             
     39                                     
     40                             
     41                     
     42             
     43     
     44  ';
     45    :INSTANCE :=
     46  '
     47  
     48  
     49  
     50  ';
     51  end;
     52  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.04
    SQL> --
    SQL> set define on
    SQL> --
    SQL> BEGIN
      2    DBMS_XMLSCHEMA.registerSchema
      3    (
      4       SCHEMAURL => :SCHEMAURL,
      5       SCHEMADOC => :XMLSCHEMA
      6    );
      7  END;
      8  /
    BEGIN
    *
    ERROR at line 1:
    ORA-31000: Resource
    'http://inetsqlcg:82/ReportServer?/ReportPublisher/spds.ifr.009.PL&rs:Format=XML
    &rc:Schema=True' is not an XDB schema document
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 72
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 33
    ORA-06512: at line 2
    
    Elapsed: 00:00:00.04
    SQL> desc REP
    ERROR:
    ORA-04043: object REP does not exist
    
    SQL> --
    SQL> INSERT INTO REP VALUES ( XMLTYPE(:INSTANCE ))
      2  /
    INSERT INTO REP VALUES ( XMLTYPE(:INSTANCE ))
                *
    ERROR at line 1:
    ORA-00942: table or view does not exist
    
    Elapsed: 00:00:00.01
    SQL> --
    SQL> set define off
    SQL> --
    SQL> begin
      2     :SCHEMAURL := 'http://inetsqlcg:82/ReportServer';
      3    :XMLSCHEMA :=
      4  '
      5  
      6     
      7             
      8                     Report
      9             
     10             
     11                     
     12                             
     13                     
     14                     
     15                             
     16                                     abc xyz
     17                             
     18                             
     19                                     
     20                             
     21                     
     22             
     23     
     24     
     25             
     26                     Details
     27             
     28             
     29                     
     30                             
     31                                     Valuate
     32                             
     33                     
     34                     
     35                             
     36                                     ISIN
     37                             
     38                             
     39                                     
     40                             
     41                     
     42             
     43     
     44  ';
     45    :INSTANCE :=
     46  '
     47  
     48  
     49  
     50  ';
     51  end;
     52  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.01
    SQL> --
    SQL> set define on
    SQL> --
    SQL> BEGIN
      2    DBMS_XMLSCHEMA.registerSchema
      3    (
      4       SCHEMAURL => :SCHEMAURL,
      5       SCHEMADOC => :XMLSCHEMA
      6    );
      7  END;
      8  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:08.71
    SQL> desc REP
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
    TABLE of SYS.XMLTYPE(XMLSchema "http://inetsqlcg:82/ReportServer" Element "Report") STORAGE Object-relational TYPE "REP_T"
    
    SQL> --
    SQL> set long 10000
    SQL> select updateXML(XMLTYPE(:INSTANCE),'/Report/@p1:schemaLocation','spds.ifr.009.PL http://inetsqlcg:82/ReportServer','xmlns:p1="http://www.w3.org/2001/XMLSc
    hema-instance" xmlns="spds.ifr.009.PL"')
      2    from dual
      3  /
    
    UPDATEXML(XMLTYPE(:INSTANCE),'/REPORT/@P1:SCHEMALOCATION','SPDS.IFR.009.PLHTTP:/
    --------------------------------------------------------------------------------
    
    
      
      
    
    
    Elapsed: 00:00:00.03
    SQL> INSERT INTO REP VALUES ( updateXML(XMLTYPE(:INSTANCE),'/Report/@p1:schemaLocation','spds.ifr.009.PL http://inetsqlcg:82/ReportServer','xmlns:p1="http://www
    .w3.org/2001/XMLSchema-instance" xmlns="spds.ifr.009.PL"'))
      2  /
    
    1 row created.
    
    Elapsed: 00:00:00.01
    SQL> select * from REP
      2  /
    
    SYS_NC_ROWINFO$
    --------------------------------------------------------------------------------
    
    
      
      
    
    
    Elapsed: 00:00:00.56
    SQL>
    
  • Difficult to extract multiple values from an XML document

    I have the following XML Document
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
       <s:Header>
          <ActivityId CorrelationId="4fc67c0d-4416-4c1f-92c5-0d6624fb41fd" 
    xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">30ccb32d-d6f5-4442-a41a-1eb735112501</ActivityId>
       </s:Header>
       <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <FacilitySiteInteractionList xmlns="urn:WA.Ecy.ADS.FacilitySite.Services">
             <FacilitySiteInteraction>
                <Id>78105</Id>
                <StartDate>2009-07-31T00:00:00</StartDate>
                <StatusCode>65</StatusCode>
                <InteractionTypeCode>WQGSWI</InteractionTypeCode>
                <FacilitySiteId>14951</FacilitySiteId>
                <CurrentSystemProgramName>WATQUAL</CurrentSystemProgramName>
                <CurrentSystemName>WPLCS</CurrentSystemName>
                <FederalProgramId/>
                <EndDate xsi:nil="true"/>
                <InteractionId>78105</InteractionId>
                <ProgramFacilitySiteName>Hedwall Inc.</ProgramFacilitySiteName>
                <ModifiedDate>2009-07-31T07:30:57.99</ModifiedDate>
                <ModifiedByName>taus461</ModifiedByName>
                <CreatedDate>2009-07-31T07:30:57.99</CreatedDate>
                <FS_FEATUREs/>
             </FacilitySiteInteraction>
             <FacilitySiteInteraction>
                <Id>78104</Id>
                <StartDate>2009-07-01T00:00:00</StartDate>
                <StatusCode>65</StatusCode>
                <InteractionTypeCode>WQMJIND</InteractionTypeCode>
                <FacilitySiteId>14951</FacilitySiteId>
                <CurrentSystemProgramName>WATQUAL</CurrentSystemProgramName>
                <CurrentSystemName>WPLCS</CurrentSystemName>
                <FederalProgramId/>
                <EndDate xsi:nil="true"/>
                <InteractionId>78104</InteractionId>
                <ProgramFacilitySiteName>Hedwall Inc.</ProgramFacilitySiteName>
                <ModifiedDate>2009-07-31T07:24:02.76</ModifiedDate>
                <ModifiedByName>taus461</ModifiedByName>
                <CreatedDate>2009-07-31T07:24:02.76</CreatedDate>
                <FS_FEATUREs/>
             </FacilitySiteInteraction>
          </FacilitySiteInteractionList>
          <TotalRowCount xmlns="urn:WA.Ecy.ADS.FacilitySite.Services">2</TotalRowCount>
       </s:Body>
    </s:Envelope>
    I need to retrieve the Id of the node FacilitySiteInteraction - in this case, the values are 78104 and 78105.

    I tried to use extractvalue just, but he hesitates with error ORA-19025.
    select extractvalue(x,'//FacilitySiteInteractionList/FacilitySiteInteraction/Id','xmlns="urn:WA.Ecy.ADS.FacilitySite.Services"')
    from my_tab;
    
    ERROR at line 2:
    ORA-19025: EXTRACTVALUE returns value of only one node
    
    -- note: column my_tab.x is an xmltype data type
    If I use just extracted I see there the rub
    select extract(x,'//FacilitySiteInteractionList/FacilitySiteInteraction/Id',
    'xmlns="urn:WA.Ecy.ADS.FacilitySite.Services"')
    from my_tab;
    
    <Id xmlns="urn:WA.Ecy.ADS.FacilitySite.Services">78105</Id><Id xmlns="urn:WA.Ecy.ADS.FacilitySite.Services">78104</Id>
    The format of the XML document does not have to consider another records/lines.

    So, the next thing I tried was using the value of the iterator:
    select extractvalue(x,'//FacilitySiteInteractionList/FacilitySiteInteraction[2]/Id',
    'xmlns="urn:WA.Ecy.ADS.FacilitySite.Services"')
    from my_tab;
    
    78104
    The downside of what I see is that I must first enter the TotalRowCount value and then more wrap XML Document TotalRowCount times
    in order to get these values. So I was wondering if it is a more effective approach to enter these data?

    Thank you, Tony
    SQL>  with t as (
    select xmltype('
    
       
          30ccb32d-d6f5-4442-a41a-1eb735112501
       
       
          
             
                78105
                2009-07-31T00:00:00
                65
                WQGSWI
                14951
                WATQUAL
                WPLCS
                
                
                78105
                Hedwall Inc.
                2009-07-31T07:30:57.99
                taus461
                2009-07-31T07:30:57.99
                
             
             
                78104
                2009-07-01T00:00:00
                65
                WQMJIND
                14951
                WATQUAL
                WPLCS
                
                
                78104
                Hedwall Inc.
                2009-07-31T07:24:02.76
                taus461
                2009-07-31T07:24:02.76
                
             
          
          2
       
    ') xml from dual
    )
    --
    select x.* from t t, xmltable('declare namespace e="urn:WA.Ecy.ADS.FacilitySite.Services";
                                 //e:Id' passing t.xml.extract('//FacilitySiteInteraction','xmlns="urn:WA.Ecy.ADS.FacilitySite.Services"')
                                 columns Id int path '.') x
    /
            ID
    ----------
         78105
         78104
    
    2 rows selected.
    
  • Is it safe to remove the date in the name of the xml document?

    Hi, the iTunes library xml document is titled "iTunes Library" 2015-07-11. Is this correct and problems can occur if l remove the name date?

    L ask because my Sonos system has trouble with importing iTunes playlists and they are suggesting that the document name length perhaps the question.

    Thank you

    This file is a copy of the database (.itl) iTunes created by iTunes, during an update.  The XML version of the library is always called iTunes Library.xml.  Is there is no basis for comment by Sonos, that it may be related to the length of the absolute path of the XML file - where it is on your system?

  • Error unhandled exception has occurred in a component in your application. There is an error in XML document (0 0).

    Original title: Microsoft.NET Framework

    I got a message saying that the unhandled exception has occurred in a component in your application. There is an error in XML document (0 0). What should I do?

    Hello

    1. which version of the Windows operating system is installed on the computer?

    2. Once you get the error message?

    3. What is the exact error message you get?

    4 did you last modified the software on the computer?

    I suggest you go through the steps mentioned in the link. What version of the operating system Windows am I running?

    http://Windows.Microsoft.com/en-us/Windows7/help/which-version-of-the-Windows-operating-system-am-i-running

    Step 1:

    I suggest to start your computer in safe mode and check if the problem persists.

    Start your computer in safe mode

    http://Windows.Microsoft.com/en-us/Windows7/start-your-computer-in-safe-mode

    Step 2:

    I also suggest you to perform a clean boot to safe mode and check.

    Clean boot:

    This could happen if one of the substantive programmes is in conflict with the proper functioning of your computer. To help resolve the error and other messages, you can start Windows 7 by using a minimal set of drivers and startup programs. This type of boot is known as a "clean boot". A clean boot helps eliminate software conflicts.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or Windows 7 http://support.microsoft.com/kb/929135

    Note: when you are finished troubleshooting, follow step 7 article to start the computer to a normal startup.

  • How to use CAPICOM to digitally sign an xml document given a certifcate security uses the RSA-SHA256 algorithm

    We have an old VB6 application that uses CAPICOM to digitally sign an xml document?  The certificate of the previous guest set implemented the RSA-SHA1 algorithm.

    New client certificate using RSA-SHA256.  Can I use CAPICOM2 or .NET to use the new certificate to accomplish the same function?

    Hello

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT audience Pro on MSDN. Please post your question in the MSDN forum. You can follow the link to your question:

    http://social.msdn.Microsoft.com/forums/en-us/categories/

Maybe you are looking for

  • The rating from 5 to 6 seconds

    I want to trade my 5S for a 6. I was given an estimate of £150 for my 5s online. I don't want to do it by mail, so I can just go to my local store to Apple (Brighton) and make on-site, so I'm not without phone? Not sure how it is simple, it is with t

  • Need USB 3.0 driver for HP TouchSmart 520-1168

    Had to format my hd because of some weird problems and reinstall windows 7 cost. Rose any return other than drivers USB 3.0 ports on the left side. They are not on the list of driver for a reason 1168 download any. Tried the sp55506.exe pilots of the

  • Anti Virus Protection

    Failed to open Avast download from cnet. Cannot open anti-virus on Apple store. After clicking Download, a message reads that Safari is not opening. What application is necessary? Has received a warning from the Trojan horse after the opening of a pi

  • NI 9219 bandwidth

    What is the bandwidth of the analog filter prior to CDA?

  • HP OfficeJet Pro 8600: Accidentally hit disable all in settings admin and can't go in the settings.

    I'm went to the site with the ip address andwhile I was in admin settings I touched off all and accidentally disabled the built-in networking features. How can I go back. Hi, if this solution worked for you please go to options and click on accept as