This discussion is archived
1 2 Previous Next 20 Replies Latest reply: Oct 8, 2012 7:12 AM by 961018 RSS

Error Loading XSD documents 11g

961018 Newbie
Currently Being Moderated
Hi,




Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE     11.2.0.2.0     Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production


PARAMETER     VALUE

NLS_LANGUAGE     AMERICAN
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET     UTF8



When i am trying to load an XSD document its failing with Error-15. When i removed the below line from the xsd doc
<xs:pattern value="[ ]*[!-~А-я][ -~А-я]*"> (& #x0410;-& #x044F;)

It went through fine. The issue is its not supporting ;А-я NCS of Cyrillic alphabet(Russian) . Guess its some kind of character set issue.
But i cant identify. The same doc is working fine in 10g. issue is in 11gr2.

Loading of xsd happens from a product interface.
header details
<?xml version="1.0" encoding="Windows-1251"?>
<!--Öåíòðàëüíûé Áàíê Ðîññèéñêîé Ôåäåðàöèè.
Óíèôèöèðîâàííûå ôîðìàòû ýëåêòðîííûõ áàíêîâñêèõ ñîîáùåíèé.

Ñõåìû ñ îïèñàíèåì áàçîâûõ òèïîâ.
Èñïîëüçóþòñÿ äëÿ ñîçäàíèÿ ïðèêëàäíûõ òèïîâ.

äåêàáðü 2008 ã.-->
<!--e-mail: wlad@e-burg.cbr.ru-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:bt="urn:cbr-ru:ed:basetypes:v2.0" targetNamespace="urn:cbr-ru
:ed:basetypes:v2.0" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.4.0">

Edited by: 958015 on Sep 10, 2012 1:13 AM

Edited by: 958015 on Sep 10, 2012 1:15 AM
  • 1. Re: Error Loading XSD documents 11g
    MarcoGralike Oracle ACE Director
    Currently Being Moderated
    <?xml version="1.0" encoding="Windows-1251"?>
    That is the NLS setting (Windows-1251) your client program is telling to the database it wants the data returned into...
    AFAIK Windows-1251 is probably not supporting the Cyrillic alphabet(Russian).
    So your database does, but your client doesn't support Cyrillic alphabet(Russian).
    Alter your client settings in supporting also unicode/UTF-8.

    SEE ALSO THE GOOD EXAMPLE on the XMLDB FAQ URL on the main page of this forum. It demonstrates who NLS works in an Oracle/XML environment

    Edited by: Marco Gralike on Sep 10, 2012 6:30 PM
  • 2. Re: Error Loading XSD documents 11g
    961018 Newbie
    Currently Being Moderated
    Dear Marco,

    I am very new to the DB side.
    The same document with the 1251 encoding was getting loaded properly in 10g. This is failing when we upgraded from 10g to 11g.
    Can you please tell me what should i modify either in the xsd doc or any oracle setup so that i would be able to use the Cyrillic (russian) in xsd. Windows-1251 i guess supports russian Cyrillic .

    Thanks and Regards
    Milash
  • 3. Re: Error Loading XSD documents 11g
    961018 Newbie
    Currently Being Moderated
    Dear Marco/All,

    In my XDBCONFIG.XML file the xml header section was missing.
    So i added the below line
    <?xml version="1.0" encoding="UTF-8"?>
    But on posting my changes the encoding automatically got modified to
    <?xml version="1.0" encoding="WINDOWS-1252"?>

    I guess this is why cyrilliac is not getting picked up (win-1252 doesnt support).
    Can any one throw some light over from wherexdbconfig gets this encoding value.

    Regards
    Milash
  • 4. Re: Error Loading XSD documents 11g
    odie_63 Guru
    Currently Being Moderated
    In my XDBCONFIG.XML file the xml header section was missing.
    So i added the below line
    <?xml version="1.0" encoding="UTF-8"?>
    But on posting my changes the encoding automatically got modified to
    <?xml version="1.0" encoding="WINDOWS-1252"?>

    I guess this is why cyrilliac is not getting picked up (win-1252 doesnt support).
    Can any one throw some light over from wherexdbconfig gets this encoding value.
    No, do not touch xdbconfig.xml, it's not related to your problem.

    The encoding got modified because that's the way it works.
    Pasting in an UTF-8 prolog does not make the file effectively encoded in UTF-8, it's probably still in the client character set, i.e. WINDOWS-1252.
    That's why Oracle automatically switch the encoding declaration to the client's.

    Please explain clearly which tool/API/command you're using to load the XSD.
    Make sure the file really is encoded using the charset declared in the prolog, and check the NLS_LANG env variable.
  • 5. Re: Error Loading XSD documents 11g
    mdrake Expert
    Currently Being Moderated
    There is a new XML parser in 11.2.x, which has had some challanges with higher order (2 and 3 byte) encodings..

    You might want to contact Oracle Support and get the latest patches for the parser, or revert to the older parser by setting

    31156 trace name context forever, level 0x400
  • 6. Re: Error Loading XSD documents 11g
    961018 Newbie
    Currently Being Moderated
    Thanks for the response.

    Dear Odie,

    err = XmlSchemaLoad(sctx, (oratext *)uri, NULL); this is the call which load the xsd.
    This is the xsd prolouge.
    <?xml version="1.0" encoding="Windows-1251"?>
    <!--e-mail: wlad@e-burg.cbr.ru-->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:bt="urn:cbr-ru:ed:basetypes:v2.0" targetNamespace="urn:cbr-ru
    :ed:basetypes:v2.0" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.4.0">

    Win-1251 character set is supported in UTF-8 but not in 1252.

    Dear mdrake,

    Can ushed some light on how to revert to older parser setting.

    This issue has caused lot difficulties for us in testing our product :(. Any inputs will be really helpful

    Thanks and Regards
    Milash
  • 7. Re: Error Loading XSD documents 11g
    961018 Newbie
    Currently Being Moderated
    this is locale of the client
    LANG=en_US.utf8
    LC_COLLATE="EN_US.UTF-8"
    LC_CTYPE="EN_US.UTF-8"
    LC_MONETARY="EN_US.UTF-8"
    LC_NUMERIC="EN_US.UTF-8"
    LC_TIME="EN_US.UTF-8"
    LC_MESSAGES="EN_US.UTF-8"
    LC_ALL=EN_US.UTF-8

    and

    NSL_LANG= .AL32UTF8
  • 8. Re: Error Loading XSD documents 11g
    mdrake Expert
    Currently Being Moderated
    If I understand you correctly you are using applicaition code to call register schema. Can we start with an approach where you first try to store the xsd file as a resource in the XML DB repository and then register the XML Schema using SQL*PLUS or SQLDeveloper.

    Eg

    1. Store the xsd in folder on a file system that is accessable by the database.
    2. Create a SQL directory object that points to the folder (Eg assuming the xsd file is in /tmp as myXmlSchema.xsd)
    create or replace directory XSDDIR as '/tmp'
    /
    declare
       V_RESULT BOOLEAN;
       V_SCHEMA_PATH VARCHAR2(700) := '/public/testcase.xsd';
    begin
       if (DBMS_XDB.existsResource(V_SCHEMA_PATH)) then
         DBMS_XDB.deleteResource(V_SCHMEA_PATH);
      end if;
       V_RESULT := DBMS_XDB.createResource(V_SCHEMA_PATH,BFILENAME('XSDDIR','myXmlSchema.xsd'));
       commit
    end;
    /
    Now let's test if we can parse that document...
    select * 
      from XMLTABLE('fn:doc("/public/testcase.xsd")')
    /
    Assuming we can

    call registerSchema
    declare
       V_XMLSCHEMA XMLTYPE := xdburitype('/public/testcase.xsd').getXML();
    begin
      DBMS_XMLSCHEMA.registerSchema( 
          SCHEMAURL => 'http://www.example.com/xsd/testcase.xsd',
          SCHEMADOC => V_XMLSCHEMA,
          ....
      );
    end;
    /
    If any of the above steps fail with the parsing error then repeat after executing
    alter sessions set events='31156 trace name context forever, level 0x400'
    /
    Assuming everything goes through OK when the event is set we are looking at a Parser bug, you will either need to get the latest set of patches for the parser from MOS, or set the event at the database level or programatically before calling register Schena. I would strongly advise starting with the latest set of Parser Fixes.

    If this does not fix the problem you will need to open a tar with Oracle Support and send in the offending Schema.

    Edited by: mdrake on Sep 21, 2012 7:14 AM
  • 9. Re: Error Loading XSD documents 11g
    odie_63 Guru
    Currently Being Moderated
    Mark,

    Looks like Milash is using the C XDK to load a schema and validate a document :

    http://docs.oracle.com/cd/E11882_01/appdev.112/e23582/adx_c_sproc.htm
    http://docs.oracle.com/cd/E11882_01/appdev.112/e10770/schema.htm#Xmlschemaload

    So maybe not much to do with XML DB?

    @Milash:

    Are you actually doing any database access in the program?
    Did you recompile your sources using the new 11g librairies?
  • 10. Re: Error Loading XSD documents 11g
    961018 Newbie
    Currently Being Moderated
    Dear Mark/Odie,

    Really am not into this xml or xml db, i just started studying all these things. so kindly excuse me for any blunders asked.

    This is my scenario. In our product we generate some messages which need to follow certain format. Now this format is stored in the XSD doc and that is getting loaded via the oracle C API XmlSchemaLoad and validation happens with the generated message.

    We are having 8-9 xsd out of which only 1 failed. Only this one had the Cyrillic reference.If i remove those Cyrillic ref this also goes through fine.

    I will be to office on monday only. so will try both your suggestions on monday
    1.alter session
    2.recompile the c source.

    Thanks and Regards
    Milash
  • 11. Re: Error Loading XSD documents 11g
    odie_63 Guru
    Currently Being Moderated
    So, at any point, do you use the database to parse XML documents or not?

    Looks like you don't, in which case the ALTER SESSION won't help at all, but feel free to give as much details as possible.
  • 12. Re: Error Loading XSD documents 11g
    961018 Newbie
    Currently Being Moderated
    Dear Mark/Odie,

    Could you tell me how to revert the xml parser back to 11g after using the below command

    alter system set event='31156 trace name context forever, level 0x400' ;

    I mean after executing the above one we should have 10g compatable xml parser setting. After testing i need it back to 11g settings coz there are many other testing going in the same DB. So once we can confirm its because of the parser version we can get the latest patch.

    Regards
    Milash
  • 13. Re: Error Loading XSD documents 11g
    961018 Newbie
    Currently Being Moderated
    Dear Odie,

    From the links you provided what i could get is like the XSD gets converted in to an internal representation.
    The api which our product calls for loading the xsd is XmlSchemaLoad()

    +"this function converts the DOM representation into an internal schema representation. The schema document can be provided as a URI or directly a DOM representation. In the URI case, this function reads the input stream and builds a DOM representation of the schema before converting it into internal representation"+

    So during this interanl representation conversion the NCS reference (& #x0410;-& #x044F;) for А-я is not getting identified. So internally parsing should happen for this conversion is what i am thinking.

    Any way i will change the xml parser setting , once i get to know how to revert it back to orginal :).

    Thanks and Regards
    Milash
  • 14. Re: Error Loading XSD documents 11g
    odie_63 Guru
    Currently Being Moderated
    Could you tell me how to revert the xml parser back to 11g after using the below command
    alter system set events '31156 trace name context off';
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points