Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes XML : how to parse effectively ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML : how to parse effectively ?" Watch "XML : how to parse effectively ?" New topic

XML : how to parse effectively ?

Marat Matosov

Joined: Sep 25, 2002
Posts: 6
Hello Dear Sirs !
I am a newbie in XML world and I need to parse and also write to file yhe next XML Format :
<FORMAT NAME="InputQG30Format">
But I have no idea how i can do that ? I will very appretiate your attempt to help me .
How i can parse it ? What is the better parser for this case ? Each clue and code snippet will be properly appretiated .
Thank you ,

Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
You can parse it using different methods,
1.Java with Xerces or crimson
3.ASP with MSXML
4. ......
1.If you want to write a java code to parse the input XML you can read this tutorial and try
using DOM orUSing SAX These two tutorials will give you some basics ideas on how to parse the xml. You can download either Xerces or Crimson as Parser, I found Crimson is faster. can write XSLT to convert the inputXML in to any format you want.You have to learn XSLT which is relatively easy.(don't have good tutorial links now,will give you on monday). But the XML tutorials at this link and the XML Processing tutorials will sure help you,the former will teach you the fundas of XML.
3.OR download MSXML from MS site ,after installing double click MSXML help from your desktop,you will get bunch of tutorials to parse xml using asp,vb,js,vbscript etc.,
[ December 22, 2002: Message edited by: Balaji Loganathan ]

Spritle Software Blogs

Joined: Nov 18, 2002
Posts: 13
Not everybody here is a sir that can help you out.
FormatName fn = (FormatName)u.unmarshal(xmlFile);
FormatName tempfn = ObjectFactory.createFormatName();
TransactionCode tc = ObjectFactory.createTransactionCode();
Marshaller m = jc.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
m.marshal(tempfn, xmlOutFile);
If you're interested in using java objects created from the xml, and are more comfortable with Java, using JAXB might help you.
It is sorta covered in the JavaRanch Style Guide.
subject: XML : how to parse effectively ?