|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to create XML file from XML island in HTML?
Hi there,
I want to display some data in HTML using XSL. I can use xml file to display in the HTML page. But, I want to do the same thing using XML Island embedded in to HTML (below "XMLID" xml portion) I want to use loadXML() as in the below ProcessXML1(), how ca I convert this "XMLID" xml island to a string? function ProcessXML1() { var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0"); xmlDoc.async = false; xmlDoc.resolveExternals = false; xmlDoc.loadXML("<customer><first_name>Joe</first_name><last_name>Smith</last_name></customer>"); if (xmlDoc.parseError.errorCode <> 0) { var myErr = xmlDoc.parseError alert("You have error " + myErr.reason); } } Thanks in advance, Chandima PS: We're using ASP.NET with C#, the XML island comes from the database. <html> <head> <body> <xml id="XMLID"> <?xml version="1.0" ?> <Address> <name> ABC <phone>1234</phone> <cell>111111</cell> </name> <name>EFG <phone>77777777</phone> <cell>99999999 </cell> </name> </Address> </xml> <script language="JavaScript"> function ProcessXML() { // Load XML var xml = new ActiveXObject("Microsoft.XMLDOM") xml.async = false //xml.load("addresses.xml") -- This works fine, but I want to use above XML Island instead of this addresses.xml file // Load XSL var xsl = new ActiveXObject("Microsoft.XMLDOM") xsl.async = false xsl.load("addresses.xsl") // Transform document.write(xml.transformNode(xsl)) } </script> <input type="button" onClick=ProcessXML()> </body> </html> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > How to create XML file from XML island in HTML? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|