Thanks for all the responses to my question. I did finally get
this working
using Xpath. I was avoiding an XSLT solution because I'd rather
do as much
as I can in Java if possible (personal preference). I'm new to
JDOM, so just
getting my sea legs as to where the boundaries are. I assumed
someone else
had desired to do what I was seeking to do and had already
established a
Java/JDOM solution.
-----Original Message-----
From:
Phil Weighill-Smith [mailto:phil.weighill-smith@volantis.com]
Sent:
Saturday, March 26, 2005 4:22 PM
To: Phil Weighill-Smith; Michael Smith;
jdom-interest@jdom.org
Subject: RE: [jdom-interest] Question about
ElementScanner
Which then made me think: why not use XSLT
instead?
Phil :n.
-----Original Message-----
From:
Phil Weighill-Smith
Sent: Sat
26/03/2005 13:50
To: Michael
Smith; jdom-interest@jdom.org
Cc:
Subject: RE: [jdom-interest]
Question about
ElementScanner
Try using XPath to select all elements you want to replace then
manipulate
these elements via the JDOM
API.
E.g. to find all elements called "x" anywhere in a document use the
XPath
"//x", or to find all elements called "x" with an attribute "a" with
the
value "example" you could use the XPath "//x[@a='example']". XPath is
very
powerful for performing potentially conditional selection of
elements,
attributes, text nodes etc. especially if you use the various axes
and
built-in
functions.
Phil
:n)
-----Original
Message-----
From: Michael Smith [mailto:mikesmi@nc.rr.com]
Sent: Fri 25/03/2005
16:38
To:
jdom-interest@jdom.org
Cc:
Subject: [jdom-interest] Question
about ElementScanner
Hi
there,
I want to create a way to search
through XML documents and
perform a search and replace on certain elements
regardless of their place
in the hierarchy. I'm thinking ElementScanner is
useful here? If so, can
someone point me to an example of its use. If not,
can you suggest
another/better
way?
Thanks,
Mike
_______________________________________________
To
control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
| This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. |