This discussion is archived
2 Replies Latest reply: Sep 6, 2013 5:05 AM by sush007 RSS

Issue in Store XML into Schema generated tables and Validation XML against registered schema.

sush007 Newbie
Currently Being Moderated

Hello friends,

 

I am facing some problem when store xml into generated tables from registered schema.

 

This is my Schema

 

--

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

<xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.abc.inf.in/test" targetNamespace="http://www.abc.inf.in/test" elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:include schemaLocation="abc.xsd"/>

  <xs:element name="project" type="student">

  <xs:annotation>

  <xs:documentation> This is a Documentation</xs:documentation>

  </xs:annotation>

  </xs:element>

</xs:schema>

 

-- This is my xml document

 

<project versao="2.00" xmlns="http://www.abc.inf.in/test">

  <test xmlns="http://www.abc.inf.in/test">

  <intest version="2.00" Id="testabc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  >

  <ide>

  <cUF>35</cUF>

  <cNF>59386422</cNF>

  <natOp>this is post</natOp>

  <indPag>1</indPag>

  <mod>55</mod>

  <serie>1</serie>

  </ide>............

.....................

Not giving full because it's too long.

 

1. I Successfully registered Schema into database

2. Then i generate table from registered Schema

2. In my java code i validated XML document against Schema and it's successfully validate.

3. But when i stored this XML into this generated table it's give me error

   Like :

 

INSERT INTO XMLTABLE

VALUES

(XMLTYPE(bfilename('MYDIR','testabc.xml'),NLS_CHARSET_ID('AL32UTF8')))

 

Error report:

SQL Error: ORA-31061: XDB error: XML event error

ORA-19202: Error occurred in XML processing

LSX-00333: literal "94032000" is not valid with respect to the pattern

 

And i have to store this xml into this tables so what i have to do ?

  • 1. Re: Issue in Store XML into Schema generated tables and Validation XML against registered schema.
    odie_63 Guru
    Currently Being Moderated

     

    1. I Successfully registered Schema into database

    2. Then i generate table from registered Schema

    2. In my java code i validated XML document against Schema and it's successfully validate.

    How did you perform those operations ? Give exact commands please.

    What's the db version ?

     

    Could you give us the main schema as well, abc.xsd ? Otherwise there's not much we can do or suggest, apart from saying there's a validation error.

  • 2. Re: Issue in Store XML into Schema generated tables and Validation XML against registered schema.
    sush007 Newbie
    Currently Being Moderated

    Thanks for your reply odie_63.

     

    I got this my error solution. My XML document is not well structured based on my registered XML Schema.

    Means In My XML Document there are some invalid value and that not match my schema pattern so it's gives this error

     

    SQL Error: ORA-31061: XDB error: XML event error

    ORA-19202: Error occurred in XML processing

    LSX-00333: literal "94032000" is not valid with respect to the pattern

     

    For Solution we have two ways

     

    1. I have changed this literal "94032000" value in my xml file then save it.

    2.

    - We have to delete this schema then

    - we have to change Schema pattern for particular element

    like :--

     

    <xs:restriction base="xs:string">

      <xs:whiteSpace value="preserve"/>

      <xs:pattern value="[0-9]{3}"/>

    </xs:restriction>

     

    - then store xml into database it works..

     

    Thanks.

Legend

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