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


Groups > comp.lang.javascript > #22400

Re: Using XPath for HTML Documents in IE

From Joao Rodrigues <groups_jr-1@yahoo.com.br>
Newsgroups comp.lang.javascript
Subject Re: Using XPath for HTML Documents in IE
Date 2013-12-25 12:52 -0200
Organization Aioe.org NNTP Server
Message-ID <l9erf6$1bs$1@speranza.aioe.org> (permalink)
References <XnsA2A14B1D42F05UVAA@78.46.70.116>

Show all headers | View raw


On 25/12/2013 10:23, Patient Guy wrote:
> IE purportedly supports XPath for XML documents (not tested by me), but not
> for valid HTML documents (tested by me using document.evaluate method).
>
> Are there any solutions (Microsoft implementations? library code by others?)
> for using XPath in HTML within IE of which I am unaware?
>
> Solutions considered by me and judged not workable:
>
> 1. Spending days writing my own bug-ridden hack as library code for XPath to
> make it work in IE

IE supports the ActiveX MSXML2.DOMDocument which you can use:
<http://www.nczonline.net/blog/2009/04/04/xpath-in-javascript-part-3/>

However I think there are some JavaScript libraries that will help to 
using the XPath syntax in a cross-browser fashion.

>
> 2. Re-writing the HTML documents into far less readable and quite verbose
> valid XHTML is out of the question and should be unnecessary at any rate.
>

If a page doesn't use the 'application/xhtml+xml' MIME type [RFC3236], 
it will be served with a MIME type of text/html no matter it starts with 
the XHTML doctype or uses the XML syntax. It is important to say that 
the web server must be able to serve XHTML pages when triggered by the 
corresponding MIME Type.

MSIE 9 was the first version to recognize 'application/xhtml+xml' MIME type:
<http://blogs.msdn.com/b/ie/archive/2010/11/01/xhtml-in-ie9.aspx>

Also it is important to mention that the W3C shut down the XHTML 2 
Working Group in October, 2009, increasing resources on HTML 5:
<http://www.w3.org/News/2009#entry-6601>

Therefore, solution #2 is correct: don't waste your time writing XHTML 
pages.
-- 
Joao Rodrigues

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


Thread

Using XPath for HTML Documents in IE Patient Guy <pg@keepItOnTheUse.Net.invalid> - 2013-12-25 12:23 +0000
  Re: Using XPath for HTML Documents in IE Bjoern Hoehrmann <bjoern@hoehrmann.de> - 2013-12-25 14:16 +0100
    Re: Using XPath for HTML Documents in IE Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-25 22:53 +0100
  Re: Using XPath for HTML Documents in IE "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-25 15:11 +0100
  Re: Using XPath for HTML Documents in IE Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-25 12:52 -0200

csiph-web