473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

XHTML problematic, in xml used w/ .net

I have an xml file (that is updated through infopath), which populates
various .net controls.
One of the elements in my xml file contains XHTML tags: And the xml text
reader object that .NET provides, cannot read elements of an xml file that
contain xhtml. The reader does not return the text, if it contains a <td>
tag, or a <font> tag etc. Below is my pseudo code I use to get the
contents of the element.

XMLTextReader reader = newXMLTextReader();
lblDescription.Text = reader.ReadString() ; // the reader does not return
anything if it contains xhtml

Any ideas of what to do? I definately need that xhtml stuff in the xml
file... Otherwise the label will contain just a big runon sentence, instead
of formatted paragraphs.

ty
Jason Shohet
Nov 16 '05 #1
3 1253
Jason Shohet <__******@yahoo.com> wrote:
I have an xml file (that is updated through infopath), which populates
various .net controls.
One of the elements in my xml file contains XHTML tags: And the xml text
reader object that .NET provides, cannot read elements of an xml file that
contain xhtml. The reader does not return the text, if it contains a <td>
tag, or a <font> tag etc. Below is my pseudo code I use to get the
contents of the element.

XMLTextReader reader = newXMLTextReader();
lblDescription.Text = reader.ReadString() ; // the reader does not return
anything if it contains xhtml

Any ideas of what to do? I definately need that xhtml stuff in the xml
file... Otherwise the label will contain just a big runon sentence, instead
of formatted paragraphs.


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Daniel,

I agree style is better... Unfort. Microsoft is regressive. The actual
xhtml was produced by their 'new' infopath product.... which placed the
<font> tags in there hehehe.

How do I use CDATA?
"Daniel Jin" <Da*******@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
well, your xhtml tags will be treated like any other xml tags. you can wrap it inside a CDATA section to tell the parser not to parse the string as
xml.
on a side note, why are you using <font> with xhtml? it has long been considered deprecated. use style instead. :)
"Jason Shohet" wrote:
I have an xml file (that is updated through infopath), which populates
various .net controls.
One of the elements in my xml file contains XHTML tags: And the xml text reader object that .NET provides, cannot read elements of an xml file that contain xhtml. The reader does not return the text, if it contains a <td> tag, or a <font> tag etc. Below is my pseudo code I use to get the
contents of the element.

XMLTextReader reader = newXMLTextReader();
lblDescription.Text = reader.ReadString() ; // the reader does not return anything if it contains xhtml

Any ideas of what to do? I definately need that xhtml stuff in the xml
file... Otherwise the label will contain just a big runon sentence, instead of formatted paragraphs.

ty
Jason Shohet

Nov 16 '05 #3
Jason Shohet <__******@yahoo.com> wrote:
Attached are all the files you'll need to see the problem in action


Do you really have to use ASP.NET to demonstrate the problem? I don't
have it set up at the moment, and it would be *much* easier to test and
change the code if you had it in a simple console app.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4

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

Similar topics

6
by: Kerberos | last post by:
I am learning XHTML 2.0, and I have tried to validade the example of XHTML 2.0 page given on the W3C eBook, but it reports errors :'( Here's the code: <?xml version="1.0" encoding="UTF-8" ?>...
82
by: Buford Early | last post by:
I read this in http://annevankesteren.nl/2004/12/xhtml-notes "A common misconception is that XHTML 1.1 is the latest version of the XHTML series. And although it was released a bit more than a...
1
by: Jason Shohet | last post by:
I have an xml file (that is updated through infopath), which populates various .net controls. One of the elements in my xml file contains XHTML tags: And the xml text reader object that .NET...
12
by: Alex D. | last post by:
How can I stop asp.net from rendering XHTML istead of HTML? My javascripts are rendering wrong because of that. It is rendering &amp; to clients instead of &. Any help? Thanks, Alejandro.
28
by: Timothy Larson | last post by:
A couple years ago it seemed like XHTML was the direction of most web markup, a foregone conclusion. Now I return to the scene and I see many here recommending that authors stick to HTML, albeit...
11
by: Michael Powe | last post by:
How can I make an XHTML-compliant form of an expression in this format: document.write("<scr"+"ipt type='text/javascript' src='path/to/file.js'>"+"</scr"+"ipt>"); this turns out to be a...
30
by: abracad_1999 | last post by:
Is it possible to serve valid xhtml with php? xhtml requires the 1st line: <?xml version="1.0" encoding="iso-8859-1"?> But php interprets the opening <? as a php statement. If I try to echo...
15
by: Lennart | last post by:
Hi folks, I have created an animated image gallery in dhtml. It works fine in Internet Explorer. In Firefox, it only works if I ommit the DOCTYPE tag. The page is valid xhtml-strict but with a...
10
by: webEater | last post by:
Hello, I try the following in Firefox and other modern browsers: window.addEventListener('load', function() { document.title = CSS.getClass('fontSize'); var div = document.createElement('div');...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...

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.