Solved

Xml Schema parser

Posted on 2008-10-20
5
190 Views
Last Modified: 2012-05-05
Hello,
Given the following line of code;
SchemaParser sparser = new SchemaParser(schemaParserFile.toURI().toURL());
The URL points to an xml file.

How could one print/show the content of sparser?  
I have tried; System.out.print(sparser.getConstraints()); but nothing get printed. it could be that it is empty.
Also, if the xml file does not have "constraints" then the method getContraints might have nothing to get.
I was hoping it would read/get the tags, but it does not seem like it does.
Any suggestions?
0
Comment
Question by:chima
  • 3
  • 2
5 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 22764197
If you are using SchemaParser from this package:
http://oodt.jpl.nasa.gov/metadata-service/apidocs/jpl/eda/metadata/validation/package-summary.html

Then it appears you get the constraints that the Schema defines as a Map.  The API for the Constraint object itself can be found on same link above.

Otherwise, please provide the package you are using SchemaParser from.
0
 

Author Comment

by:chima
ID: 22767618
mwvisa1, while I got the code from here; http://www.javaworld.com/jw-11-2000/Validation/src.zip
I have debugged it some.  If you need to see the debugged version, please let me know.
0
 

Author Comment

by:chima
ID: 22767671
mwvisa1, I looked at the link that you provided and it is the package I am using.  How then could I look at the Map?  The xml file I am working with does not provide constraints.  It provides tags and it is these tags information that I am hoping to parse.
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 22767949
From what I can gather on this API, you don't call the SchemaParser directly (at least doesn't seem like it to me).  You pass the SchemaUrl to the factory method that creates the instance of Validator.  The Validator object then uses the Constraints passed back by the parser to determine if data you pass it to validate meets the constraints imposed by the XSD (Schema Document).
0
 

Author Closing Comment

by:chima
ID: 31508059
Thanks, more to come.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now