Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 04:11 PM
Chris
Guest
 
Posts: n/a
Default Why does this work? (xhtml? custom html?)

Im hoping someone can help me understand why this works?

Requirement:
Navigate DOM through javascript to perform DHTML actions.

Issue:
GIANT html document, up to 4MB in size, thousands and thousands of
table rows.

What didn't work:
1) Tried to figure out if I could load the HTML into a XML parser
through javascript. The I could use a XPath statement to quickly
navigate to the nodes of interest. Couldn't find a way to do this, is
it even possible? I would be interested in knowing...

2) Tried custom tags, such as <mytag> to logically divide up the HTML.
I was able to get a reference to these tags through the DOM, but
whenever I tried to get the custom tag's child nodes I would always
get nothing. Why is this?

What did work:
Adding "xmlns=something" to the "html" tag, and then using
<something:mytag> for my custom tags.

Does anyone know why this worked when normal custom tags didn't work?

I'm glad it works, but I would be interested in knowing why it works
:) .
  #2  
Old July 20th, 2005, 04:12 PM
Andy Dingley
Guest
 
Posts: n/a
Default Re: Why does this work? (xhtml? custom html?)

On 12 Jul 2003 10:44:14 -0700, cmay@walshgroup.com (Chris) wrote:
[color=blue]
>Adding "xmlns=something" to the "html" tag, and then using
><something:mytag> for my custom tags.[/color]

Surely xmlns:foo="something" and <foo:mytag> ?
[color=blue]
>Does anyone know why this worked when normal custom tags didn't work?[/color]

I presume that by "worked" you mean "IE ran it at least once without
barfing". I suspect that the presence of namespace non-HTML elements
causes them to be handled differently in the DOM (maybe loaded into a
parallel XML-like DOM). You're way off the standards track here, and
into the Seattle banjo country.


4MB sucks as HTML. Far too big, and you'll get timeouts.

I've done very similar stuff to this in the past, but I went with XML
data islands. Yes, it's IE-dependent, but like most of my work, this
was an intranet. Rather than loading my squiggabyte of data into the
HTML in-line, I loaded it through an XML DOM ActiveX object, created
from JScript on the page (NB - not the <XML> element).

Eventually I went to a load-on-demand architecture for this, where I
loaded chunks of tree as needed (it drove a hierarchy browser). I had
something like 20MB of potential XML, but rarely needed more than
100K. For initial building while I coded the interface though, I just
loaded the whole XML dataset at startup.
  #3  
Old July 20th, 2005, 04:12 PM
Chris
Guest
 
Posts: n/a
Default Re: Why does this work? (xhtml? custom html?)

Andy Dingley <dingbat@codesmiths.com> wrote in message news:<jci2hvo5vtoircha148h06s3q4h9q1k6d2@4ax.com>. ..[color=blue]
> On 12 Jul 2003 10:44:14 -0700, cmay@walshgroup.com (Chris) wrote:
>[color=green]
> >Adding "xmlns=something" to the "html" tag, and then using
> ><something:mytag> for my custom tags.[/color]
>
> Surely xmlns:foo="something" and <foo:mytag> ?[/color]


Yea, I mistyped.. I have been using: <html xmlns:costreport>.

[color=blue]
>[color=green]
> >Does anyone know why this worked when normal custom tags didn't work?[/color]
>
> I presume that by "worked" you mean "IE ran it at least once without
> barfing". I suspect that the presence of namespace non-HTML elements
> causes them to be handled differently in the DOM (maybe loaded into a
> parallel XML-like DOM). You're way off the standards track here, and
> into the Seattle banjo country.
>[/color]


I figured this was probably something weird. I can't really find any
documentation about what is going on. I can locate custom elements in
the HTML DOM just fine, without putting in xmlns:asdf in the HTML tag,
but if I get a reference to a custom element in javascript, and try to
have it return its childNodes, I get nothing.

[color=blue]
>
> 4MB sucks as HTML. Far too big, and you'll get timeouts.
>[/color]


4MB is probably the most extreme case. A more realistic size would be
1MB.

Will the browser time out, even if it is getting a steady stream of
HTML coming down?


[color=blue]
> I've done very similar stuff to this in the past, but I went with XML
> data islands. Yes, it's IE-dependent, but like most of my work, this
> was an intranet. Rather than loading my squiggabyte of data into the
> HTML in-line, I loaded it through an XML DOM ActiveX object, created
> from JScript on the page (NB - not the <XML> element).[/color]


So you instantiated an instance of the MSXML parser from Javascript,
loaded a remote XML document, and then had it write out the HTML you
wanted (document.write or foo.innerHTML = xdoc.something right?)?

I considered doing something like this as well, and if I could start
from scratch this is probably how I would do it. Or, maybe just pass
down an XML document with an associated XSLT that would make the page
look like we want.

BTW, this is an intranet thing too, so we can be IE-Dependent as well.
[color=blue]
>
> Eventually I went to a load-on-demand architecture for this, where I
> loaded chunks of tree as needed (it drove a hierarchy browser). I had
> something like 20MB of potential XML, but rarely needed more than
> 100K. For initial building while I coded the interface though, I just
> loaded the whole XML dataset at startup.[/color]


At first I built a totally awsome server side app to do this project.
It would load stuff on demand and display the data in a hierarchical
manner, and would cache the data on the server to ensure a minimal
number of trips to the database. It was truly awsome, and I couldn't
have been more proud of it. However, the powers that be wanted to see
all the data, not just some of it.


Do you know how long would it take to load a 1MB XML document into an
XML Parser running in Javascript (best guess)? 1 second? 5 seconds?
more?

I'm SURE that if we were to send the data as XML to the clients
browser, and cut out all the unnecessary HTML, we could make the size
of the document 1/4 as big, if not even smaller as you could do stuff
like changing <mycustom:project> tags into <m:p>, and stuff like <td
class="NoBorderTD" colspan="3">&nbsp;</td> which are repeated a ton of
times would be programmed into the code or XSLT once.

Man that would kick ass... There is a little more pressure to get
something done here, than to really do something of the upmost
quality/performance. Quick and dirty wins the race I guess.
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles