You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Moganna, Prasad" <pr...@bankofamerica.com> on 2001/11/02 18:57:19 UTC

Parsing a xml file and getting node name/values

Hi All,

I have a xml file (short snippet as shown below)

<PAGE>
	<BUSCASE>
		<NAME>Books Set 1</NAME>
		<URLS>
	
<URL><![CDATA[/servlet/book1?title=abc&author=Fowler]]></URL>
	
<URL><![CDATA[/servlet/book2?title=xyz&author=Hunter]]></URL>
	
<URL><![CDATA[/servlet/book3?title=pqrs&author=GOF]]></URL>
			.......
			.....
		</URLS>
		<OTHERS>
			<every>1</every>
			<increaseby>2</increaseby>
			<delay>10</delay>
		</OTHERS>
	</BUSCASE>
.....
....
</PAGE>

My requirement is, given the "BUSCAE" node handle, the program should output


NAME - Books Set 1
URL - /servlet/book1?title=abc&author=Fowler
URL - /servlet/book2?title=xyz&author=Hunter
URL - /servlet/book2?title=pqrs&author=GOF
every - 1
increaseby - 2
delay - 10

I can traverse through the tree and make a comparison on each node's name
and type,
but that would end up in too many comparisons. Is there any other way of
writing such a program, if anybody has written such a program and would like
to share, 
it would be of great help.

BTW, there is a DTD for this xml file and the above file snippet satisfies
the dtd.

Thanks,
Prasad M

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org