Re: InnerHTML not grabbing entire HTML if <p> is present



"MaryA" <arrowood@xxxxxxxxxxx> writes:

It is just sitting in an HTML document.

Well it's not an HTML document then, since it doesn't follow the
DTD of any version of HTML. The parser appears to parse it as
"tag soup", with gratuitous amounts of error correction. It's
anybody's guess how each browser will treat non-standard codes.

It is written at the bottom of document, for now. I have to find a
way to hid it and still be able to access it.

IE supports "XML islands" inside (otherwise) HTML documents. Other
browsers doesn't. Why use XML at all? If you want to access it with
Javascript anyway, you could just create a Javascript representation
of the data directly (e.g., using a JSON library on the server).

If I put it in as a comment, the getElementById does not find it.

Obviously, since it's not elements in the DOM any more.

I was under the impression that the DOM standard can be used to
access XML and HTML.

The DOM standard doesn't care what the element names of the document
are. The parser that processes the character sequence and turns it
into DOM elements do, since it is expecting HTML. HTML have specific
rules about which elements can be children of which other
elements. E.g., a div element cannot be the child of a paragraph (p)
element. Parsers attempts to be nice to you by accepting any tag
soup, and then do error correction on the document to try to make
it into a valid HTML document. This includes ending elements where
necessary, so the invalid HTML:
<p>lala<div>didi</div>lala</p>
is read as:
<p>lala</p><div>didi</div>lala
where all tags occour in an allowed order.

You are using non-HTML tags. The parser is, understandably, confuzed.
It appears the browser you use guesses unknown elements to be inline
elements, which cannot contain the block level p element.

It seems to work, in part.

That's also known as "not working" :)
/L
--
Lasse Reichstein Nielsen - lrn@xxxxxxxxxx
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
.



and other tags
... I am trying to catch this event othe TR and TABLE tag.... that the event is fired in the HTML document by adding OnMouseOver to ... The HTML file:...
(microsoft.public.vc.mfc)

Relevant Pages

  • Re: Content-type or TITLE - which should go first
    ... which should be the first in the head tag. ... If indexing programs would use DOM to parse HTML document it does not matter which tag is first and which is the second. ... in head section of the HTML document and apache would send UTF-8 signs ...
    (alt.internet.search-engines)
  • Re: Font Tag
    ... Im writing a HTML parser that removes the tags and keeps using sensible ... div inside font tag of their own specified class. ... Writing an error-tollerent HTML/SGML parser takes a long time. ...
    (alt.html)
  • Re: CSS - how to reference the CSS in a web page?
    ... The basic assumption I always assume is that ASP.NET developers will at least have some basic HTML background before they start. ... Basically, all HTML pages should have at least three elements, starting with the HTML tag. ... So now that we have our starting point, we can move onward to the next element that will describe some important aspects of the HTML document. ... This element is obviously the HEAD tag. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Extracting body from HTML document?
    ... I am wanting to be able to get a section of a HTML document, ... I made a simple parser myself some time back, ... $startpos = strpos; ... $tag = substr ); ...
    (comp.lang.php)
  • Re: DHTML_EVENT_ONMOUSEOVER not caught for