Invalid XML document can be inserted

Hi,
I'm using Oracle 10g Enterprise Edition Release 10.1.0.4.0. I have a schema based (XSD) database where I'm trying to insert invalid document and it works :(
Here is an extract of the schema :
     <xsd:element name="quantity">
          <xsd:simpleType>
               <xsd:restriction base="xsd:positiveInteger">
                    <xsd:maxExclusive value="100"/>
               </xsd:restriction>
          </xsd:simpleType>
     </xsd:element>
If I put a XML document with invalid data like "<quantity>230</quantity>" I have not error message from Oracle. The XML is inserted !
Is this error corresponding to "Bug 4329431 DBMS_XMLPARSER ignores errors while parsing invalid XML document" or is it another bug ?
Thanks

Try doing a search on schemaValidate() in this forum. The gist of it is that you need to invoke the schemaValidate() method. By default we do a lax validation that checks things like mandatory elements are present etc.To perform a full schema validation use a trigger or procedure to invoke this method on the XMLType
Eg
create or replace trigger validate_xml before insert on my_xml_table
for each row
begin
   :new.object_value.schemaValidate();
end;
/

Similar Messages

  • Invalid XML Document in BPEL Human Task - TaskService

    Hi Experts
    I am getting the following run time error in BPEL console in my bpel process which has got a human task.
    ==================================================================
    Invalid xml document.*
    According to the xml schemas, the xml document is invalid. The reason is: Error::cvc-datatype-valid.1.2.1: '' is not a valid value for 'dateTime'.*
    Error::cvc-type.3.1.3: The value '' of element 'expirationDate' is not valid.*
    Please make sure that the xml document is valid against your schemas.*
    ==================================================================
    BPEL console is validating all incoming and outgoing XML document against the relevant schema since the configuration property, validateXML has
    set to strict in the BPE console domain, which it has to be.
    This complain is regarding the element expirationDate in the response message of the human task, which cannot be explicitly set in the bpel process.
    Please help me to resolve this issue.
    Thanks
    Jamith

    Hi
    This has been escalated to Oracle and has been identified as a bug.
    Anyway, can you please explain bit more about you workaround?
    Thanks
    Jamith

  • Invalid xml document for BPEL Process.

    Hi everyone,
    I am getting below error after i set validateXML=strict
    Invalid xml document.
    According to the xml schemas, the xml document is invalid. The reason is: Error::cvc-datatype-valid.1.2.1: '' is not a valid value for 'decimal'.
    Error::cvc-type.3.1.3: The value '' of element 'ns1:p_person_id' is not valid.
    Please make sure that the xml document is valid against your schemas.
    Kindly help me with the steps. I am just a SOA admin, not developer.
    Regards
    Lammeki.

    Ummmm Vikas,
    Lemme bring out a better picture, so u get more clear on this one.
    The developer has upgraded an already deployed BPEL process.
    Since then, she has been facing problem. When she invoke those process they simply end up as faulted with a yellow color ! mark.
    Now i as an admin, i tried everything to help her cos she escalated the issue to me, thinking maybe there is sumthing i could do to assists her.
    Now i am not sure, how to help her, but yes i started with the logs. Both the oc4j container log for SOA and the domain log show the similar error.
    But till then, i didn't know black and white of it. so i tried doing all testing possible from my end.
    When i check on the faulted instances i see there is a Assign activity after Transform followed by Invoked being highlighted in red color. and when i clicked on it i get to see the error
    Assign_41
    [2011/07/21 02:26:15]
    Error in evaluate <from> expression at line "315". The result is empty for the XPath expression : "/ns6:QueryPerAllPeopleOutputCollection/ns6:QueryPerAllPeopleOutput/ns6:EMPLOYEE_NUMBER".
    oracle.xml.parser.v2.XMLElement@1ee216f
    Copy details to clipboard
    [2011/07/21 02:26:15]
    "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.
    - <selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    - <part name="summary">
    <summary>
    empty variable/expression result.
    xpath variable/expression expression "/ns6:QueryPerAllPeopleOutputCollection/ns6:QueryPerAllPeopleOutput/ns6:EMPLOYEE_NUMBER" is empty at line 315, when attempting reading/copying it.
    Please make sure the variable/expression result "/ns6:QueryPerAllPeopleOutputCollection/ns6:QueryPerAllPeopleOutput/ns6:EMPLOYEE_NUMBER" is not empty.
    Possible reasons behind this problems are: some xml elements/attributes are optional or the xml data is invalid according to XML Schema.
    To verify whether XML data received by a process is valid, user can turn on validateXML switch at the domain administration page.
    </summary>
    </part>
    </selectionFailure>
    Copy details to clipboard
    So because of that instruction i went ahead and set validateXML=strict
    and that is when i got the error message as below
    Invoke_PerAllPeople
    [2011/07/21 11:47:12]
    Invalid data: The value for variable "Invoke_PerAllPeople_QueryPerAllPeople_InputVariable", part "QueryPerAllPeopleInput_msg" does not match the schema definition for this part.The invalid xml document is shown below:
    oracle.xml.parser.v2.XMLElement@17f54ff
    Copy details to clipboard
    [2011/07/21 11:47:12]
    Faulted while invoking operation "QueryPerAllPeople" on provider "QueryPerAllPeople".
    - <messages>
    - <input>
    - <Invoke_PerAllPeople_QueryPerAllPeople_InputVariable>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="QueryPerAllPeopleInput_msg">
    - <QueryPerAllPeopleInput xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/db/QueryPerAllPeople" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/QueryPerAllPeople">
    <ns1:p_person_id/>
    </QueryPerAllPeopleInput>
    </part>
    </Invoke_PerAllPeople_QueryPerAllPeople_InputVariable>
    </input>
    - <fault>
    - <invalidVariables xmlns="http://schemas.oracle.com/bpel/extension">
    - <part name="code">
    <code>
    9710
    </code>
    </part>
    - <part name="summary">
    <summary>
    Invalid xml document.
    According to the xml schemas, the xml document is invalid. The reason is: Error::cvc-datatype-valid.1.2.1: '' is not a valid value for 'decimal'.
    Error::cvc-type.3.1.3: The value '' of element 'ns1:p_person_id' is not valid.
    Please make sure that the xml document is valid against your schemas.
    </summary>
    </part>
    </invalidVariables>
    </fault>
    </messages>
    Copy details to clipboard
    [2011/07/21 11:47:12]
    "{http://schemas.oracle.com/bpel/extension}invalidVariables" has been thrown.
    - <invalidVariables xmlns="http://schemas.oracle.com/bpel/extension">
    - <part name="code">
    <code>
    9710
    </code>
    </part>
    - <part name="summary">
    <summary>
    Invalid xml document.
    According to the xml schemas, the xml document is invalid. The reason is: Error::cvc-datatype-valid.1.2.1: '' is not a valid value for 'decimal'.
    Error::cvc-type.3.1.3: The value '' of element 'ns1:p_person_id' is not valid.
    Please make sure that the xml document is valid against your schemas.
    </summary>
    </part>
    </invalidVariables>
    Copy details to clipboard
    The main problem was we were observing many SOA inactive threads in one particular database, and they keep building up minutes by minutes.
    I suspect, that in the code connections were open but were not closed, there4 there were inactive threads in the database.
    I had to stop the SOA application, to stop threads from building up. I guess they got build up when they were invoked. There is definitely some fault with the code. or tell me am wrong. tell me its sumthing else.
    However other domains processes were working fine.
    and oh, yes the developer also made changes in the database. when i asked her to revert back and see if it works, she say thats a huge amount of work.
    Finally she end up saying that maybe it could be a problem with the new version.
    Now as a learner, I want to know what is going on, and how do we go about solving it.
    Am not much of a SOA techie. that u can make out. but yes ready to learn things. so there4 i beg you to explain to me like am a standard 3 or 4 kid. any more information needed plz feel free to write back.
    regards
    Lammeki.

  • How to set the root path of XML document when calling Inserting procedure

    Hi,
    I was create a procedure to insert XML Document in to DBMS Tables, but i am not able to set the Start root element in calling procedure.
    My calling procedure is
    exec insXmldoc('pmc_sample.xml', 'pmc')
    When i am calling this procedure i got this error
    11:23:54 Error: ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 65
    ORA-06512: at "SCOTT.INSPROC", line 8
    ORA-06512: at line 2
    I am checking my XML file using XML Validator. My XML file was parsed with out errors.
    Please give the solution,and tell me where i did wrong in my calling procedure.
    suppose i have this XML file in local E drive ,how to set the path for that XML file in my calling procedure.

    Hi, I am doing the code likthis,please give the solution.
    SQL> create or replace procedure insProc(xmlDoc IN CLOB, tableName IN VARCHAR2) is
    2 insCtx DBMS_XMLSave.ctxType;
    3 l_ctx dbms_xmlsave.ctxtype;
    4 rows number;
    5 begin
    6 insCtx := DBMS_XMLSave.newContext(tableName); -- get the context handle
    7 rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc); -- this inserts the document
    8 DBMS_XMLSave.closeContext(insCtx); -- this closes the handle
    9 end;
    10 /
    Procedure created.
    SQL> begin
    2 insProc('/usr/tmp/ROWSET.xml', 'emp');
    3 end;
    4 /
    begin
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException:
    Start of root element expected.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 65
    ORA-06512: at "SCOTT.INSPROC", line 7
    ORA-06512: at line 2
    Kishore B

  • 9.0.3 validates an invalid XML document as valid

    JDeveloper 9.0.3 validates the XML document below with no errors, although it contains several. It also insists on a namespare (even a blank one) before the validator will run, even though it has an internal DTD.
    Also, there is no DTD file type in JDeveloper. Why?
    -----------------------Clip here-----------
    <?xml version="1.0"?>
    <!DOCTYPE todo [
    <!ATTLIST description priority NMTOKEN "low">
    <!ELEMENT description (#PCDATA)>
    <!ELEMENT task (description)>
    <!ELEMENT todo (task)+>
    ]>
    <todo xmlns="">
    <task>
    <description priority="high">Backup sales data for last month</description>
    </task>
    <task>
    <description priority="l ow">Complete end of month report</description>
    </task>
    <task>xxx</task>
    </todo>

    Ed,
    JDev 9.0.3 supports validation based on XML Schema only, not DTD.
    DTD validation is being considered for a future release, but has not
    been scheduled yet so I cannot give you an idea of when it's coming.
    I'll try to encourage the team to write a little Extension we could
    put up on OTN to restore this validate against the DTD feature that
    JDeveloper 3.2 did support.

  • Invalid XML document

    I'd like to ask about some problem with desktop profile xml file. When I log into the amconsole as amadmin, go to the Services/Portal Desktop/Edit Display Profile, and after changing nothing press OK, the following message arises:
    Error at line 1,569 and column 105 reported by parser was
    The reference to entity "launch" must end with the ';' delimiter
    After this I found the word "launch" only in this fragment of profile xml:
    <Collection name="targets">
    <String value="Instant Messenger (Java Web Start)|IMLaunch?provider=IMChannel&launch=jnlp&last=false^this.href=this.href+&apos;&src_url=&apos;+window.location.protocol+&apos;//&apos;+window.location.host;"/>
    <String value="Instant Messenger (Browser)|IMLaunch?provider=IMChannel&launch=plugin&last=false^this.href=this.href+&apos;&src_url=&apos;+window.location.protocol+&apos;//&apos;+window.location.host;"/>
    <String value="Instant Messenger (Java Web Start/Secure)|IMLaunch?provider=IMChannel&launch=jnlp&secure=yes&last=false^this.href=this.href+&apos;&src_url=&apos;+window.location.protocol+&apos;//&apos;+window.location.host;"/>
    <String value="Instant Messenger (Browser/Secure)|IMLaunch?provider=IMChannel&launch=plugin&secure=yes&last=false^this.href=this.href+&apos;&src_url=&apos;+window.location.protocol+&apos;//&apos;+window.location.host;"/>
    <String value="NetMail Lite|/portal/NetMailServlet?nsid=newHTMLSession"/>
    <String value="NetMail|/portal/NetMailServlet?nsid=newAppletSession"/>
    </Collection>
    So I thing that somewhere in this code must be the error. Can somebody find it, please?

    What browser are you using?
    There are known issues with editing XML using IE. You might actually be hitting a browser bug.
    To ensure that the problem you are observing is due to a browser issue:
    Click the Download button, save the XML to your local filesystem, make changes and try to upload it using the Upload button.
    If the Upload of your modified XML fails then your XML is not conforming to the DTD. If it succeds then you are facing a browser issue with EditXML.

  • Invalid XML document - "&" character in dp-xml

    Hi guys,
    Do anyone know how to avoid XML parser exception
    in admin console throwed because one of the
    attributes in dp.xml has "&" sign in the value string (e.g. URL) ?!
    PS: I am talking about editing dp xml via amconsole.
    Thanks,
    Alex :-)

    Did this work for you? When I try & amp; it works the first time, but when I go back in to edit, it's resolved back to plain '&' and gets an error again. I certainly don't want to change it every time! Same thing happened with the entity reference.
    When I use '%26', it doesn't resolve in the browser view.
    Thanks,

  • Can't insert schema-based xmltype into binary xmltype table

    I'm having issues trying to use binary storage along with the ALLOW ANYSCHEMA clause. I can't use the XMLSchema-instance mechanism for creating my schema-based XMLType instances, so I'm using CreateSchemaBasedXml. When I try to insert the XMLType into the table, however, it seems to think it's not schema-based and throws an error. I trimmed down my schema for the purposes of this example. Here's the schema (schematest.xsd):
    <?xml version="1.0" encoding="Windows-1252"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="FORMINFO">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="SUBJECT">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="ADDR">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="STREET" type="xs:string" />
                        <xs:element name="CITY" type="xs:string" />
                        <xs:element name="STATEPROV" type="xs:string" />
                        <xs:element name="ZIP" type="xs:string" />
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>Here's the instance file (schema testinst.xml):
    <?xml version="1.0" encoding="utf-8"?>
    <FORMINFO>
       <SUBJECT>
          <ADDR>
             <STREET>123 Main St</STREET>
             <CITY>Las Vegas</CITY>
             <STATEPROV>NV</STATEPROV>
             <ZIP>12345</ZIP>
          </ADDR>
       </SUBJECT>
    </FORMINFO>I registered the schema and created the test table:
    BEGIN
      DBMS_XMLSCHEMA.registerschema(
       schemaurl => 'http://localhost/schematest.xsd',
       schemadoc => bfilename('XMLDIR','schematest.xsd'),
       gentables => false,
       gentypes => false,
       csid => nls_charset_id('AL32UTF8'),
       options => DBMS_XMLSCHEMA.REGISTER_BINARYXML);
    END;
    CREATE TABLE BINARYTEST OF XMLType
    XMLTYPE STORE AS BINARY XML
    ALLOW ANYSCHEMA;But trying to insert gives me an ORA-44422 error (this is on Oracle 11.1.0.7.0 Enterprise):
    SQL> SET SERVEROUTPUT ON
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(bfilename('XMLDIR', 'schematestinst.xml'), nls_charset_id('AL32UTF8'));
      6    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
      7    xschema.SchemaValidate();
      8    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
      9
    10    INSERT INTO BINARYTEST
    11    VALUES (xschema);
    12    commit;
    13  end;
    14  /
    Schema: http://localhost/schematest.xsd Validated: 1
    declare
    ERROR at line 1:
    ORA-44422: nonschema XML disallowed for this column
    ORA-06512: at line 10You can see from my put_line statement that the XMLType object is reporting its schema URL correctly and thinks it's been validated. Changing the table to "ALLOW NONSCHEMA" allows the insert, but it inserts it as a non-schema-based document. Am I skipping a step here?
    Thanks,
    Jim

    It might be a bug, but I am not yet sure...
    See the following examples...
    c:\>C:\oracle\product\11.1.0\db_1\bin\sqlplus.exe /nolog
    SQL*Plus: Release 11.1.0.7.0 - Production on Mon Mar 23 22:14:41 2009
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    SQL> drop user otn cascade;
    User dropped.
    SQL> create user otn identified by otn;
    User created.
    SQL> grant xdbadmin, dba to otn;
    Grant succeeded.
    SQL> conn otn/otn
    connected.
    SQL> var schemaPath varchar2(256)
    SQL> var schemaURL  varchar2(256)
    SQL>
    SQL> begin
      2    :schemaURL := 'http://localhost/schematest.xsd';
      3    :schemaPath := '/public/schematest.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType('<?xml version="1.0" encoding="Windows-1252"?>
      4  <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      5    <xs:element name="FORMINFO">
      6      <xs:complexType>
      7        <xs:sequence>
      8          <xs:element name="SUBJECT">
      9            <xs:complexType>
    10              <xs:sequence>
    11                <xs:element name="ADDR">
    12                  <xs:complexType>
    13                    <xs:sequence>
    14                      <xs:element name="STREET" type="xs:string" />
    15                      <xs:element name="CITY" type="xs:string" />
    16                      <xs:element name="STATEPROV" type="xs:string" />
    17                      <xs:element name="ZIP" type="xs:string" />
    18                    </xs:sequence>
    19                  </xs:complexType>
    20                </xs:element>
    21              </xs:sequence>
    22            </xs:complexType>
    23          </xs:element>
    24        </xs:sequence>
    25      </xs:complexType>
    26    </xs:element>
    27  </xs:schema>');
    28  begin
    29  if (dbms_xdb.existsResource(:schemaPath)) then
    30      dbms_xdb.deleteResource(:schemaPath);
    31  end if;
    32   res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    33  end;
    34  /
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL> call dbms_xmlschema.deleteSchema(:schemaURL,4);
    Call completed.
    SQL> BEGIN
      2   DBMS_XMLSCHEMA.registerSchema(
      3    SCHEMAURL => :SchemaURL,
      4    SCHEMADOC => xdbURIType(:SchemaPath).getClob(),
      5    LOCAL     => FALSE, -- local
      6    GENTYPES  => FALSE, -- generate object types
      7    GENBEAN   => FALSE, -- no java beans
      8    GENTABLES => FALSE, -- generate object tables
      9    OPTIONS   => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
    10    OWNER     => USER
    11   );
    12  END;
    13  /
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL> var schemaDoc  varchar2(256)
    SQL>
    SQL> begin
      2    :schemaDoc := '/public/schematest.xml';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> -- Create an XML Document in the repository
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> declare
      2    res boolean;
      3    xmlDoc xmlType := xmlType('<?xml version="1.0" encoding="utf-8"?>
      4  <FORMINFO>
      5     <SUBJECT>
      6        <ADDR>
      7           <STREET>123 Main St</STREET>
      8           <CITY>Las Vegas</CITY>
      9           <STATEPROV>NV</STATEPROV>
    10           <ZIP>12345</ZIP>
    11        </ADDR>
    12     </SUBJECT>
    13  </FORMINFO>');
    14  begin
    15  if (dbms_xdb.existsResource(:schemaDoc)) then
    16      dbms_xdb.deleteResource(:schemaDoc);
    17  end if;
    18   res := dbms_xdb.createResource(:schemaDoc,xmlDoc);
    19  end;
    20  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> -- Ready to test
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> select * from tab;
    no rows selected
    SQL> CREATE TABLE BINARYTEST OF XMLType
      2  XMLTYPE STORE AS BINARY XML
      3  ALLOW ANYSCHEMA;
    Table created.
    SQL> set long 100000
    SQL> select dbms_metadata.get_ddl('TABLE','BINARYTEST',user) from dual;
    DBMS_METADATA.GET_DDL('TABLE','BINARYTEST',USER)
      CREATE TABLE "OTN"."BINARYTEST" OF "SYS"."XMLTYPE"
    OIDINDEX  ( PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" )
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    XMLTYPE COLUMN OBJECT_VALUE STORE AS BASICFILE BINARY XML (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT))
    DISALLOW NONSCHEMA
    ALLOW ANYSCHEMA
    1 row selected.
    SQL> SET SERVEROUTPUT ON
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
      7    xschema.SchemaValidate();
      8    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
      9
    10    INSERT INTO BINARYTEST
    11    VALUES (xschema);
    12    commit;
    13  end;
    14  /
    Schema: http://localhost/schematest.xsd Validated: 1
    declare
    ERROR at line 1:
    ORA-44422: nonschema XML disallowed for this column
    ORA-06512: at line 10
    -- ORA-44421: cannot DISALLOW NONSCHEMA without a SCHEMA clause
    -- Cause: If no SCHEMA clause (explicit schema or ANYSCHEMA) was specified, nonschema data cannot be disallowed.-
    -- Action: Remove DISALLOW NONSCHEMA or add some SCHEMA clause.
    SQL> drop table binarytest;
    Table dropped.
    SQL> CREATE TABLE BINARYTEST OF XMLType
      2  XMLTYPE STORE AS BINARY XML
      3  ALLOW NONSCHEMA;
    Table created.
    SQL> select dbms_metadata.get_ddl('TABLE','BINARYTEST',user) from dual;
    DBMS_METADATA.GET_DDL('TABLE','BINARYTEST',USER)
      CREATE TABLE "OTN"."BINARYTEST" OF "SYS"."XMLTYPE"
    OIDINDEX  ( PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" )
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    XMLTYPE COLUMN OBJECT_VALUE STORE AS BASICFILE BINARY XML (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT))
    ALLOW NONSCHEMA
    DISALLOW ANYSCHEMA
    1 row selected.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
      7    xschema.SchemaValidate();
      8    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
      9
    10    INSERT INTO BINARYTEST
    11    VALUES (xschema);
    12    commit;
    13  end;
    14  /
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> select * from binarytest;
    SYS_NC_ROWINFO$
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    1 row selected.
    SQL> SET SERVEROUTPUT ON
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
    15
    16    INSERT INTO BINARYTEST
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> create table ORtest of xmltype
      2  xmlschema "http://localhost/schematest.xsd" element "FORMINFO"
      3  ;
    Table created.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValid());
    15
    16    INSERT INTO ORTEST
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValid());
    15
    16    INSERT INTO BIN_ONE_SCHEMA
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> ----------------------------------------------------------
    SQL>
    SQL> -- Create an XML Document in the repository
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> declare
      2    res boolean;
      3    xmlDoc xmlType := xmlType('<?xml version="1.0" encoding="utf-8"?>
      4  <FORMINFO>
      5     <SUBJECT>
      6        <ADDR>
      7           <STREET>123 Main St</STREET>
      8           <CITY>Las Vegas</CITY>
      9           <STATEPROV>NV</STATEPROV>
    10           <ZIP>12345</ZIP>
    11           <ONE_TO_MANY>say what?</ONE_TO_MANY>
    12        </ADDR>
    13     </SUBJECT>
    14  </FORMINFO>');
    15  begin
    16  if (dbms_xdb.existsResource(:schemaDoc)) then
    17      dbms_xdb.deleteResource(:schemaDoc);
    18  end if;
    19   res := dbms_xdb.createResource(:schemaDoc,xmlDoc);
    20  end;
    21  /
    PL/SQL procedure successfully completed.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValid());
    15
    16    INSERT INTO BIN_ONE_SCHEMA
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
          <ONE_TO_MANY>say what?</ONE_TO_MANY>
        </ADDR>
    </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
          <ONE_TO_MANY>say what?</ONE_TO_MANY>
        </ADDR>
    </SUBJECT>
    </FORMINFO>
    declare
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00213: only 0 occurrences of particle "ADDR", minimum is 1
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at line 13
    SQL>

  • Error serializing XML document.

    We are trying to serialize XML document using Oracle XML Parser (9.2.0.5.0).
    Here is the code used for serialization
    public static void write(Document doc, File resultFile) {
    try {
    // Create a TransformerFactory
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    // Create a new Transformer for Identity Transformation
    Transformer transformer = transformerFactory.newTransformer();
    // Make passed document the DOM source
    DOMSource source = new DOMSource(doc);
    // Make result file the Stream Result
    StreamResult result = new StreamResult(new FileOutputStream(resultFile));
    // Write the document by means of Identity Transformation
    transformer.transform(source, result);
    } catch (Exception exc) {
    exc.printStackTrace();
    Document to be serialized
    test.xml
    <?xml version="1.0"?>
    <!DOCTYPE test SYSTEM "test.dtd">
    <!-- This is a comment -->
    <Test>
    <TestElement>Test Data</TestElement>
    </Test>
    test.dtd
    <!-- DTD -->
    <!ELEMENT Test (TestElement)>
    <!ELEMENT TestElement (#PCDATA)>
    The serialized document looked like
    <?xml version = '1.0'?>
    <?#comment This is a comment ?><Test>
    <TestElement>Test Data</TestElement>
    </Test>
    First of all the DOCTYPE declaration was not present in the serialized document.
    Secondly the comments appeared in a wrong way, which even made it an invalid XML document.
    How do we get this to work?
    Thanks
    Sagar

    On 9.2.0.3.0 you can try dbms_xdb.deleteResource(Path,4)

  • Build the delta from two xml documents

    Hi,
    i look for a solution to solve the following problem:
    i want to build a xml-based interface to pass my data to a client(Web etc.) and i dont know in which way the client manipulates the data and what in the xml-document was changed, inserted or deleted.
    What i have is the original-document and the changed-document (both based on the same DTD). How can i determine the delta from the two documents, cause i must know what actions to be taken (for example put <?bc4j remove?> or an appropriate tag for the XDK in the xml)
    any suggestion ???
    TIA
    Oliver

    The Oracle XDK for Java comes with a utility called XMLDiffer that, given XML Documents A and B, produces an XSLT stylesheet S that transforms A to B.
    Might be of use to you. That's the only inhouse XML diffing technology that I'm aware of. We use it internally in JDeveloper for merging machine-generate web.xml file edits with the user's hand-written web.xml file edits.

  • Transmission of XML Documents in a vector via WebService using Axis

    Hello,
    I'm trying to transmit several XML documents (belonging to a DICOM-Study) from WebService Provider to WebService consumer.
    This is my server/provider:
    public static Vector<Document> returnPatientStudies(String PatientID)
    DocumentBuilderFactory factory  = DocumentBuilderFactory.newInstance();
    DocumentBuilder        builder  = factory.newDocumentBuilder();
    File x = new File(PATH + "patient.xml");
    Document document = builder.parse(x);
    DCM2XMLFiles.add(document);This code works fine if it's executed locally in a JAVA class or via http/GET (http://.../axis/services/Gateway?method=returnPatientStudies&PatientID=123456).
    After using Axis' WSDL2Java-Tool I wrote a client:
    public static void main(String[] args) {
    GatewayServiceLocator locator = new GatewayServiceLocator();
    try {
         Gateway gateway = locator.getGateway();
         Vector<Document> documents = Gateway.returnPatientStudies("123456");
    ... Everytime I try to invoke this client-side class, I get an "org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize."
    Obviously the client gets confused by the XML content of the vector I'm trying to transmit (this error also occurs if I transmit XML files constisting only of a single empty element <empty />).
    I think this is a simple problem, since one single XML Document can be transmitted and gets displayed on client side, but I don't have a clue how to solve this vector<Document> problem. Hope someone can help me.
    Thanks

    Hi thanks for your answer.
    I am striving to make this webservice as universal as possible. I have only been returning dumps to my calling page to try and get a view of what's going on inside the component when I call it as a webservice. I wouldn't dream or returnin these back the client.
    The major core of this idea was to create a single component that acts as a facade for a number of other components. Because of this the component needs to accept and return a dynamically variable number of arguments. Because of this I selected xml as this seemed like the ideal solution; I can pass in an out some xml that contains all the arguments. I was hoping to reuse some internal functions to provide external webservices, and use this facade architechture to add a layer of security and logging which doesn't exist with the current functions.
    Do you have any suggestions of how I could best acheive something along these lines? Has someone already created a framework or methodology for creating webservices with Coldfusion which would provide this sort of functionality out of the box?
    Thanks again
    Jim

  • How to Find Number of Given Element in a XML Document

    Hello Experts,
    I want to know the number of given element in a XML document. For example if we have an employees information as a XML document, can we have how many <phone> element in the XML document?
    Thanks in advance.
    Regards,
    JP

    Hello,
    Once you've answered all the above.
    If you can run xpath that supports functions against the xml, the expression:
    count(//phone)Otherwise, without leaving SQL:
    select count(*) from
    xmltable('//phone' passing
      -- Your XML goes here, could be a table column with type XMLTYPE.
      xmltype('<person><phone>123-456-7890</phone><phone>098-765-4321</phone></person>')
      columns phone varchar2(24 char) path '/phone'
    ;

  • Displaying XML documents in WebDynpro ABAP

    Hi
    I want to display XML documents in Web Dynpro. My requirement is that, in a Web Dynpro application(ABAP), On the click of a button, I generate an XML file, which I need to display.
    I know that XML document can be created as a MIME object. But can this object be created on the fly? OR can the contents of this document be changed dynamically. If so, any pointers on how to create such a MIME object and proceed further?
    OR
    Can the browser be launched on the fly with the dynamically created XML content?
    Thanks and Regards
    Wenonah

    Hi Wenonah,
    see this little example which creates a xml file to download and open in the browser. Put it in an action handler method.
    DATA lr_conv   TYPE REF TO cl_abap_conv_out_ce.
      DATA lv_data   TYPE        string.
      DATA lv_xfile  TYPE        xstring.
      lv_data = '<?xml version=1.0" encoding="utf-8"?> put your xml here'.
      cl_abap_conv_out_ce=>create( RECEIVING conv = lr_conv ).
      lr_conv->convert( EXPORTING data   = lv_data
            IMPORTING buffer = lv_xfile ).
      cl_wd_runtime_services=>attach_file_to_response(
                     EXPORTING
                         i_filename  = 'test.xml'
                         i_content   = lv_xfile
                         i_mime_type = 'application/xml' ).
    Hope it helps.
    regards, Ulli

  • Resubmitting the archived XML Documents?

    Hi,
    I just wanted to confirm whether archived XML documents can be resubmitted?
    The XI message has been archived in a storage system and now its required to retrieve it in XI system.
    Does XI allow this resubmitting?
    Edited by: sriparna1 on Nov 16, 2009 8:11 AM

    Hi Sriparna,
        Synchronous messages occupy lot of space in the memory/database and hence they are not persisted by default.
    If you want the synchronous messages to be persisted, then follow this blog:
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417200)ID1629352550DB00149050467001567547End?blog=/pub/wlg/1629
    Refer this discussion to understand the concept of persistence with respec to sync msgs.
    Synchronous Messages persistence in XI
    And regarding your question about "How are the successfull and erroneous synchronous messages handled while archiving",
    it is very staright forward.
    By default, all the succesful messages are archived by the archiving job.
    The error messages are not archived.
    If you want the error messages to be archived, you have to Cancel them.
    After canceling, the status changes from error to cancelled. Then the archiving job will archive the cancelled messages also.
    Regards,
    Ravi Kanth Talagana

  • Transform Java Beans into XML documents?

    Hi,
    I have standard Java Beans (which are not generated out of XML documents), can I transform them into
    XML documents even if they are not generated out of XML documents originally?
    If not, is there any toll which can do that?
    regards,

    Looks like the java.beans.XMLEncoder class is where you should start.

Maybe you are looking for

  • Error when creating journal triggers

    I have table with 138 columns. When i try to generate journal triggers, HSU utility fails with error 6502 - numeric or value error. I was able to create journal triggers after i've deleted 30 rows. Are there any restrictions in number of columns when

  • Rendering a JSF page with a choice from CoreSelectOneChoice!

    Hi, I have a jsp page with lots of ADF and JSF components. I have a CoreTable component that gets it values from a DB thru Toplink. On this page I have a CoreSelectOneChoice component with a ValueChangedListener. When the user makes a selection from

  • Ads taking up too much CPU

    I have a lot of problems with ads in chat software, but this one's new. You have recently started serving a new ad for the Hungarian Vodafone, made in Flash.  Sadly after a few loops it will use up a lot of CPU and render Skype itself (in particular!

  • Are there any long-term consequences for carrying a balance?

    I have some upcoming dental work ($7k) and was planning to pay in interest-free installments to the office. However, I was just approved (hooray) for a Quicksilver card with 0% APR until March. I am considering putting the work on this card, because

  • Flat File Connector

    Are there any connectors in OIM Connector Pack that can provision(reconcile) to(from) Flat File? Or I do have to write my own one? Yes, I know about Generic Technology... But what about trusted reconcilation? Message was edited by: chii