J
Johannes Koch
Hi there,
I'd like to apply an xpath to both HTML and XHTML documents. First I
create a DOM document with a Java DOM parser, then apply the xpath with
Xalan's XPathAPI class. The problem is that in HTML DOM element names
are all upper-case, whereas in Core DOM (used for the XHTML documents)
element names are lower-case. When I use a lower-case xpath, e.g.
/head[@profile='http://www.example.org/MyProfile']
it won't match with a head element in an HTML document. OTOH, when I use
/HEAD[@profile='http://www.example.org/MyProfile']
it won't match with a head element in an XHTML document.
I cannot make the whole xpath lower-case in case of an XHTML document,
because there may be case-sensitive things in the xpath, like the URL in
the example above.
There may be some Java classes to parse the xpath string and get the
element names to make them upper-case for HTML. Does anyone know of such
things?
I'd like to apply an xpath to both HTML and XHTML documents. First I
create a DOM document with a Java DOM parser, then apply the xpath with
Xalan's XPathAPI class. The problem is that in HTML DOM element names
are all upper-case, whereas in Core DOM (used for the XHTML documents)
element names are lower-case. When I use a lower-case xpath, e.g.
/head[@profile='http://www.example.org/MyProfile']
it won't match with a head element in an HTML document. OTOH, when I use
/HEAD[@profile='http://www.example.org/MyProfile']
it won't match with a head element in an XHTML document.
I cannot make the whole xpath lower-case in case of an XHTML document,
because there may be case-sensitive things in the xpath, like the URL in
the example above.
There may be some Java classes to parse the xpath string and get the
element names to make them upper-case for HTML. Does anyone know of such
things?