aspose file tools*
The moose likes XML and Related Technologies and the fly likes xml element content is a XSD .... validation fails. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml element content is a XSD .... validation fails." Watch "xml element content is a XSD .... validation fails." New topic
Author

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

sridhanya ganapathy
Greenhorn

Joined: Jun 03, 2006
Posts: 14
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jun 03, 2006
Posts: 14
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jun 03, 2006
Posts: 14
My issue got resolved.I changed the code like Paul mentioned below



Thanks for the help
[ August 01, 2007: Message edited by: sridhanya ganapathy ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xml element content is a XSD .... validation fails.