This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Load Employee data from text file and convert it to XML and JSON Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Load Employee data from text file and convert it to XML and JSON " Watch "Load Employee data from text file and convert it to XML and JSON " New topic
Author

Load Employee data from text file and convert it to XML and JSON

Alvaro San Millan
Ranch Hand

Joined: Mar 31, 2011
Posts: 36
Hello everyone,

I have to load information from an Employee contained in a text file (one field per line), and convert it to a XML or JSON representation MATCHING a schema provided. And this last part it's what I am not sure. I know to load the data, and convert it to XML and also to convert from XML to JSON using XSLT, but how about to matching the schema?

Thanks in advance


OCPJP 6 98%
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Depending upon the complexity and size of the XML Schema, this can be relatively very easy or very difficult. You first should analyze the XML Schema and the requirements for the actual XML document that you need to create. Once you cleary understand the XML document structure that is required, you then would check to see if it is valid according to the provided XML Schema. If it is, then you are ready to write code.

When you write the code to create the XML document, you need to write the code to produce the XML document correctly, i.e. a valid XML document that will conform to the rules in the XML Schema. The one check that you should implement is once [the code] has created the document, [the code] should validate against the XML schema to ensure that the document is valid and has been created correctly.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Load Employee data from text file and convert it to XML and JSON
 
Similar Threads
can Hibernate convert an XML schema into relational database schema ?
Build a RESTful web service
Need Help
getting XML schema using java.
JQuery In action - Data Access Options