473,811 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to transform escaped xml contents in xmlnode

Hi,
I have an XML document, created from ADO DataSet, which contains XML data in
some nodes shown below:
<NewDataSet>
<Table>
<field_name>M y Selection</field_name>
<field_type>dro pdown</field_type>
<field_choice_t ext>
&lt;Choices&gt; &lt;Choice choice_text=\"x xx\" /&gt;&lt;Choi ce
choice_text=\"y yy\" /&gt;&lt;Choi ce choice_text=\"z zz\"
/&gt;&lt;/Choices&gt;
</field_choice_te xt>
<field_answer >
xxx
</field_answer>
</Table>
</NewDataSet>

How can I get the value from field_choice_te xt node as "unescaped" xml
contents as:
<Choices>
<Choice choice_text="xx x"/>
<Choice field_choice_te xt="yyy"/>
<Choice field_choice_te xt="zzz"/>
</Choices>

and pass this contents to xsl template so I can apply the xslt to render
this as a dropdown list box
....
<option ...>xxx</option>
<option
Thanks

ILN
Nov 11 '05 #1
4 3725
I read the msxsl:node-set function can be used in .NET
from the sdk document
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpguide/html/cpconsupportfor msxslnode-
setfunction.asp

This might be the answer i am looking for =) I will give
it a try.

-----Original Message-----
Hi,
I have an XML document, created from ADO DataSet, which contains XML data insome nodes shown below:
<NewDataSet>
<Table>
<field_name> My Selection</field_name>
<field_type>dr opdown</field_type>
<field_choice_ text>
<Choices><Choic e choice_text=\"x xx\" /><Choice
choice_text=\" yyy\" /><Choice choice_text=\"z zz\"
/></Choices>
</field_choice_te xt>
<field_answe r>
xxx
</field_answer>
</Table>
</NewDataSet>

How can I get the value from field_choice_te xt node as "unescaped" xmlcontents as:
<Choices>
<Choice choice_text="xx x"/>
<Choice field_choice_te xt="yyy"/>
<Choice field_choice_te xt="zzz"/>
</Choices>

and pass this contents to xsl template so I can apply the xslt to renderthis as a dropdown list box
....
<option ...>xxx</option>
<option
Thanks

ILN
.

Nov 11 '05 #2
You may consider DOM as well. For example, we can select a "choice" node
and modify its attribute's innertext, to change field_choice_te xt node as
"unescaped" . And then perform the XSLT Transform.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 11 '05 #3
Invalidlastname wrote:
I read the msxsl:node-set function can be used in .NET
from the sdk document
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpguide/html/cpconsupportfor msxslnode-
setfunction.asp

This might be the answer i am looking for =) I will give
it a try.


Not really. Maximul msxsl:node-set function can do for you is to convert
escaped fragment as string into a single text node.
You have to parse escaped fragment as XML if you want to process it in
XSLT. As Luke pointed out DOM allows that easily via InnerXml property.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #4
Thank both of you for the helps. I replaced the InnerXML with InnerText of
that node in DOM and worked very well =)

ILN
"Oleg Tkachenko" <oleg@NO_SPAM_P LEASEtkachenko. com> wrote in message
news:#w******** *****@TK2MSFTNG P10.phx.gbl...
Invalidlastname wrote:
I read the msxsl:node-set function can be used in .NET
from the sdk document
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpguide/html/cpconsupportfor msxslnode-
setfunction.asp

This might be the answer i am looking for =) I will give
it a try.


Not really. Maximul msxsl:node-set function can do for you is to convert
escaped fragment as string into a single text node.
You have to parse escaped fragment as XML if you want to process it in
XSLT. As Luke pointed out DOM allows that easily via InnerXml property.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #5

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

Similar topics

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
14255
by: suzy | last post by:
i have a method which is return xml from a dataset. can someone please post some example code of how i can transform this xml using an xsl stylesheet? i am only interested in the c# part of the code, not the xsl. please note that my xml is coming from a method, not from a xml file. thanks.
4
2330
by: JoBean | last post by:
I think this is a simple Q but I cannot get the syntax right. I want to specify the node name and get its contents. I do not want to loop through and grab the contents of all child nodes - which the code below is doing fine. I want to replace the inner loop by specifying the node name (name, description) - Everything I try returns an obj ref error. Can someone please point me in the right direction? Many thanks - JoBean 'CODE BEHIND MY...
2
1188
by: K riley | last post by:
Hi. I am using the transform method to create an HTML file using an existing XML Document and an XLST. I need to use XPath to extract a node from my XML Document and my XLST document will format the node into something readable to my users. My code works, however, I will be having multiple users calling my routines at the same time. So I don't want to create a "hard" copy of my html file and place on my server. Because every time a...
4
1453
by: Web Team | last post by:
Hi All, I'm trying to update the contents of an XML node. My original code: Dim loXMLDoc As XmlDocument = New XmlDocument Dim loNode As XmlNode loXMLDoc.Load(HttpContext.Current.Server.MapPath(strXMLFileLocation)) loNode = loXMLDoc.SelectSingleNode("/Site/Content/TextArea" & textAreaID) loNode.InnerText = strContent
2
1570
by: bg | last post by:
Hi all, I need to get from an XmlNode the XML in an escaped form i.e. the angly bits as &lt; and &gt; And I also need to do the reverse, put escaped text back into an XMlNode, is this posible?
1
1756
by: the_dog_gabby | last post by:
Hello, I have a stylesheet that contains C# functions to generate XML. When I apply the stylesheet to my document, everything works perfectly except the data I get back is escaped like so: &lt;test&gt;this is a test&lt;/test&gt; I need to get <test>this is a test</testrather than the escaped data. Any input would be appreciated.
6
2658
by: Pete Verdon | last post by:
Summary: Can I do an XSLT transform, in the client, of a tree of nodes taken from the displayed page DOM in IE? This works in Firefox. Hi, I'm just starting the process of rewriting part of a "database frontend" type of intranet application. The existing table-display code consists of a mountain of very clever but extremely brittle spaghetti-javascript, which I'm planning to replace with XSLT transformations. At present I'm still...
12
10124
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b) ..... // xsl contents abc.aspx?p1=v1&amp;p2=<xsl:value-of select="$v2" />
0
9728
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10648
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
10389
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
10402
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
10135
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9205
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...
0
6890
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.