[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xml parsing how-to?

  • From: "rsanford" <rsanford@n...>
  • To: <xml-dev@l...>
  • Date: Mon, 5 Jun 2000 11:22:57 -0500

parsing how to
newbie question. i wanted to search the archives but the
links on xml.org are not functioning.

i'm using ibm's xml4c java parser and i'm using the
DOM api and i have come to the conclusion that the
code i'm writing, while effective, is, very simply,
baboon-butt ugly.

i have a dtd and i am receiving a document that follows
that dtd. to retrieve all the data from the document i
am explicitly navigating through elements in the dtd
and their children and retrieving the values from them
by using DOM_Element::getElementsByTagName("ElementName")
and then iterating through each element in the list and,
if appropriate, asking each one for its text node and
then getting the element value from that text node.

i have line after line of code that looks at an element
with a hard-coded name and then gets the value and it
is ugly. there _has_ to be a better way. somebody please
tell me there is a better way.

the sample code that i have seen is not particularly
useful. there are lots of samples where a tree is printed
out as it is parsedbut i haven't found any code that
gives an example of knowing what the dtd is and actually
_using_ the data within the xml document to do something
(like store in columns in a database).

does anyone have any pointers to good texts on parsing
xml? useful sample code appreciated.



This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.