Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Xml Schema parser

Posted on 2008-10-20
5
Medium Priority
?
202 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 60

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 60

Accepted Solution

by:
Kevin Cross earned 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

972 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