473,772 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WriteXML encoding strings ! Please help

Hi Guru's,

Going crazy with this problem!

I fill a dataset in asp.net with a 'FOR XML AUTO' query and Output it
back to the browser.
DS.WriteXml(Res ponse.OutputStr eam, XmlWriteMode.Ig noreSchema)


No matter what I do I get the first nodes "<" encoded as "&lt;" This
means that the script that I am using can't recognise the first node.
I would replace the characters but then the output is no longer
recognised as XML.

Why is this behaviour implemented? I basically end with this

<Tables>
<XML_F52E2B61-18A1-11d1-B105-00805F49916B>&l t;row tID="1" tNo="11"
tLeft="123" tTop="432"/&gt;</XML_F52E2B61-18A1-11d1-B105-00805F49916B>
</Tables>

Please assist urgent!

Thanks
sorCrer
Nov 12 '05 #1
2 3733
sorCrer wrote:
I fill a dataset in asp.net with a 'FOR XML AUTO' query and Output it
back to the browser.

DS.WriteXml(R esponse.OutputS tream, XmlWriteMode.Ig noreSchema)

No matter what I do I get the first nodes "<" encoded as "&lt;" This
means that the script that I am using can't recognise the first node.

Why is this behaviour implemented?
In XML < characters in text and attribute values must be escaped.
I basically end with this

<Tables>
<XML_F52E2B61-18A1-11d1-B105-00805F49916B>&l t;row tID="1" tNo="11"
tLeft="123" tTop="432"/&gt;</XML_F52E2B61-18A1-11d1-B105-00805F49916B>
</Tables>


What's you start with?
Looks like you start with embedded XML as a character data? That's the
problem - you've got it as text and so DataSet writes it as text,
escaping < and &.
So the solution is either to change the way you store it or disable
escaping (e.g. using XSLT or custom XmlWriter).

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2
Hi SorCrer

How are you getting the XML back from your query?

You need to use the ExecuteXmlReade r method on your SqlCommand object...

This works OK for me...

Dim conn As New System.Data.Sql Client.SqlConne ction("connStri ng")
Dim comm As New System.Data.Sql Client.SqlComma nd("SELECT * FROM
Table FOR XML AUTO", conn)
conn.Open()
Dim r As System.Xml.XmlR eader = comm.ExecuteXml Reader()
Dim ds As New DataSet
ds.ReadXml(r)
r.close()
conn.Close()
MessageBox.Show (ds.GetXml())

Let me know if you need more help

Nigel Armstrong

"sorCrer" wrote:
Hi Guru's,

Going crazy with this problem!

I fill a dataset in asp.net with a 'FOR XML AUTO' query and Output it
back to the browser.
DS.WriteXml(Res ponse.OutputStr eam, XmlWriteMode.Ig noreSchema)


No matter what I do I get the first nodes "<" encoded as "<" This
means that the script that I am using can't recognise the first node.
I would replace the characters but then the output is no longer
recognised as XML.

Why is this behaviour implemented? I basically end with this

<Tables>
<XML_F52E2B61-18A1-11d1-B105-00805F49916B><r ow tID="1" tNo="11"
tLeft="123" tTop="432"/></XML_F52E2B61-18A1-11d1-B105-00805F49916B>
</Tables>

Please assist urgent!

Thanks
sorCrer

Nov 12 '05 #3

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

Similar topics

3
2318
by: Pekka Niiranen | last post by:
Hi, Probing my system from Python 2.3.4 gives >>> import locale, sys >>> locale.getdefaultlocale() ('fi_FI', 'cp1252') >>> locale.getpreferredencoding() 'cp1252' >>> sys.getdefaultencoding()
0
1884
by: johkar | last post by:
My XML and XSL is below. Also below is a textual representation of what I want to get out of the XML with XSL. For each Extension node in XML, I am only concerned with those nodes with fieldTypeCodes of 10 - 17. For any given query there will be up to 4 Extension nodes fitting this criteria. I have everything working except for being able to insert a, b, c or d in the <box12 tags. Notice each row or found node has a different letter. ...
1
2025
by: news.hunterlink.net.au | last post by:
(* note the escaped ampersand and the character reference have extra spaces to avoid being converted when viewed) I have a job that requires the following <ThisElement>Here is some text & a m p ; here is a & # x E 2 ; character</ThisElement> to end up as
7
2392
by: Alan Bashy | last post by:
Please, guys, In need help with this. It is due in the next week. Please, help me to implement the functions in this programm especially the first three constructor. I need them guys. Please, help me. This was inspired by Exercise 7 and Programming Problem 8 in Chapter 3 of our text. I have done Exercise 7 for you: Below you will find the ADT specification for a string of characters. It represents slightly more that a minimal string...
22
2775
by: stoppal | last post by:
need to extract all text between the following strings, but not include the strings. "<!-- #BeginEditable "Title name" -->" "<p align="center">#### </p>" I am using preg_match(????, $s, $results)
2
938
by: Michael Barrido | last post by:
Greetings! I have a project that needs to access a web service. My problem is this web service is provided via CGI. I cannot do a "Web Reference" to it to add in my dotnet project. I'm planning to use instead the System.Net.WebClient to HTTP POST to this Web Service so I can retrieve any return values from it. The code bellow is what the CGI web service expect to receive from my end. How do I "HTTP POST" this to...
4
3588
by: Jcs_5920 | last post by:
Hello All, I was reading some of the posts trying to learn about date coding schemes used in old DOS programs with no luck, so I though I'd ask the group for help. These are the HEX values and corresponding dates I am using. If anyone can help me figure out the encode / decode method I would really appreciate it. Date only, no time stored. 9C07 0B00 = 01-15-80 9D07 0B00 = 01-16-80 BB07 0B00 = 02-15-80
2
1435
by: varusnyc | last post by:
Hello, I just started learning strings and dont even know how to properly execute simple part of the program that splits phrase of two words with one space in between into 2 separate strings. I realize that substr() need to be used, but words may varie in length so I have to make it initialize first string any length before first space and second string after the space. For example: "computer science" into first string "computer" second...
0
9621
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
10106
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...
0
9914
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
8937
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
7461
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
6716
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
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
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
3610
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.