PedroG
asked on
MSXML: html in a node
Hy,
I'm using Microsof XML 3 to build XML files and then tranform them to html using XSL.
My problem is the folowing :
One of my XML nodes content is HTML code.
I'm creating the node using the folowing code :
Set XMLItem = XMLDom.createElement("Text ")
XMLItem.Text = oRs("Text")
XMLConteudo.appendChild XMLItem
oRs("Text") is a recordset field thas as HTML code for ex:(<span class="paintext">This is a test</span>)
My problem is that the xml content isn't the same of the recordset field. The parser is encoding the string. I need to place the string as is.
I also tryed to use cdata like this
XMLItem.Text = "<![CDATA[" & oRs("Text") &"]]>"
but the <![ chars get encoded to.
Is there any way to solve this problem????
Please this is realy urgent.
I'm using Microsof XML 3 to build XML files and then tranform them to html using XSL.
My problem is the folowing :
One of my XML nodes content is HTML code.
I'm creating the node using the folowing code :
Set XMLItem = XMLDom.createElement("Text
XMLItem.Text = oRs("Text")
XMLConteudo.appendChild XMLItem
oRs("Text") is a recordset field thas as HTML code for ex:(<span class="paintext">This is a test</span>)
My problem is that the xml content isn't the same of the recordset field. The parser is encoding the string. I need to place the string as is.
I also tryed to use cdata like this
XMLItem.Text = "<![CDATA[" & oRs("Text") &"]]>"
but the <![ chars get encoded to.
Is there any way to solve this problem????
Please this is realy urgent.
ASKER
it doesn't work
that way insted of havig a <span in my xml i get a <span wich is exactly what the parser was doing by itself.
I need to have the text in such a way that i can use
<xsl:value-of select="content\Text"/> in my xsl and it will output the html code
that way insted of havig a <span in my xml i get a <span wich is exactly what the parser was doing by itself.
I need to have the text in such a way that i can use
<xsl:value-of select="content\Text"/> in my xsl and it will output the html code
try this...
Set X = New DOMDocument30
sTemp = XDom.xml
sTemp = Replace(sTemp, "<", "<")
sTemp = Replace(sTemp, ">", ">")
X.loadXML sTemp
take the xml from the first dom doc object, do the replacements, then load the new string into a second dom doc object.
the only requirement, is that you *still* need well formatted xml. otherwise, it won't load...
better make sure your HTML is right :)
Set X = New DOMDocument30
sTemp = XDom.xml
sTemp = Replace(sTemp, "<", "<")
sTemp = Replace(sTemp, ">", ">")
X.loadXML sTemp
take the xml from the first dom doc object, do the replacements, then load the new string into a second dom doc object.
the only requirement, is that you *still* need well formatted xml. otherwise, it won't load...
better make sure your HTML is right :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks dannic,
That realy solved my problem, i just had to made a minor change in my xsl.
Now it's realy working very nicely
That realy solved my problem, i just had to made a minor change in my xsl.
Now it's realy working very nicely
The regular expressions are : < for < and &rt; for >
So in VB, use this code:
dim sText as string
sText = oRS("Text").Value
sText = replace(sText, "<", "<")
sText = replace(sText, ">", "&rt;")
XMLItem.Text = sText
Give that a try