Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

xml parsing with using java

Hi ,

I have to parse an xml file to get the various files.


This will be a stand alone java program that parses an xml file, reads the values and
create a flat file based on the data. I will be parsing about 2000 32kb xml files at one time.



Can someone tell me which is the best parser out there and give me a sample program the reads an xml file?

Thanks,
Arthur

0
vbguy
Asked:
vbguy
1 Solution
 
mattjustmullCommented:
You could also try the javax.xml.parsers package.

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputStream in = new FileInputStream(filename);

Document doc = db.parse(in);
in.close();
0
 
somasekharCommented:
as kiran hk said

SAX is the right parser for your scenario.

i suggest you one of the best java parsers accepted by the world. The source it self has many examples. you can download it from

http://xml.apache.org/xerces-j/

somasekhar
0
 
drjustinCommented:
Look at
 - xml.apache.org/xmlbeans/
 - xstream.codehaus.org/

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now