Solved

Xml Schema parser

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTTPSessionBindingListernter not configured in deployment descriptor 2 53
egit plugin on eclipse 8 64
tutorial for ebay api 3 35
eclipse console opening separately 2 21
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

810 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