473,498 Members | 37 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert an HTML DOM node to XML Document for XSLT in browser via javascript

I'm wondering if anyone has any ideas about a way to quickly convert an
HTML DOM Node into an XML Document. The goal is that I want to perform
XSLT on the Node, which is coded correctly as XHTML. In Mozillae, it
works to parse the serializeToString output, but this functionality
doesn't exist for IE.

I've made one function that loops through all the nodes & attributes
and constructs a string that can be successfully parsed into xml, but
it is pretty slow. I can't imagine creating a XML Document object and
then doing the same loop to add on objects via XML DOM would be faster.

I don't want to send the html up to a server (to be tidied or whatever)
and it just seems like there might be some magick way to do this that I
can't come up with.

Any ideas?

Jul 22 '06 #1
4 3094


elsigh wrote:
I'm wondering if anyone has any ideas about a way to quickly convert an
HTML DOM Node into an XML Document. The goal is that I want to perform
XSLT on the Node, which is coded correctly as XHTML. In Mozillae, it
works to parse the serializeToString output,
Mozilla's XSLT processor and Opera 9's XSLT processor can do
transformation on HTML DOM nodes so I don't see why you would want to
make some transition to XHTML with JavaScript to then feed the node to
the XSLT processor. You can as well directly feed the node to the XSLT
processor.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 22 '06 #2
Mozilla's XSLT processor and Opera 9's XSLT processor can do
transformation on HTML DOM nodes so I don't see why you would want to
make some transition to XHTML with JavaScript to then feed the node to
the XSLT processor. You can as well directly feed the node to the XSLT
processor.

Martin Honnen
http://JavaScript.FAQTs.com/
Right, but my issue is with being able to do this in IE (6). It's
neither slow nor difficult in Firefox.

Jul 22 '06 #3
Hi elsigh,

sorry for my english, I'm french...
congratulation for your reorganisable Datagrid, it's impressive.

perhaps, this can help you:
http://erik.eae.net/archives/2005/07/03/20.19.18/
and this :
http://www.pascarello.com/TestHTMLXMLfromserver.htm

Jul 22 '06 #4
Thanks petitevache!

Thing is - both of those examples involve using Ajax to solve the
problem - by getting something down from the server as XML. I'm
currently using parseFromString after creating a string in IE - looping
through the DOM an assembling the string piece by piece - which is
really slow, but seems to be the only way to get well formed xhtml from
the html DOM in IE. But if there was a faster way, or a way to get an
XML Document somehow more readily from an HTML DOM node, that would
really be perfect. Maybe there is just no way.
-l

petitevache wrote:
Hi elsigh,

sorry for my english, I'm french...
congratulation for your reorganisable Datagrid, it's impressive.

perhaps, this can help you:
http://erik.eae.net/archives/2005/07/03/20.19.18/
and this :
http://www.pascarello.com/TestHTMLXMLfromserver.htm
Jul 22 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1854
by: Matt | last post by:
I want to use XML to store a document's configurations. And I can convert to different file format by using XSL. For example, convert to HTML, PDF, or RTF. But the contents are all stored in single...
1
4254
by: Murtaza Tinwala | last post by:
Hi mates, I have the following problem in XSLT. I have following variables: ref-file = <path of XML document> eg "xmlDoc.xml" repeatpath = <a repeat path expressed in Xpath like /root/person >...
2
3706
by: Chris | last post by:
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...
5
3580
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
2
6801
by: Rick | last post by:
I have an XML document that is generated from Infopath, I need to change the value of a namespace that is defined in a node in the form: <xsf:xDocumentClass "xmlns:my=valuehere">. when i navigate...
2
2078
by: taras.di | last post by:
Hi everyone, Is it possible to place javascript outside of <html> tags? I'm trying it on mozilla atm, and it seems to be working, but I was more worried about the older browsers. Cheers ...
2
3032
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is...
4
2063
by: Steven Davies | last post by:
Hi, My problem is this: I have an XML file I'm transforming to XHTML by using XSLT, and the XML file contains some values as Unix timestamps (integer value of seconds since 00:00 1970-01-01) and...
12
11545
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I...
0
7124
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4586
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.