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>My Selection</field_name>
<field_type>dropdown</field_type>
<field_choice_text>
    &lt;Choices&gt;&lt;Choice choice_text=\"xxx\" /&gt;&lt;Choice
choice_text=\"yyy\" /&gt;&lt;Choice choice_text=\"zzz\"
/&gt;&lt;/Choices&gt;
</field_choice_text>
<field_answer>
xxx
</field_answer>
</Table>
</NewDataSet>

How can I get the value from field_choice_text node as "unescaped" xml
contents as:
<Choices>
    <Choice choice_text="xxx"/>
    <Choice field_choice_text="yyy"/>
    <Choice field_choice_text="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


0
10/13/2003 10:20:33 PM
dotnet.xml 7266 articles. 0 followers. Follow

4 Replies
645 Views

Similar Articles

[PageSpeed] 40

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/cpconsupportformsxslnode-
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 in
>some nodes shown below:
>
>
><NewDataSet>
><Table>
><field_name>My Selection</field_name>
><field_type>dropdown</field_type>
><field_choice_text>
>    <Choices><Choice choice_text=\"xxx\" /><Choice
>choice_text=\"yyy\" /><Choice choice_text=\"zzz\"
>/></Choices>
></field_choice_text>
><field_answer>
>xxx
></field_answer>
></Table>
></NewDataSet>
>
>How can I get the value from field_choice_text node 
as "unescaped" xml
>contents as:
><Choices>
>    <Choice choice_text="xxx"/>
>    <Choice field_choice_text="yyy"/>
>    <Choice field_choice_text="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
>
>
>.
>
0
10/14/2003 1:37:15 AM
You may consider DOM as well. For example, we can select a "choice" node 
and modify its attribute's innertext, to  change field_choice_text 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.)

0
lukezhan (72)
10/14/2003 6:30:50 AM
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/cpconsupportformsxslnode-
> 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

0
oleg7603 (294)
10/14/2003 8:46:47 AM
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_PLEASEtkachenko.com> wrote in message
news:#wvu0#ikDHA.688@TK2MSFTNGP10.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/cpconsupportformsxslnode-
> > 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
>


0
10/14/2003 2:17:55 PM
Reply:

Similar Artilces:

xml schema to dataset to xml
Hi, I am trying to write a function that takes an xml schema and generates a dataset. I then write data into the dataset and generate xml from it. I then go to validate the xml that was generated against the original schema and the validation fails. Ive found that this is because the order of the sequence in my complex types is no longer the same. Does anyone know of a way to generate xml that will validate against the schema? ...

HELP? Having some problems with XML Serialization...
Hi, I seem to be having a bit of a problem serializing a complex object into XML. I've done this many times with simpler objects and it's always worked just fine. The error I'm getting is the natorious "File or assembly name [asciijunk].dll, or one of its dependencies was not found. I have turned on XML Serialization debugging int the web.config file, so I have all of the output generated by the serializer. When I examine the .out file generated there, I have the following: ================================================== c:\Documents and Settings\DEV100\ASPNET\L...

Can a formula be "built" referencing text content from another cel
Hi, and thank you for your help. I have run across this need many times...is there any way to use to contents of one cell, to construct a formula in another cell? Here is my particular requirement. I have worksheets named January, February, March...etc. On a separate Summary Worksheet, I reference the same cells on each of those sheets. For example, I may have in 3 adjacent cells, =January!A1 =February!A1 =March!A1 and then in the next row: =January!A7 =February!A7 =March!A7 etc. It would, obviously, be much easier to "build a f...

Splitting cell contents into 2 cells
If a cell contains a set of numbers separated by a hyphen (eg, 1234-5678, can the contents be splitted up into 2 cells without the hyphen (ie, 1234 in 1 cell and 5678 in another cell)? You can either do the simple: Data - Text to columns, delimited by hypen Or, you could try and do: =VALUE(LEFT(A2,FIND("-",A2)-1)) in one cells and =VALUE(MID(A2,FIND("-",A2)+1,999)) in the other. -- Best Regards, Luke M "Florence Tay" <Florence Tay@discussions.microsoft.com> wrote in message news:CAAD53DB-68CD-4B7D-A46D-805E5EEA59D4@microsoft.com... ...

transform data in excel
I need to transform data in an excel srpeadsheet. I need to reverse a 5 rows, 200 columns table into a 5 columns, 200 rows table. Much appreciated!Vincent Hi Vincent Copy the set of data. Got to your destination and choose Paste Special and click the box marked Transpose. -- Regards Roger Govier "Vincent Yang" <vyang69@verizon.net> wrote in message news:MVORb.1866$px6.279@nwrddc02.gnilink.net... > I need to transform data in an excel srpeadsheet. I need to reverse a > 5 rows, 200 columns table into a 5 columns, 200 rows table. > > Much appreciated!Vincent >...

Remove Dataset name as ROOT of XML
Hi, I am generating deeply nested XML document from a Dataset using ' Write to the file with the WriteXml method. DataSet21.WriteXml(myXmlWriter) The generated XML contains the <DataSet2> node as a root node (see below) is there a way to get rid of it? I ned the <Header> node to be a Root node. All info is generated from database. Thanks LoF <DataSet2> <Header> <WONo>2308100</WONo> <EDDID>SEDD</EDDID> .... create an XmlDataDocument from the DataSet http://msdn.microsoft.com/library/en-us/cpref/html/frl...

Simple Xml Validation with strings
Hello, I have two strings; string XmlFragment; //contains the xml document string XsdSchema; //contains the xsd schema I would like to validate the XmlFragment against the XsdSchema. What is a clean, simple way for accomplishing this? Bye, Ward Try something like this: 1) Load your XsdSchema into a StreamReader MemoryStream ms = new MemoryStream((new Text.ASCIIEncoding()).GetBytes(XsdSchema)); StreamReader schemaReader = new StreamReader(ms); 2) Validate your XmlFragment on the StreamReader XmlTextReader xmlReader = new XmlTextReader(new System.IO.StringReader(XmlFragment)); X...

Comparing a value in EXCEL and XML files
want to know how to write a code in VB.NET for the following situation > I have a field( Ex. Capital) in my XML file and that field results in a value(Ex. $5000)....now i have my Excel file with multiple worksheets in it....I want to write a code that can read a single field (Ex. Capital) in XML file and then take it's value (Ex.$5000).....After reading the $5000 it should search through my entire Excel file( In all Worksheets) and see if that Value exists ....If it exists then return as "Pass" if not "Fail".....I also hav 1 more condition but first i would like to...

How to XslTransform.Transform to new web page from code behind?
I'm working with a typed dataset and want to implement a print button that prints my formatted data without the company logo and other stuff on the form. I've created an XSLT file to transform the XML version of the dataset into HTML and would like to display it in a new browser window leaving the original window up and/or maybe even just send it out to the default printer or bring up the print dialog for printing out the web page. I have successfully saved the html file, but I'm not sure how to send to a new browser window instead of a file. Please help, code below: XmlData...

XSL Transform Problem using Xml.XSL.Transform
I have an interesting problem. I am performing an XSL transform using the System.Xml.Xsl.Transform class. I have a database that contains the XSL style sheet string. And it seems to work pretty well for simple transforms. But as soon as I add Xsl variables or For each loops to the XSL string in the db, it fails to transform the XML. I can see that it will transform everything until that point. ALso If I copy the XSL & XML I am trying to transform from my watch window into a file.. It works perfectly. Any Ideas? The following is the C# code I am using to transform & the XSL I a...

Xml space and ms-data interpretation different in VS2005
I have a problem converting a program from Vb.net VS2003 to VS2005. I process a xml-file with an inline schema. In 2003 no problem. In 2005 I have 2 problems: 1) BIG space="preserve" problem. Suddenly the spaces are a problem during processing (The following text is not allowed in this context: ' '). Without the space="preserve" (or default) it works okay, but what to do now since I can't influence the dataformat. 2) SMALLER xml-msdata/IsDataSet problem. As long as there is a reference to the xml-msdata namespace in the file the VS2005 designers can't cor...

How do I get the XmlSchema from an xml file
Hi; If an xml file has this at the top: <?xml version="1.0"?> <purchaseOrder orderDate="1999-10-20" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="c:/test/po.xsd"> I need to get the XmlSchema for c:/test/po.xsd. I only need it for noNamespaceSchemaLocation and I do not need to process the XML file itself, I just need the schema. I tried: XmlSchema schema = null; XmlDocument doc = new XmlDocument(); doc.Load(datasource.Url); foreach (XmlSchema xsi in doc.Schemas.Schemas()) if (xsi.Namespaces.Cou...

rss feed : escaped invalid xml chars display incorrectly in browser
I am using StringBuilder to build a string containing xml that is Response.Write() to the browser as an rss feed. To replace invalide xml chars, I am using code fragments such as xmlDocument.Append("<description>"); xmlDocument.Append(SecurityElement.Escape(productDescription)); xmlDocument.Append("</description>"); The xml string I generate does validate as a valid rss feed at http://validator.w3.org/feed/check.cgi However, when displayed in the browser, the escaped chars are not translated back to their original chars, so I get displayed text such as : ...

XML parsee
Hi All I am very new to XML ... i have an xml file how do i parse it.. Its has a very simple structure : I need to get the output in the following for/m: For all records: Get the fieldname, Then check the Filetype if input then ignore if derived then retrieve the file name if constant then get the constant value. please help me out i need to parse this asap Expectin a quick reply.. i need a optimized one as this records in the xml will be hugs.. Thanks a lot Regards Hemlata Fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Cour...

Transform table into calendar format
I have a table with dates (column A) and events (column B). I wanted to know how I automatically create a calendar template with the events I have on this separate sheet. Send me an email to: pashurst <at> auditel.net (change the obvious), and I'll send you a file that does just what you describe. Hope this helps. Pete On Nov 18, 9:55=A0pm, Matheus <Math...@discussions.microsoft.com> wrote: > I have a table with dates (column A) and events (column B). I wanted to k= now > how I automatically create a calendar template with the events I have on = ...

Macro to Clear Cell Contents based on Cell Value in another Sheet
Sorry for the Newbie question but....... How do I create a macro to clear the contents of cells in one worksheet based on the value of a cell in another worksheet? For example: on SHEET 1 the value of cell A1 can be Yes or No. If A1 = "Yes" then I want to clear the values in cell range A1:C5 of SHEET 2, if "No" then don't clear the values. Thanks in advance. Option Explicit sub testme() dim rng1 as range dim rng2 as range set rng1 = worksheets("sheet1").range("a1") set rng2 = worksheets("sheet2").range("a1:c5") ...

Seven Transformation
My son in his infinite wisdom downloaded something called Windows 7 transformation to my XP computer. Now I can't remove it. When I run "remove Seven Transformation Pack" it instantly gives me an error. This happens whether I run it from Control Panel or otherwise. Help! How can I get rid of this? Jpstewar wrote: > My son in his infinite wisdom downloaded something called Windows 7 > transformation to my XP computer. Now I can't remove it. When I run > "remove Seven Transformation Pack" it instantly gives me an error. > This happens whether...

printer escape sequence
When sending a print job to a printer, how does one send an "escape sequence", to access the fonts installed on the printer itself? Jim Madsen wrote: > When sending a print job to a printer, how does one send an "escape > sequence", to access the fonts installed on the printer itself? Embed the proper escape sequence characters in a string and PRINT should do it... -- dpb wrote: > Jim Madsen wrote: >> When sending a print job to a printer, how does one send an "escape >> sequence", to access the fonts installed on the prin...

parse string with xml contents
Hi I have a string with the following contents: "<TR align=right ID=G><TD align=left><A HREF="/comun/fichaemp/fichavalor.asp?isin=ES0111845014"><IMG SRC="/images/arr-up9.gif" BORDER=0> ABERTIS SE.A</A></TD><TD>19,96</TD><TD ID=V>0,15</TD><TD>19,96</TD><TD>19,83</TD><TD>1.060.525</TD><TD>21.115,00</TD><TD align=center>27/06/2005</TD><TD align=center>17:35</TD></TR>" What would be the simplest way to parse it, and keep only &qu...

drop down selection determines other drop down content
I'd like to set up dropdown lists in which their content (list) is determined from a selection of another dropdown. Example: If you select 'project1' from columnA's dropdown list, columnB's dropdown list content will feature task1, task2, & task3. While if you select 'project2' from columnA's dropdown list, columnB's dropdown list content will feature task4, task5, & task6. I've tried using VLOOKUP to accomplish this task with no success; any advice will be greatly appreciated. See http://www.xldynamic.com/source/xld.Dropdowns.html a...

Using XML with ASP.NET
I want to know where can I find Tutorials/Articles to learn implementing XML with asp.net. I am working on ASP.NET using C# from last one month. I have idea about XML but had not implemented yet with ASP.NET. Thanks in advance. Thanks Vinod Jajoo ...

How do I extract text content from an exported .rwz file
Outlook 2003, Office Pro - When you export Rules and create a .rwz file, the file is not a pure text file as it seems to be loaded with null chars. I would like to extract the long list of spam words used in a particular rule. Is there a way or a utility which will remove all the nulls from the file so I may edit it to get the contents I want ? The alternative storage location is not any easier - trying to get the same info, as it is similarly stored, out of the registry. :( -Ric Not possible. -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -Backup and R...

XSL Transform by DataType
Hello, I am trying to find a way to format an XML attribute using XSL. I want to run the format based on the datatype of the attribute. I need to remove everything from the "-" in a attribute that is defined as a datetime. I cannot go by the actual attribute name I need to process based on data type. Any assistance would be greatly appreciated. <s:Schema id="RowsetSchema"> <s:ElementType name="row" content="eltOnly" rs:updatable="true"> ... more attributes just not showing them all... <s:AttributeType nam...

How do I escape single tick marks in XPath Queries?
I keep getting an error when I have a tick mark in a text value that I am searching for in my XPath Query. Example: <Authors> <Author LastName="O'Donnel"> <Author LastName="Smith"> </Authors> If I try to do a SelectNodes(Authors/Author[@LastName='O'Donnel']) I get an exception "has an invalid token". If I change it to SelectNodes(Author/Author[@LastName="O'Donnel"]) that works fine (and would seem reasonable since you can't have a " in your XML legally), but I'd rather escape the tick ...

XML Signature with X509 Certificate
Hi all Can Anyone tell me if it is possible to load X509 certificate which is attached to Signed XML doc. I want veryfy signature and if it is OK i want to display certificate(s). So I have to get it from KeyInfo object and load to KeyInfoX509Data, correct? I can not manage it I try to do it in VB.NET Muzzy ...