Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xml schema with xerces parser

 
prashanth nagaraj
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a general comment!..
XSD structure is same like XML , why don't read the incoming XSD and detect the relevant datatype ?
Rgds
Balaji
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic