• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xml element content is a XSD .... validation fails.

 
sridhanya ganapathy
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an xml similar to the one below which is fails when parsed

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

<objects xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<eschema xmlns="urn:com:samplene:1.0">
<Name>name</Name>
<Description>description</Description>
<Xsd>xsd</Xsd>
</eschema>
</objects>

Inside this <Xsd> tag i need a XML schema as its content.
But parser states it is an error.
Suggest me how to proceed in this regard.

The XSD element
 
Paul Clapham
Sheriff
Posts: 20990
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't tell what "need a XML schema as its content" means. Can you explain that? It would help if you found an example that does parse, then you could look at it to see what you should be doing.
 
sridhanya ganapathy
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yup.
we need to move a xml data in to the persistence store.
There is a internal framework which takes this xml data and validates it and move to the database.It uses XMLBeans for the same.

The columns in the table will like below

id primary key [auto generated]
name string
description string
XSD string

In this XSD colum input will be a schema content which will later used by the application.
A sample content of xml will look like below

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

<objects xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<eschema xmlns="urn:com:samplene:1.0">
<Name>name</Name>
<Description>description</Description>
<Xsd>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" version="1.0" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="im" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="senderID" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</Xsd>
</eschema>
</objects>
 
Paul Clapham
Sheriff
Posts: 20990
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you happen to notice what error message the parser produced? It's a lot easier to diagnose errors when you have some information about them, I think. Just being told "there's an error" is not all that helpful.

Also, I'm not sure your example is clear. Was it supposed to look like this?or was it supposed to look like this?
[ July 19, 2007: Message edited by: Paul Clapham ]
 
sridhanya ganapathy
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My issue got resolved.I changed the code like Paul mentioned below



Thanks for the help
[ August 01, 2007: Message edited by: sridhanya ganapathy ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic