Hello,
First I would suggest U to set Ur class path according to either JAXP or
xerses. though both contain the same files. set it to include the jaxp.jar file
in the jaxp directory. Then U have to use the APIs in the file jaxp.jar. But in
case U only need the desired content to be printed, then use the below
application else U need to write a different code for getting the desired
result. first convert the string in to an xml document, then pase that document
using the following APIs. Node, Nodelist, etc.
I know its a tough path ahead if U R a beginner. check if the jaxp has
documentation of these APIs, else go to the src code of these in src.zip file
in the jaxp directory.
Bye
Navdeep
--- Devaguptapu Shiva <[EMAIL PROTECTED]> wrote:
> Hi,
> Thanks for ur response. But can u please help me in working out the
> following example from the book "Java and XML". I am having
> jaxp.jar,xalan.jar and crimson.jar downloaded from sun.java.com and
> installed as per them in jdk1.3\jre\lib\ext and the classpath was set
> exactly. Also I downloaded Xerces-J-bin.1.3.0.zip and also
> Xerces-J-bin.2.0.0.alpha.zip, but not installed. Can u please help me in
> installing proper files in respective places and working properly with them
> and these examples.
>
> The example program :
>
> import org.xml.sax.XMLReader;
> import javax.xml.parsers.SAXParser;
> public class SAXParserDemo
> {
> public void performDemo(String uri)
> {
> System.out.println(" Parsing XML File : "+uri+"\n\n");
> XMLReader parser = new SAXParser();
> }
> public static void main(String[] a)
> {
> if (a.length != 1)
> {
> System.out.println("Usage : java SAXParserDemo [XML URI]");
> System.exit(0);
> }
>
> String uri = a[0];
> SAXParserDemo parserDemo = new SAXParserDemo();
> parserDemo.performDemo(uri);
> }
> }
>
> My actual problem is to parse the following XML string into java and to
> build a Hash Table Object with names as the element names and values as the
> values in between the tags.
>
> The XML String of my problem :
> <aaaaa>
> <bbbbb> bbbbb_value </bbbbb>
> <ccccc> ccccc_value </ccccc>
> <ddddd> ddddd_value </ddddd>
> <eeeee>
> <fffff> fffff_value </fffff>
> <ggggg> ggggg_value </ggggg>
> </eeeee>
> </aaaaa>
> I'll recieve the above xml part in String format (in java) and I've to parse
> it to get the <bbbbb> to </ddddd> part and <eeeee> to </eeeee> part
> seperately. In fact I don't need to seperate the contents of the <eeeee>
> </eeeee> body and I need only the previous part of the XML String. Any one
> please mail me even if you have some code or example code for this task to
> be done. I'll be thankful for the help.
> Thanks and regards,
> D. Shiva.
>
__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/