Error at insert  xml data

i follow the next steps:
1.- i create a schema "ficha.xsd"
<?xml version="1.0" encoding="UTF-8" ?>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="ficha" type="fichaType" />
- <xsd:complexType name="fichaType">
- <xsd:sequence>
<xsd:element name="antecedentesPersonales" type="antecedentesPersonalesType" />
</xsd:sequence>
<xsd:attribute name="identificador" type="xsd:integer" />
</xsd:complexType>
- <xsd:complexType name="antecedentesPersonalesType">
- <xsd:sequence>
<xsd:element name="nombrePrincipal" type="xsd:string" />
<xsd:element name="nombreSecundario" type="xsd:string" />
<xsd:element name="apellidoPaterno" type="xsd:string" />
<xsd:element name="apellidoMaterno" type="xsd:string" />
<xsd:element name="genero" type="xsd:string" />
<xsd:element name="fechaNacimiento" type="xsd:string" />
<xsd:element name="direccionPersonal" type="xsd:string" />
<xsd:element name="ciudad" type="xsd:string" />
<xsd:element name="region" type="xsd:string" />
<xsd:element name="pais" type="xsd:string" />
</xsd:sequence>
<xsd:attribute name="rut" type="xsd:string" />
</xsd:complexType>
</xsd:schema>
2.- i register the schema in bd (before i load the schema to the BD by ftp to http://localhost:8080/home/OE/xsd)
begin
dbms_xmlschema.registerSchema(
'http://localhost:8080/home/OE/xsd/ficha.xsd',
xdbURIType('/home/OE/xsd/ficha.xsd').getClob(),
TRUE,TRUE,FALSE,TRUE
end;
3.- i created the table
CREATE TABLE XML1010 of XMLType
XMLSCHEMA "http://localhost:8080/home/OE/xsd/ficha.xsd"
ELEMENT "ficha";
4. create directory
create or replace directory PRUEBA1010
as 'C:\tamino\10_elementos\10_archivos';
5.insert data xml
INSERT INTO XML1010
VALUES
xmltype
bfilename('PRUEBA1010','0prueba.xml'),
nls_charset_id('AL32UTF8')
the error is : ORA-19007:Schema -does not match expected http://localhost:8080/home/OE/xsd/ficha.xsd
Whta i doing wrong?

You need to associated your XML Instance with the XML Schema. This can be done three ways at shown below
SQL>
SQL> var schemaURL varchar2(256)
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
  2    :schemaURL := 'http://localhost:8080/home/OE/xsd/ficha.xsd';
  3    :schemaPath := '/home/SCOTT/ficha.xsd';
  4  end;
  5  /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
  2  /
Call completed.
SQL> declare
  2    res boolean;
  3    xmlSchema xmlType := xmlType(
  4  '<?xml version="1.0" encoding="UTF-8"?>
  5  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
  6     <xsd:element name="ficha" type="fichaType" xdb:defaultTable="XML1010"/>
  7     <xsd:complexType name="fichaType">
  8             <xsd:sequence>
  9                     <xsd:element name="antecedentesPersonales" type="antecedentesPersonalesType"/>
10             </xsd:sequence>
11             <xsd:attribute name="identificador" type="xsd:integer"/>
12     </xsd:complexType>
13     <xsd:complexType name="antecedentesPersonalesType">
14             <xsd:sequence>
15                     <xsd:element name="nombrePrincipal" type="xsd:string"/>
16                     <xsd:element name="nombreSecundario" type="xsd:string"/>
17                     <xsd:element name="apellidoPaterno" type="xsd:string"/>
18                     <xsd:element name="apellidoMaterno" type="xsd:string"/>
19                     <xsd:element name="genero" type="xsd:string"/>
20                     <xsd:element name="fechaNacimiento" type="xsd:string"/>
21                     <xsd:element name="direccionPersonal" type="xsd:string"/>
22                     <xsd:element name="ciudad" type="xsd:string"/>
23                     <xsd:element name="region" type="xsd:string"/>
24                     <xsd:element name="pais" type="xsd:string"/>
25             </xsd:sequence>
26             <xsd:attribute name="rut" type="xsd:string"/>
27     </xsd:complexType>
28  </xsd:schema>');
29  begin
30    if (dbms_xdb.existsResource(:schemaPath)) then
31      dbms_xdb.deleteResource(:schemaPath);
32    end if;
33    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
34  end;
35  /
PL/SQL procedure successfully completed.
SQL> begin
  2    dbms_xmlschema.registerSchema
  3    (
  4      :schemaURL,
  5      xdbURIType(:schemaPath).getClob(),
  6      TRUE,TRUE,FALSE,TRUE
  7    );
  8  end;
  9  /
PL/SQL procedure successfully completed.
SQL> INSERT INTO XML1010 VALUES ( xmltype(
  2  '<?xml version="1.0" encoding="UTF-8"?>
  3  <ficha identificador="2">
  4     <antecedentesPersonales rut="10000001">
  5             <nombrePrincipal>Juan</nombrePrincipal>
  6             <nombreSecundario>Jose</nombreSecundario>
  7             <apellidoPaterno>Perez</apellidoPaterno>
  8             <apellidoMaterno>Soto</apellidoMaterno>
  9             <genero>M</genero>
10             <fechaNacimiento>15-11-1979</fechaNacimiento>
11             <direccionPersonal>Los Alarces s/n</direccionPersonal>
12             <ciudad>Valdivia</ciudad>
13             <region>10</region>
14             <pais>Chile</pais>
15     </antecedentesPersonales>
16  </ficha>',:schemaURL))
17  /
1 row created.
SQL> INSERT INTO XML1010 VALUES ( xmltype(
  2  '<?xml version="1.0" encoding="UTF-8"?>
  3  <ficha identificador="2">
  4     <antecedentesPersonales rut="10000001">
  5             <nombrePrincipal>Juan</nombrePrincipal>
  6             <nombreSecundario>Jose</nombreSecundario>
  7             <apellidoPaterno>Perez</apellidoPaterno>
  8             <apellidoMaterno>Soto</apellidoMaterno>
  9             <genero>M</genero>
10             <fechaNacimiento>15-11-1979</fechaNacimiento>
11             <direccionPersonal>Los Alarces s/n</direccionPersonal>
12             <ciudad>Valdivia</ciudad>
13             <region>10</region>
14             <pais>Chile</pais>
15     </antecedentesPersonales>
16  </ficha>').createSchemaBasedXML(:schemaURL))
17  /
1 row created.
SQL> INSERT INTO XML1010 VALUES ( xmltype(
  2  '<?xml version="1.0" encoding="UTF-8"?>
  3  <ficha identificador="2"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://localhost:8080/ho
me/OE/xsd/ficha.xsd">
  4     <antecedentesPersonales rut="10000001">
  5             <nombrePrincipal>Juan</nombrePrincipal>
  6             <nombreSecundario>Jose</nombreSecundario>
  7             <apellidoPaterno>Perez</apellidoPaterno>
  8             <apellidoMaterno>Soto</apellidoMaterno>
  9             <genero>M</genero>
10             <fechaNacimiento>15-11-1979</fechaNacimiento>
11             <direccionPersonal>Los Alarces s/n</direccionPersonal>
12             <ciudad>Valdivia</ciudad>
13             <region>10</region>
14             <pais>Chile</pais>
15     </antecedentesPersonales>
16  </ficha>'))
17  /
1 row created.
SQL>
SQL>
SQL>The first example explicitly passes the SchemaURL as the second argument to the XMLType constructor.
The second examples uses the createSchemaBasedXML() to create a Schema based XML type from a non schema based xmltype
Thre third uses the W3C specified XMLSchema-Instnace attributes to identify the XML schema the instance is associated with.

Similar Messages

  • Error while inserting XML data

    Hi,
    When I try to insert xml data, it gives the following error.
    --CREATE TABLE XMLTABLE OF XMLType;
    INSERT INTO XMLTABLE VALUES(XMLTYPE(getCLOBDocument('example.xml')));
    ORA-00600: internal error code, arguments: [qmxiUnpPacked2], [121], [], [], [], [], [], []
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    Any ideas?

    I've updated the FAQ with the answer to this one..
    XML DB FAQ

  • Error while inserting xml data into table

    Hello
    I am running thid stored procedure and this compiles correctly , but when I try to execute it gives me a error, I have been trying this form the past 3 days , could anyone please help me ASAP
    SQL> CREATE OR REPLACE PROCEDURE loadxml12 AS
    2 fil BFILE;
    3 buffer RAW(32767);
    4 len INTEGER;
    5 insrow INTEGER;
    6 BEGIN
    7 SELECT f_lob INTO fil FROM xml_temp12 WHERE key = 1;
    8 DBMS_LOB.FILEOPEN(fil,DBMS_LOB.FILE_READONLY);
    9 len := DBMS_LOB.GETLENGTH(fil);
    10 DBMS_LOB.READ(fil,len,1,buffer);
    11 xmlgen.resetOptions;
    12 insrow := xmlgen.insertXML('xml_doc',UTL_RAW.CAST_TO_VARCHAR2(buffer));
    13 DBMS_OUTPUT.PUT_LINE(insrow);
    14 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    15 DBMS_LOB.FILECLOSE(fil);
    16 END IF;
    17 EXCEPTION
    18 WHEN OTHERS THEN
    19 DBMS_OUTPUT.PUT_LINE('In Exception');
    20 DBMS_OUTPUT.PUT_LINE(SQLERRM(SQLCODE));
    21 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    22 DBMS_LOB.FILECLOSE(fil);
    23 END IF;
    24 end;
    25 /
    Procedure created.
    SQL> exec loadxml12
    In Exception
    BEGIN loadxml12; END;
    ERROR at line 1:
    ORA-20000: ORU-10028: line length overflow, limit of 255 bytes per line
    ORA-06512: at "SYS.DBMS_OUTPUT", line 99
    ORA-06512: at "SYS.DBMS_OUTPUT", line 65
    ORA-06512: at "CARCLUB_RW2.LOADXML12", line 20
    ORA-06512: at line 1
    null

    Could you explain what your procedure does, please. I also tried to compile it but always got error message:
    PL/SQL: SQL Statement ignored
    PLS-00385: type mismatch found at 'FIL' in SELECT...INTO
    statement
    SQL> CREATE OR REPLACE PROCEDURE loadxml12 AS
    2 fil BFILE;
    3 buffer RAW(32767);
    4 len INTEGER;
    5 insrow INTEGER;
    6 BEGIN
    7 SELECT f_lob INTO fil FROM xml_temp12 WHERE key = 1;
    8 DBMS_LOB.FILEOPEN(fil,DBMS_LOB.FILE_READONLY);
    9 len := DBMS_LOB.GETLENGTH(fil);
    10 DBMS_LOB.READ(fil,len,1,buffer);
    11 xmlgen.resetOptions;
    12 insrow := xmlgen.insertXML('xml_doc',UTL_RAW.CAST_TO_VARCHAR2(buffer));
    13 DBMS_OUTPUT.PUT_LINE(insrow);
    14 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    15 DBMS_LOB.FILECLOSE(fil);
    16 END IF;
    17 EXCEPTION
    18 WHEN OTHERS THEN
    19 DBMS_OUTPUT.PUT_LINE('In Exception');
    20 DBMS_OUTPUT.PUT_LINE(SQLERRM(SQLCODE));
    21 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    22 DBMS_LOB.FILECLOSE(fil);
    23 END IF;
    24 end;
    25 /
    Bober
    null

  • Steps to insert xml data into oracle

    Please give me next steps to insert xml data into oracle 9i:
    i've been doing this steps :
    1. create folder in oracle port:8080
    2. copy xsd into folder
    3. register schema
    4. Give me next step...
    5.
    6.
    Thanks

    this is my complete xmlschema
    <?xml version = "1.0" encoding = "UTF-8"?>
    <xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
         <xs:element name = "A3A8Vers" type = "xs:string"/>
         <xs:element name = "F1F5Vers" type = "xs:string">
         </xs:element>
         <xs:element name = "sequence" type = "xs:string">
         </xs:element>
         <xs:element name = "amf" type = "xs:string">
         </xs:element>
         <xs:element name = "trnsKeyNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "mac" type = "xs:string">
         </xs:element>
         <xs:element name = "encryptionKey" type = "xs:string">
         </xs:element>
         <xs:element name = "signature" type = "xs:string">
         </xs:element>
         <xs:element name = "signer">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "entityNumber"/>
                        <xs:element ref = "keyNumber"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "entityNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "keyNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "pblKey">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "entityNumber"/>
                        <xs:element ref = "entityRole"/>
                        <xs:element ref = "keyNumber"/>
                        <xs:element ref = "publicKeyVal"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "ntrTime" type = "xs:string">
         </xs:element>
         <xs:element name = "deActionTime" type = "xs:string">
         </xs:element>
         <xs:element name = "actionTime" type = "xs:string">
         </xs:element>
         <xs:element name = "entityRole">
              <xs:complexType>
                   <xs:attribute name = "role" default = "INVALID">
                        <xs:simpleType>
                             <xs:restriction base = "xs:NMTOKEN">
                                  <xs:enumeration value = "TKD"/>
                                  <xs:enumeration value = "SKD"/>
                                  <xs:enumeration value = "INVALID"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
              </xs:complexType>
         </xs:element>
         <xs:element name = "publicKeyVal">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "exponent"/>
                        <xs:element ref = "mod"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "exponent" type = "xs:string">
         </xs:element>
         <xs:element name = "mod" type = "xs:string">
         </xs:element>
         <xs:element name = "encriptionTransKey" type = "xs:string">
         </xs:element>
         <xs:element name = "keyType" type = "xs:string">
         </xs:element>
    </xs:schema>.
    I use command to create table :
    create table elements of xmltype
    xmlschema "http://192.168.1.1:8080/test.xsd"
    element "publicKey"
    . But why the result,table as object type. so i cant use command "desc <table_name>;"

  • Inserting xml data in a MYSQL database

    Hi,
    I would like to know how i can insert data from an xml file into a MYSQL database using a java program, I currently have a program which retrieves an xml record and i need to insert the information between the tags into a table in MYSQL..please help me out if anyone knows...i am not very familiar with java...thanks

    Hi there Sherkhan,
    Im trying to do exactly what ur doing, inserting xml data in to a mySQL database. Any chance u could share the code for this???
    Many thanks in advance.

  • Insert XML data into oracle table

    I want to insert xml data returned by the VB code into oracle table.
    As a prequisite I have installed the XDK capabilities for Oracle by installing JServer & running
    SQL scripts catxsu.sql,xmlparserv2.jar,load.sql to load the XMLSQL Utility (DBMS_XMLQuery) into the database.
    I have also granted following privileges to the user.
    Grant users access to XMLParser and XMLDom packages:
         grant execute on xmldom to public;
         grant execute on xmlparser to public;
         create public synonym xmldom for sys.xmldom;
         create public synonym xmlparser for sys.xmlparser;
    But still i am not able to create procedure which will accept input parameter as an XML document coming from front end which in turn will insert that record into simple oracle table . I am using Oracle 8.1.7
    Thanks in advance

    Would you specify the database version?
    Since DBMS_XMLSave requires DOM, you normally need to divide the huge XML before insertion.

  • Getting Error in inserting the data in ADF

    I am getting the below Error while inserting the data into Essbase in ADF:
    <Error> <Net> <BEA-000902> <Duplicate expression found in the system property http.nonProxyHosts: localhost|localhost.localdomain|127.0.0.1|::1|sgajulap-in|sgajulap-in.>
    Could you please give any solution to resolve this Error.
    Thanks.
    Swathi

    check below links:
    http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
    http://www.rgagnon.com/javadetails/java-0085.html
    // Get a system property
    String dir = System.getProperty("user.dir");
    // Set a system property
    String previousValue = System.setProperty("application.property", "newValue");

  • CPM error: Graphic: Invalid XML data format

    Hi guru's
    When I execute a cockpit the system shows the error: "Graphic: Invalid XML data format"
    We have BI 7.0 and SEM-BW 600 SAPKGS6014
    What can I do.
    Thanks
    Jose

    Hi guru's
    I still with the problem, I found a  Note 768114 - Message 'Invalid XML format' if chart should be displayed. the note decribe my proble exactly. But the correction in the note are only until version 400 of SEM any our company is in 600.
    With this clue, maybe you can help me.
    Jose

  • Error while inserting xml into database

    Hi,
    I'm trying to use the sample application available on OTN site i.e. Simple Bulk Loader Sample Application which inserts a xml more than 4k in xmltype.
    But I am getting this error while using it from JDeveloper
    Here is the error :
    XMLLoader: Uploaded File write to clob c:\temp\sampleXMLFiles\PPF.XML
    XMLLoader: Uploaded File after setc:\temp\sampleXMLFiles\PPF.XML
    java.sql.SQLException: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00229: input source is empty
    Error at line 0
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int)DBError.java:134
    void oracle.jdbc.ttc7.TTIoer.processError()
    Process exited with exit code 0.
    Any ideas !!!
    Thanks
    -Rajeev

    Hi,
    Thanks for the reply.
    Actually it all started with this error while runnning the code in Jdeveloper
    SimpleBulkLoader.doBulkLoad- The system cannot find the path specified. IO:FileNotFound Exception
    Then while debugging I thought its giving error because of writer.close( ); in one of the writeToClob API in BaseApplication.java. So I commented it and then started getting this error which I originally posted
    java.sql.SQLException: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00229: input source is empty
    Error at line 0
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    But now after I uncommented writer.close() and debugged the application again in JDeveloper, I see it reads the xml and keeps it in buffer properly but in the end it throws SQLException "No more data to read from socket" and in turn throws "The system cannot find the path specified. IO:FileNotFound Exception"
    I have no idea what's going on ??
    Thanks
    -Rajeev

  • Problem with inserting XML data server in ODI

    Hi,
    I was trying to insert an XML data server in ODI. I want to use it for my target database.i.e i want my target to be an xml file. So while specifying the url in the data server, what should i mention as the file name,dtd file , root etc? what i have done is dat i hav created the dtd file as per my requirement.i have created an empty xml file. while testing the connection an error comes : java.sql.SQLException: A parsing exception occurred saying Whitespace required..
    Next i tried putting jz d root tags in the xml file without any content. this returned the same error. next i tried inserting all d tags as per my dtd file. same error came...
    Please help.
    Regards,
    Divya
    Message was edited by:
    Divya Padmanabhan

    For empty xml try to use:
    <?xml version="1.0" encoding="UTF-8"?>
    <ROOT_SOME></ROOT_SOME>
    as jdbc connect string:
    jdbc:snps:xml?f=../demo/xml/1/file.xml&ro=false&ldoc=true&case_sens=true&s=LEO_FIZ&dod=true
    and try again...

  • Inserting XML data into xmltype column

    Oracle version: 10.1.0.5
    OpenVms Alpha V8.3
    1) Tried this and get the error shown below. Removed charset and placed a zero. Same error.
    INSERT INTO xml_demo (xml_data) -- column of xmltype
    VALUES
    xmltype
    bfilename('XML_DIR', 'MOL.XML'),
    nls_charset_id('AL32UTF8')
    ORA-22993: specified input amount is greater than actual source amount
    ORA-06512: at "SYS.DBMS_LOB", line 637
    ORA-06512: at "SYS.XMLTYPE", line 283
    ORA-06512: at line 1
    2) This PL/SQL block works. However maximum raw size around 32K. The file can be around 100K. May be I can load it into a table of raw and somehow concatnate it to insert. Not sure whether this is possible but I am sure there must me a simple way of doing this.
    Subset of the xml file is pasted below.
    set serveroutput on size 1000000
    DECLARE
    file1 bfile;
    v_xml XMLType;
    len1 number(6);
    v_rec1 raw(32000);
    BEGIN
    file1 := bfilename('XML_DIR','MOL.XML');
    DBMS_LOB.fileopen(file1, DBMS_LOB.file_readonly);
    len1 := DBMS_LOB.getLength(file1);
    v_rec1 := dbms_lob.substr(file1,len1,1);
    v_xml := xmltype(UTL_RAW.CAST_TO_VARCHAR2(v_rec1));
    INSERT INTO xml_demo (xml_data) VALUES (v_xml);
    COMMIT;
    DBMS_LOB.fileclose(file1);
    exception
    when others then
    dbms_output.put_LINE (sqlerrm);
    DBMS_LOB.fileclose(file1);
    END;
    <?xml version="1.0" encoding="UTF-8"?>
    <MolDocument DtdVersion="3" DtdRelease="0">
    <DocumentIdentification v="MOL_20100331_1500_1600"/>
    <DocumentVersion v="1"/>
    <DocumentType v="A43"/>
    <SenderIdentification codingScheme="A01" v="17X100Z100Z0001H"/>
    <SenderRole v="A35"/>
    <ReceiverIdentification codingScheme="A01" v="10XFR-RTE------Q"/>
    <ReceiverRole v="A04"/>
    <CreationDateTime v="2010-03-31T14:10:00Z"/>
    <ValidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Domain codingScheme="A01" v="10YDOM-1001A001A"/>
    <MolTimeSeries>
    <ContractIdentification v="RTE_20100331_1500_16"/>
    <ResourceProvider codingScheme="A01" v="10XFR-RTE------Q"/>
    <AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
    <ConnectingArea codingScheme="A01" v="10YFR-RTE------C"/>
    <AuctionIdentification v="AUCTION_20100331_1500_1600"/>
    <BusinessType v="A10"/>
    <BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <MeasureUnitQuantity v="MAW"/>
    <Currency v="EUR"/>
    <MeasureUnitPrice v="MWH"/>
    <Direction v="A02"/>
    <MinimumActivationQuantity v="50"/>
    <Status v="A06"/>
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="50.45"/>
    </Interval>
    </Period>
    </MolTimeSeries>
    </MolDocument>

    Marc
    Thanks. I understand what you are saying. I have been copying files in binary mode from NT servers into VMS. I have to get a proper xml file via FTP from the originating system to further investigate.
    I have one last item i need help on. If anything looks obvious let me know:
    +1) The xsd defintion of Qty (type: QuantityType) and EnergyPrice (type: Amount Type)+
                   <xsd:element name="Qty" type="ecc:QuantityType">
                        <xsd:annotation>
                             <xsd:documentation/>
                        </xsd:annotation>
                   </xsd:element>
                   <xsd:element name="EnergyPrice" type="ecc:AmountType" minOccurs="0">
                        <xsd:annotation>
                             <xsd:documentation/>
                        </xsd:annotation>
                   </xsd:element>
    +2) Definition of AmountType and QuantityType in the parent xsd+
         <xsd:complexType name="AmountType">
              <xsd:annotation>
                   <xsd:documentation>
                        <Uid>ET0022</Uid>
                        <Definition>The monetary value of an object</Definition>
                   </xsd:documentation>
              </xsd:annotation>
              <xsd:attribute name="v" use="required">
                   <xsd:simpleType>
                        <xsd:restriction base="xsd:decimal">
                             <xsd:totalDigits value="17"/>
                        </xsd:restriction>
                   </xsd:simpleType>
              </xsd:attribute>
         </xsd:complexType>
         <!--_________________________________________________-->
         <xsd:complexType name="QuantityType">
              <xsd:annotation>
                   <xsd:documentation>
                        <Uid>ET0012</Uid>
                        <Definition>(Synonym "qty") The quantity of an energy product. Positive quantities shall not have a sign.</Definition>
                   </xsd:documentation>
              </xsd:annotation>
              <xsd:attribute name="v" type="xsd:decimal" use="required"/>
         </xsd:complexType>
         <!--________________
    +3. Data in the XML file+
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="50.45"/>
    </Interval>
    +4) When I do the load:+
    the EnergyPrice is saved in the xmltype column as <EnergyPrice v="50"/>
    Losing its decimal value of .45
    +5) When I select as follows:+
    **DEV** SQL>> l
    1 SELECT
    2 EXTRACTVALUE(x2.column_value,'/MolTimeSeries/Period/Interval/EnergyPrice/@v') v1,
    3 EXTRACTVALUE(x2.column_value,'/MolTimeSeries/Period/Interval/EnergyPrice') v2,
    4 EXTRACTVALUE(x2.column_value,'/MolTimeSeries/Period/Interval/Qty') v3
    5 FROM balit_mol_xml x,
    6 TABLE(
    7 XMLSEQUENCE(
    8 EXTRACT(x.xml_payload, '/MolDocument/MolTimeSeries')
    9 )
    10 ) x2
    11* WHERE EXISTSNODE(x.xml_payload,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1
    +6) get the result+
    50
    AmountType479_T(XDB$RAW_LIST_T('1301000000'), 50)
    QuantityType471_T(XDB$RAW_LIST_T('1301000000'), 50)
    +7) XDB$RAW_LIST_T('1301000000'),+
    Does that tell what I am doing wrong?

  • Error when inserting xml with xsi:noNamespaceSchemaLocation

    Hello,
    Hopefully this isn't a stupid question....
    I am currently using Oracle 9.2.0.6.0 to try out XML.
    I haven't been able to get our DBAs to set up XML DB in its entirety so I just have the basics, i.e. I have access to the xmltype object but none of the packages like DBMS_SCHEMA and DBMS_XDB. Therefore, I haven't been able to register any schemas in the database.
    So what I'd like to know is why do I get an ORA-21700 error when I try to load an xml document which has the 'xsi:noNamespaceSchemaLocation' attribute'. If I take this out of the XML document, it loads.
    From my initial reading, I got the impression that registering a schema in order to validate documents was an optional, although probably an ideal, step to take.
    So another way of phrasing this subject might be: can one insert xml documents without the use of a schema?
    The example code is shown below.
    dbase> INSERT INTO MY_TABLE( id , message_type , status , rcvd_time, filename , xmlcol)
    2 VALUES ( 1, 0 , 'RECEIVED', sysdate , 'tempfilename' ,
    3 xmltype('<ExampleXML xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
    4 xsi:noNamespaceSchemaLocation = "ExampleXML.xsd">
    5 <tag1>
    6 <tag2 attr1="something">Some data
    7 </tag2>
    8 </tag1>
    9 </ExampleXML>')
    10 );
    xmltype('<ExampleXML xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
    ERROR at line 3:
    ORA-21700: object does not exist or is marked for delete
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    dbase> ed
    Wrote file afiedt.buf
    1 INSERT INTO MY_TABLE ( id , message_type , status , rcvd_time, filename , xmlcol)
    2 VALUES ( 1, 0 , 'RECEIVED', sysdate , 'tempfilename' ,
    3 xmltype('<ExampleXML xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
    4 >
    5 <tag1>
    6 <tag2 attr1="something">Some data
    7 </tag2>
    8 </tag1>
    9 </ExampleXML>')
    10* )
    dbase> /
    1 row created.
    The xmlcol column was created simply as an xmltype column.

    Basically using XMLType without XML DB is almost impossible in 9.2.x. Please have the DBA's install XML DB by running the script $ORACLE_HOME/rdbms/admin/catqm.sql. They can follow the installing XDB instuctions in the XML DB Developer's guide.
    What is actually happening here is that the PARSER is hard wired to always check is a document that contains an noNamespaceSchemaLocation or schemaLocation tag is associated with an XML Schema that has been registered with Oracle XML DB. If is is, special action is takem, if it isn't then no special action is taken. Unfortunately for various arcane technical reasons if the the XDB repository is not present the check fails totally. Even if we fixed this bug, which has been marked not feasible to fix in the past, there are many other issues with the inbuilt XML technology having dependancies on the presence of the XML DB repository and XDB database user.
    So the net/net is don't use XMLType or any XML related features in 9.2.x or later unless XML DB is installed. It is extremenly likely at this point in time that XML DB will become a mandatory component of the next release of the database. At that point you will no longer have an option. It will be automatically installed when a database is created or updated and there will be no way of un-installing it.

  • INSERT XML data from CLOB

    Hi Guys,
    I wonder if you can help me out , I m trying to insert a XML stored in a CLOB column as an XMLTYPE.. the example at eh end works but when i add in the sSELCT statement I get eh following error...
    INSERT INTO tmp_xml_table VALUES
    (11, 'select data from tmp_requests where id = 159');
    SQL Error: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00210: expected '<' instead of 's'
    Error at line 1
    31011. 00000 - "XML parsing failed"
    *Cause:    XML parser returned an error while trying to parse the document.
    *Action:   Check if the document to be parsed is valid.
    DESC tmp_xml_table
    Name Null Type
    ID NUMBER
    DATA XMLTYPE()
    this bit works....
    INSERT INTO myTable VALUES (1, SYS.XMLType.CreateXML(
    '<?xml version="1.0"?>
    <fall>
    <name>myTable</name>
    <county>USA</county>
    <state>MI</state>
    <url>
    http://your.com
    </url>
    </fall>'));

    You are trying to insert the literal string 'select data from tmp_requests where id = 159', which is not valid XML.
    Try:
    insert into tmp_xml_table
    select 11, data from tmp_requests where id=159;

  • How to validate inserted xml data in oracle is correct or not

    (i.e.how to validate xml syntax and tags are correct)
    XML data has been inserted in Oracle database.Once inserted
    I want to validate that data entered and tags inserted are correct
    or not.
    Pl help

    Some small remarks after a life time of write that small notepad.
    Don't use XMLIsValid() - Apperently it was once ment for use in table constraints only AND the most annoying part, it doesn't give you a proper error message.
    More usable is schemaValidate() - it throws a useful error message... I never came around to update that post or write a proper one while using schemaValidate().
    I would be against advising / using a Java wrapper to achieve this goal unless you are on a pre 9.2 database version. Registering, validation and such is optimized (in memory) in Oracle from the beginning in 9.2.0.3 and onwards to avoid for instance reparsing of the XML Schema itself. If a XML Schema is registered a lot is optimized including DOM, which will be avoided and "outsmarted" by using XOB objects (see the Oracle manuals only a few hits and those will point you directly to the optimizations at hand).

  • How to get ALL validate-errors while insert xml-file into xml_schema_table

    How to get all validate-errors while using insert into xml_schema when having a xml-instance with more then one error inside ?
    Hi,
    I can validate a xml-file by using isSchemaValid() - function to get the validate-status 0 or 1 .
    To get a error-output about the reason I do validate
    the xml-file against xdb-schema, by insert it into schema_table.
    When more than one validate-errors inside the xml-file,
    the exception shows me the first error only.
    How to get all errors at one time ?
    regards
    Norbert
    ... for example like this matter:
    declare
         xmldoc CLOB;
         vStatus varchar
    begin     
    -- ... create xmldoc by using DBMS_XMLGEN ...
    -- validate by using insert ( I do not need insert ;-) )      
         begin
         -- there is the xml_schema in xdb with defaultTable XML_SCHEMA_DEFAULT_TABLE     
         insert into XML_SCHEMA_DEFAULT_TABLE values (xmltype(xmldoc) ) ;
         vStatus := 'XML-Instance is valid ' ;
         exception
         when others then
         -- it's only the first error while parsing the xml-file :     
              vStatus := 'Instance is NOT valid: '||sqlerrm ;
              dbms_output.put_line( vStatus );      
         end ;
    end ;

    If I am not mistaken, the you probably could google this one while using "Steven Feuerstein Validation" or such. I know I have seen a very decent validation / error handling from Steven about this.

Maybe you are looking for

  • 10.5.3 Installation error, macbook won't log on

    After a failed upgrade, my Macbook won't go beyond the log in screen. Please help. Thankx in advance.

  • Piped streams, data lines and threads - what's the bug?

    Please, help! What is wrong here and what should I do to make it running? Strictly speaking, one thread becomes blocked (in) and another runs in a short circuit (out). The code is:     TargetDataLine stdin;     SourceDataLine stdout;     PipedInputSt

  • Having email trouble with iPad

    All of a sudden I'm not receiving emails on my iPad, it just keeps on saying the mail server "imapgmail.com is not responding verify if I have entered the correct account into mail settings

  • Slideshow in pse8 for mac

    Um. I'm trying to create a sldeshow that I can upload to youtube.  When I click create/create pdf slideshow it opens bridge and allows selection of some pictures, but never does anything else.  I read the threads here about this whih described the sl

  • Suffering from poor performance

    Recently my iMac has suffered from a sever drop in performance. This has happened between uses, (although about 3 months apart due to house re-arangement and storage) however the performance has dropped noticeably. I am suffering from lengthened load