New Java Project

awking00
awking00 used Ask the Experts™
on
See attached file for my question.
EE-Java-question1.txt
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
1. You to get the XML data from the column from the DB into an Object
2. Then either using Sax or Dom parser you would need to parse it and put data accordingly.

Read on Sax/Dom Parsers
Mick BarryJava Developer
Top Expert 2010
Commented:
awking00Information Technology Specialist

Author

Commented:
objects,
Thanks for the links but, unfortunately, my firewall won't allow me to access those sites :-(
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Commented:
This is the code from those links
Use a StringReader for your InputSource.
view sourceprint?

1.DocumentBuilderFactory factory =
2.   DocumentBuilderFactory.newInstance();
3.InputSource source = new InputSource(
4.   new StringReader(xmlString))
5.Document document =
6.   factory.newDocumentBuilder().parse(source); 

ransforming XML in Java is achieved using a Transformer. To use an XSL file for the transformation involves first creating Templates instance which can then be used to create the required Transformer.
view sourceprint?

1.TransformerFactory factory = TransformerFactory.newInstance();
2.Templates template = factory.newTemplates(
3.   new StreamSource(new FileInputStream(xslPath)));
4.Transformer transformer = template.newTransformer();
5.Source source = new StreamSource(new FileInputStream(xmlInputPath));
6.Result result = new StreamResult(new FileOutputStream(xmlOutputPath));
7.transformer.transform(source, result);

Open in new window

For your question, I need little clarification What exactly you want in the project ? The whole project or the how to read XML file as objects? Please be more specific about your need which will help me to help you.

Thanks
Viswanath.
awking00Information Technology Specialist

Author

Commented:
See attached.
comment.txt
Information Technology Specialist
Commented:
The attached solution came from an outside source, but is basically what I used to solve my problem.
XRDBTransform.java
Mick BarryJava Developer
Top Expert 2010

Commented:
> The attached solution came from an outside source, but is basically what I used to solve my problem.

It also the same as what was suggested to you above to transform your xml
awking00Information Technology Specialist

Author

Commented:
My main hurdle, that I thought I had pointed out, was that I first needed to make a connection in order to submit a query to retrieve the xml. The accepted solution provided this, which I did not see in any of the other proposals (it may have been in the links but, as I stated, I am unable to see them). As for the transformation step, I am not averse to awarding points to mhamel06 since my final resolution was along similar lines to his, and also similar to the accepted solution, although not exactly. How would you like me to treat this?
Mick BarryJava Developer
Top Expert 2010

Commented:
spilt 33933306 mhamel06 awking00
Mick BarryJava Developer
Top Expert 2010

Commented:
oops, split 33933306 33940970 34438649
Starting auto-close process to implement the recommendations of the participating Expert(s).
 
modus_operandi
EE Admin

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial