Solved

Xml Schema parser

Posted on 2008-10-20
5
195 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

821 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