473,809 Members | 2,819 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 serializeToStri ng 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 3130


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 serializeToStri ng 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
1880
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 XML file. Are they any documentation management tools/web site that help people do that? please help. thanks!!
1
4272
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 > eg "/root/person" node = <name of a child node in repeat path> eg" "name" Now, I want to get to the 'node' in XSLT using Xpath.
2
3735
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 thousands of table rows. What didn't work:
5
3615
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 instruction document (not data based) - same as using an xml web control. The resulting html is on the client? but what about the server side of things? Trying to figure out how to change and save the xmlDocument. It I put a button OUTSIDE of the...
2
6859
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 to the namespace value it is read only and cannot be changed. Can anyone tell me how to change this value? My Code: Dim sSingleNode As XmlNode = objDoc.SelectSingleNode("//xsf:Node", NamespaceManager)
2
2101
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 Taras
2
3063
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 what I'm hoping to achieve. I've never before had to use Javascript closures, but now I do, so I'm making an effort to understand them. I've been giving this essay a re-read: http://jibbering.com/faq/faq_notes/closures.html
4
2082
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 the only way I can think of displaying those values as human-readable is by using Javascript. Converting the times isn't the problem, what I'm stuck with is actually writing the new value into the document, since document.write(newValue); just...
12
11605
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 don't want to have to use some external program or script to parse the csv first if possible
0
10635
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10378
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9198
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7653
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.