473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Parse XML Schema in Java

Hi all.
I need to parse an XML Schema and get the following information out of
it:
list of elements allowed in schema
list of attributes for each element - which are required and which
optional
given an element name get elements that it can contain
etc.

Parsing with JDOM XPath seems to be complicated, because there are
many ways to say something in schema, although it would be my
preferred way.

I also looked at JAXB and Xerces, but their APIs seem to be more
complicated than I need.

Is there a simple API for doing what I need?

Thank you very much for help.

Anna
Jul 20 '05 #1
1 2753


Anna wrote:

I need to parse an XML Schema and get the following information out of
it:
list of elements allowed in schema
list of attributes for each element - which are required and which
optional
given an element name get elements that it can contain
etc.

Parsing with JDOM XPath seems to be complicated, because there are
many ways to say something in schema, although it would be my
preferred way.

I also looked at JAXB and Xerces, but their APIs seem to be more
complicated than I need.

Is there a simple API for doing what I need?


The W3C DOM Level 3 has validation module with an API that should allow
you to get the information that you describe above, it is documented at
http://www.w3.org/TR/2004/REC-DOM-Level-3-Val-20040127/
The Oracle XML developers kit as documented at
http://otn.oracle.com/tech/xml/xdk/xdkbeta.html
claims to implement
DOM Level 3.0 Validation(working draft dated 8th October 2002)
but I haven't tested that. I don't know whether there are other
implementations of that DOM specification available, the implementation
report at
http://www.w3.org/2003/07/DOM-Level-...entations.html
speaks of three implementations.

Other than that I think Xerces is the way to go but you have had a look
at that already as you said.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Zandy Marantal | last post by:
Hello everyone, I'm having trouble using Xerces2(2.4, 2.5) when validating against an XML schema if a general entity reference is defined within the XML file. The error I'm getting is this:...
2
by: Ken Philips | last post by:
As far as I know the Schema Object Model (SOM) is only working for the MSXML Parser together with CSharp or VisualBasic but not Java. Is there a similar Tool/Spec/Api for the Java World? Ken
4
by: Oskar Stuffer | last post by:
Hi! I'm using the msv tool which uses xerces to validate a XML document against a XML Schema definition. This is my XML Schema definition: <?xml version="1.0" encoding="ISO-8859-1"?>...
5
by: member | last post by:
Hi, I'm looking for tools which can valid an XML document with and XSD schema. I'm using Eclipse and I don't know how to do that and if I can ? Thanks, Laurent Duretz
5
by: BMeyer | last post by:
I have been losing my mind trying to parse an XML document (with nested child elements, not all of which appear in each parent node) into a DataGrid object. What I want to do is "flatten" the XML...
1
by: Confused XML hacker | last post by:
My application needs to be able to parse and validate either a DTD or schema based document without knowing in advance which form of grammar a document is using. (New documents presented to my...
0
by: nithyasri | last post by:
How to Parse Xml schema using .NET and get an object model? I need to parse an Xml schema and display it as a tree structure in dot net. How do i do it? Any help will be appreciated.
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
6
by: sushmaraghu | last post by:
Can anyone tell me how to validate xml files which are not W3C complaint in C#.NET. my xml file is of this format <?xml version="1.0" ?> <Test xmlns="x-schema:MySchema.xml"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.