Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28576

Re: Eloquence Denied?: getElementsByTagName

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Eloquence Denied?: getElementsByTagName
Date 2014-05-28 09:50 -0400
Organization A noiseless patient Spider
Message-ID <lm4pim$jbv$1@dont-email.me> (permalink)
References <de4b166f-4b14-4b56-9244-0d4745a64fc4@googlegroups.com>

Show all headers | View raw


On 5/28/2014 9:04 AM, clusardi2k@aol.com wrote:
> Is there an alternative way to write the below program without hardcoding "person", "first", "last", and "age" or putting these into a file and reading the contents of a file.
> [... code snipped; see up-thread ...]

     I can't think of any.  You can certainly navigate the DOM without
foreknowledge of the tag names, but that won't tell you what to do
with each tag.  That is, there's nothing in the XML itself to tell you
to count the number of `person' tags, nor to print "Last Name : " before
the content of each `last' tag.  For that matter, there's nothing in
the XML that tells your program to ignore the `citizenship' tags.

     To put it another way: The XML data doesn't know which parts of
itself your program might be interested in, nor what your program
should do with them.  It's up to your program to know these things.

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Eloquence Denied?: getElementsByTagName clusardi2k@aol.com - 2014-05-28 06:04 -0700
  Re: Eloquence Denied?: getElementsByTagName Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-05-28 09:50 -0400
  Re: Eloquence Denied?: getElementsByTagName leif.roar@invalid.com (Leif Roar Moldskred) - 2014-05-28 09:24 -0500
  Re: Eloquence Denied?: getElementsByTagName markspace <markspace@nospam.nospam> - 2014-05-28 09:07 -0700
  Re: Eloquence Denied?: getElementsByTagName Joerg Meier <joergmmeier@arcor.de> - 2014-05-29 01:05 +0200
  Re: Eloquence Denied?: getElementsByTagName markspace <markspace@nospam.nospam> - 2014-05-28 16:18 -0700

csiph-web