Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Xml Schema parser

Posted on 2008-10-20
5
Medium Priority
?
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

722 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