Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #28590
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | markspace <markspace@nospam.nospam> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Eloquence Denied?: getElementsByTagName |
| Date | Wed, 28 May 2014 16:18:23 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 28 |
| Message-ID | <lm5qsk$ap8$1@dont-email.me> (permalink) |
| References | <de4b166f-4b14-4b56-9244-0d4745a64fc4@googlegroups.com> <argv-20140529001301@ram.dialup.fu-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Wed, 28 May 2014 23:18:44 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="9358cda03e1e0dfd3c4b757daa608707"; logging-data="11048"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//OunMaKMerWEkXIQaPkU8gTePt6jSbTg=" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
| In-Reply-To | <argv-20140529001301@ram.dialup.fu-berlin.de> |
| Cancel-Lock | sha1:4eVjm1tHUnPjeIc9ifWYLBd2FmI= |
| Xref | csiph.com comp.lang.java.programmer:28590 |
Show key headers only | View raw
On 5/28/2014 3:13 PM, Stefan Ram wrote:
> clusardi2k@aol.com writes:
>> write the below program without hardcoding "person"
>> public static void main (String argv [])
>> doc.getElementsByTagName("person");
>
> doc.getElementsByTagName( argv[ 0 ]);
>
Oh, if *that's* what the OP means... hmm, I usually use SAX, I'm not
seeing a DOM equivalent. SAX hands you the name of the node, and lists
attributes by index (number) rather than strictly by name. I guess DOM
is for when you already know that there's going to be a "person" node in
your XML file.
SAX:
- ContentHandler.startElement:
http://docs.oracle.com/javase/7/docs/api/org/xml/sax/ContentHandler.html#startElement%28java.lang.String,%20java.lang.String,%20java.lang.String,%20org.xml.sax.Attributes%29
- Attributes.getLocalName():
http://docs.oracle.com/javase/7/docs/api/org/xml/sax/Attributes.html#getLocalName%28int%29
and other similar methods that take an int index like getQName()
and getValue().
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll 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