1 2 Previous Next 18 Replies Latest reply: Aug 13, 2013 3:38 AM by 946212 RSS

    XDB is invalid post registering schema

    946212

      Hi all, We have an Windows 2008R2 Oracle 11g 11.2.0.3 database. I am trying to register xml schema but we now have a problem. Please advice how to resolve this:

       

       

      Regards, Nick

       

      Warning: XDB now invalid, invalid objects found:

      object_name                                 object_type

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

      XDPvR/1dI8T7Sgbi6W3+hdRw==                   XML SCHEMA

      XDpjNsY48sTPS2U0FTcntpeA==                   XML SCHEMA

      XDc47y7s7IRAiROOzbxAxxHw==                   XML SCHEMA

      XDSKZf8PoBQYOsi3xhlK/eIQ==                   XML SCHEMA

      XDgWRTQYoXReCeOSe0Pdx9iw==                   XML SCHEMA

      XDwNX9aokgQEKPpaPog31zoA==                   XML SCHEMA

        

       

      PL/SQL procedure successfully completed.

       

       

      SQL> select schema_url from dba_xml_schemas, dba_objects

        2  where int_objname = object_name and status = 'INVALID';

       

       

      SCHEMA_URL

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

       

       

      OSDNFFeatures.xsd

      OSImageMetadata.xsd

      OSOrthoMetadata.xsd

      OSQueryResult.xsd

      OSIMIngestionMetadata.xsd

      OSIMProductMetadata.xsd

       

       

      6 rows selected.

       

       

      Try to delete the registered schema but fails:

       

       

       

       

      SQL> BEGIN

        2  DBMS_XMLSchema.deleteSchema(

        3  schemaurl=>'/XML_SCHEMA/EGISPROD/OSDNFFeatures.xsd',

        4  delete_option=>DBMS_XMLSchema.Delete_Cascade_Force);

        5  END;

        6  /

      BEGIN

      *

      ERROR at line 1:

      ORA-31000: Resource '/XML_SCHEMA/EGISPROD/OSDNFFeatures.xsd' is not an XDB

      schema document

      ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 122

      ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 106

      ORA-06512: at line 2

       

       

       

       

      Even doing by this way:

       

       

      SQL> exec DBMS_XMLSCHEMA.PURGESCHEMA('3EF47FD5D23C4FB4A06E2E96DFE85D47');

      BEGIN DBMS_XMLSCHEMA.PURGESCHEMA('3EF47FD5D23C4FB4A06E2E96DFE85D47'); END;

       

       

      *

      ERROR at line 1:

      ORA-31050: Access denied

      ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 109

      ORA-06512: at line 1

        • 1. Re: XDB is invalid post registering schema
          odie_63

          Hi Nick,

           

          OK, you have registered 6 schemas.

          How did you register them in the first place? Please give the exact commands used, in particular did you use the FORCE option?

           

          Did you get any error during registration?

          Do the schemas reference each other? If yes, you have to register with FORCE option and compile them in a second step using DBMS_XMLSCHEMA.compileSchema.

           

          Anyway, and I think it's a separate problem, you should be able to delete them provided you specify the correct schema URL.

          As per your query, the URL of the first one is "OSDNFFeatures.xsd", but you're trying to delete one whose URL is "/XML_SCHEMA/EGISPROD/OSDNFFeatures.xsd", hence the error.

          I think you're confusing the URL used to register the schema in the database with the URI of the source document in the XML DB repository.

          • 2. Re: XDB is invalid post registering schema
            Marco Gralike

            Try...(via the owner of the schema's/the one that registered them)

             

            SQL> show user

            EGISPROD

             

            SQL> BEGIN

              2  DBMS_XMLSchema.deleteSchema(

              3  schemaurl=>'OSDNFFeatures.xsd',

              4  delete_option=>DBMS_XMLSchema.Delete_Cascade_Force);

              5  END;

              6  /

            • 3. Re: XDB is invalid post registering schema
              946212

              <body><p>thanks guys, i was eventually able to delete the xml schema using the below commnand

               

               

               

               

              begin

              dbms_xmlschema.deleteschema('OSDNFFeatures.xsd',dbms_xmlschema.DELETE_CASCADE);

              end;

              /

               

               

               

               

              on a sepertate note, i use the below sql to create a new resource for a XSD file but how does one do for a DTD file?

               

               

               

               

              Adding a XSD

               

               

              declare

              v_result boolean;

              v_schema xmltype := xmltype(bfilename('XML_VALIDATION', 'feature.xsd'), nls_charset_id('UTF8'));

              begin

              v_result := dbms_xdb.CreateResource('/XML_SCHEMA/EGISPROD/feature.xsd', v_schema);

              end;

              /

               

               

               

               

              Adding a DTD file:

               

               

              SQL> declare

                2  v_result boolean;

                3  v_schema xmltype := xmltype(bfilename('XML_VALIDATION', 'XMLSchema.dtd'), n

              ls_charset_id('UTF8'));

                4  begin

                5  v_result := dbms_xdb.CreateResource('/XML_SCHEMA/EGISPROD/XMLSchema.dtd', v

              _schema);

                6  end;

                7  /

              declare

              *

              ERROR at line 1:

              ORA-31011: XML parsing failed

              ORA-19202: Error occurred in XML processing

              LPX-00247: invalid Document Type Declaration (DTD)

              Error at line 18

              ORA-06512: at "SYS.XMLTYPE", line 296

              ORA-06512: at line 3

              • 4. Re: XDB is invalid post registering schema
                odie_63

                Well, a DTD is not an XML document, so do not use the XMLType constructor over it.

                 

                DBMS_XDB.createResource has an overloading for BFILEs, e.g.

                SQL> declare

                  2    res boolean;

                  3  begin

                  4    res := dbms_xdb.CreateResource(

                  5             abspath => '/public/play.dtd'

                  6           , data    => bfilename('TEST_DIR', 'play.dtd')

                  7           , csid    => nls_charset_id('AL32UTF8')

                  8           ) ;

                  9  end;

                10  /

                 

                PL/SQL procedure successfully completed

                 

                 

                BTW, did you resolve the previous issue about the invalid schemas?

                • 5. Re: XDB is invalid post registering schema
                  946212

                  Hi Odie, Yes i have resolved the previous issue by using the commnand mentioned above. I am in a process of re-validating the ones i have deleted.

                   

                  Many thanks for the DTD syntax.

                   

                  It worked just fine.

                   

                   

                  Sorry to be a pain but this is my first attempt to create a XML schema database. I've now come across another issue. Can the XML file not have two duplcate elements? Any workaround as we are unable to change the XML file.

                   

                  SQL> begin

                    2  dbms_xmlschema.registerSchema(

                    3  schemaURL => 'OSQueryResult.xsd',

                    4  schemaDoc => xdburitype('/XML_SCHEMA/EGISPROD/OSQueryResult.xsd').getXML(),

                   

                   

                    5  local => true,

                    6  genTypes => false,

                    7  genbean => false,

                    8  genTables => true

                    9  );

                  10  end;

                  11  /

                  begin

                  *

                  ERROR at line 1:

                  ORA-31154: invalid XML document

                  ORA-19202: Error occurred in XML processing

                  LSX-00102: duplicate element "chunkingPolicy"

                  ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 55

                  ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 159

                  ORA-06512: at line 2

                   

                  Reference in the XSD file:

                   

                  <sequence>

                  <element name="chunkingPolicy" type="osgb:NonGeoChunkPolicyType"/>

                  <element name="chunkSize" type="osgb:MegaBytesMeasureType" minOccurs="0"/>

                  </sequence>

                  <sequence>

                  <element name="chunkingPolicy" type="osgb:GeoChunkPolicyType"/>

                  <element name="chunkSize" type="osgb:KilometresMeasureType" minOccurs="0"/>

                  </sequence>

                  • 6. Re: XDB is invalid post registering schema
                    odie_63

                    Can the "chunkingPolicy" occurs multiple times in the XML instance document, or is it actually a choice between the two definitions?

                    • 7. Re: XDB is invalid post registering schema
                      946212

                      sorry dont understand the question. Are you saying that it cannot have the same duplicate element names?

                      • 8. Re: XDB is invalid post registering schema
                        odie_63

                        I'll rephrase the question :

                        Is the XML snippet you gave actually wrapped into a <choice> element ?

                        • 9. Re: XDB is invalid post registering schema
                          946212

                          yes it is..

                           

                          <choice>

                          <sequence>

                          <element name="chunkingPolicy" type="osgb:NonGeoChunkPolicyType"/>

                          <element name="chunkSize" type="osgb:MegaBytesMeasureType" minOccurs="0"/>

                          </sequence>

                          <sequence>

                          <element name="chunkingPolicies" type="osgb:GeoChunkPolicyType"/>

                          <element name="chunkSize" type="osgb:KilometresMeasureType" minOccurs="0"/>

                          </sequence>

                          </choice>

                          • 10. Re: XDB is invalid post registering schema
                            946212

                            Hi all, Please can someone share some thoughts as to how to get round this error please?

                             

                             

                             

                             

                            SQL> declare

                              2  v_result boolean;

                              3  v_schema xmltype := xmltype(bfilename('XML_VALIDATION', 'xml.xsd'), nls_cha

                            rset_id('UTF8'));

                              4  begin

                              5  v_result := dbms_xdb.CreateResource('/XML_SCHEMA/EGISPROD/xml.xsd', v_schem

                            a);

                              6  end;

                              7  /

                            declare

                            *

                            ERROR at line 1:

                            ORA-31001: Invalid resource handle or path name "/XMLSchema.dtd"

                            ORA-06512: at "SYS.XMLTYPE", line 296

                            ORA-06512: at line 3

                            • 11. Re: XDB is invalid post registering schema
                              odie_63

                              ORA-31001: Invalid resource handle or path name "/XMLSchema.dtd"

                              The document 'xml.xsd' references an external resource ('XMLSchema.dtd') which is expected at the root of the repository.

                              Have you already created 'XMLSchema.dtd', and if you have, where?

                               

                              Both referenced location in 'xml.xsd' and uri of 'XMLSchema.dtd' must match.

                               

                              Now, let me ask another question : do you really need to load all that stuff ?

                              • 12. Re: XDB is invalid post registering schema
                                946212

                                i have created a DB folder and granted read, write to the schema, it where all the dtd and xsd files reside.

                                 

                                 

                                declare

                                v_result boolean;

                                begin

                                v_result := dbms_xdb.CreateResource(

                                abspath => '/XML_SCHEMA/EGISPROD/XMLSchema.dtd'

                                , data    => bfilename('XML_VALIDATION', 'XMLSchema.dtd')

                                , csid    => nls_charset_id('UTF8')

                                ) ;

                                end;

                                /

                                 

                                 

                                Yes, we may need all the files as they seems to have loads of cross-referrence

                                • 13. Re: XDB is invalid post registering schema
                                  946212

                                  Hi,

                                   

                                  I've come across this reference in one of the files,

                                   

                                   

                                   

                                       Public Identifier: "-//W3C//DTD XMLSCHEMA 200102//EN"

                                       Official Location: http://www.w3.org/2001/XMLSchema.dtd -->

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                   

                                  So the with failing error on xml.xsd, can i change the file from a public id to a official loc, if so how do i reference it?

                                   

                                   

                                   

                                  extract from xml.xsd

                                   

                                  <?xml version='1.0'?>

                                  <!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" >

                                  • 14. Re: XDB is invalid post registering schema
                                    odie_63

                                     

                                    So the with failing error on xml.xsd, can i change the file from a public id to a official loc, if so how do i reference it?

                                     

                                    No, you must change it to the location of the resource in the repository i.e. "/XML_SCHEMA/EGISPROD/XMLSchema.dtd".

                                    1 2 Previous Next