aspose file tools*
The moose likes XML and Related Technologies and the fly likes xml schema with xerces parser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml schema with xerces parser" Watch "xml schema with xerces parser" New topic
Author

xml schema with xerces parser

prashanth nagaraj
Ranch Hand

Joined: Mar 11, 2002
Posts: 43
Hi,
I am using xerces4 java for validating xml with xml schema. Xml schema are stored in xsd files.
I have defined the datatypes of values in xsd files. After validating the input xml with that of xsd files, I need to get the datatype of the value from xsd. Suppose in the input xml user passes some value like <Age>25</Age>. The xsd has datatype for this value as int. Is there any way from which I can get the datatype of Age element's value from xsd using the xerces. I can also pass the datatype information in the input xml. but in our applications we are using schemas provided by different team where the datatype info is provided in xsd files.
Please suggest if there is any solutions for this .
Thanks in adv
prashanth

[ December 23, 2002: Message edited by: Prashanth Nagaraj ]

regards,<br />prashanth nagaraj
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Just a general comment!..
XSD structure is same like XML , why don't read the incoming XSD and detect the relevant datatype ?
Rgds
Balaji


Spritle Software Blogs
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Prashanth,
One of the great advantages of XML Schemas over DTDs is precisely its XML format. This means that you can parse the XSD file as you would do with any XML file.
Cheers
prashanth nagaraj
Ranch Hand

Joined: Mar 11, 2002
Posts: 43
Thanks for replying,
I have tried in this way. In xsd's we are including other xsds. Because of this it is too complex for parsing the xsds.
If there is any better solution ,pls let me know

prashanth
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Prashanth Nagaraj:
Thanks for replying,
I have tried in this way. In xsd's we are including other xsds. Because of this it is too complex for parsing the xsds.
If there is any better solution ,pls let me know

prashanth

hi,
if you professional xml schema book from wrox with you, then in chapter 10 has an example which read xsd including imported and included and producess html. may be that could help you a bit.you can also download the source code of this chapter from wrox site.just run the sample,you may get some idea.
 
Consider Paul's rocket mass heater.
 
subject: xml schema with xerces parser