Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Parser

 
Jithesh Kozhipurath
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai all,
Is there any need for separate XMLparser for jdk1.4.If it is available how to use the XML parser. How to set the class path and what are the methods to parse the XML document. What parser can we use(SAX, DOM etc.). My requirement is to send a XML request & retrive a XML response and parse it.
Thanks in advance.
Jithesh
 
Manish Hatwalne
Ranch Hand
Posts: 2595
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using JDK 1.4, you do not need a separate parser, since JDK has in-built support for XML, and if I recall correctly, it uses crimson parser.
HTH,
- Manish
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My requirement is to send a XML request & retrive a XML response and parse it.
Just as an aside, you should understand that you may not even need an XML parser for this. Sure the document(s) are XML, but if all you need to do is extract a build a standard request with a small number of variable fields, and extract a small number of element values from a response, you might as well use Java's built-in string handling.
For example, something like:

I only suggest this because a full-fat XML parser is a heavyweight thing, and the code to use it will probably be much bigger and more complex than what I have given above. If you really do need an XML parser, I apologize for the interruption.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frank and Manish,
Is there any central place for information on when to use Java and when , XML ? It may also make learning of the two easier. Is JDK 1.4 the best place for this ?
regards
[ September 01, 2003: Message edited by: HS Thomas ]
 
Manish Hatwalne
Ranch Hand
Posts: 2595
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Frank Carver:
My requirement is to send a XML request & retrive a XML response and parse it.
I only suggest this because a full-fat XML parser is a heavyweight thing, and the code to use it will probably be much bigger and more complex than what I have given above. If you really do need an XML parser, I apologize for the interruption.

I wholeheartedly agree with Frank, make sure that your requirements justify use of XML. Quite often I have seen developers opting for XML parsers when even simple StringTokenizer would suffice.
- Manish
 
Jithesh Kozhipurath
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you friends,
I am looking at a software that will be compatible with all the programming languages so I am in need of XML. Now i want to work it with java, and may be i will change it to some other. And the data is retrived from a remote database, so I must use XML for the data transfer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic