This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XMLDOM - selection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XMLDOM - selection" Watch "XMLDOM - selection" New topic
Author

XMLDOM - selection

Trina Thach
Greenhorn

Joined: Jun 12, 2001
Posts: 18
I have the following XML:
<root>
<tag>text 1</tag>
<tag>text 2.</tag>
<tag1>text 3</tag1>
<nextag>text text text text text text</nextag>
<tag>text text</tag>
<tag2>text text</tag2>
</root>

I want to write a script (Perl, ASP, JAVA anything will do) using XMLDOM to select all tags before <nextag>. Please help!

Thanks muchly.
Mahesh Trikannad
Ranch Hand

Joined: Dec 14, 2004
Posts: 66
U could use a DOM Parser ( JAXP or JDOM ), iterate through the tags till u find the one u want to stop at. JAXP and JDOM are JAVA APIS


Mahesh Trikannad
Trina Thach
Greenhorn

Joined: Jun 12, 2001
Posts: 18
Any sample codes (or URL related to this topic) would be thankful.
Mahesh Trikannad
Ranch Hand

Joined: Dec 14, 2004
Posts: 66
http://www.javaworld.com/javaworld/jw-05-2000/jw-0518-jdom_p.html

for JDOM.
 
Don't get me started about those stupid light bulbs.
 
subject: XMLDOM - selection
 
Similar Threads
Embedding a tag library within another tag library
Question on JSP Tags
JSP Tag that contains result of another
Fundamental Question of XML
How to read XML data