473,789 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 = newXMLTextReade r();
lblDescription. Text = reader.ReadStri ng() ; // 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 1268
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 = newXMLTextReade r();
lblDescription. Text = reader.ReadStri ng() ; // 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.co m>
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*******@disc ussions.microso ft.com> wrote in message
news:F7******** *************** ***********@mic rosoft.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 = newXMLTextReade r();
lblDescription. Text = reader.ReadStri ng() ; // 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.co m>
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
1828
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" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.0//EN" "TBD"> <html xmlns="http://www.w3.org/2002/06/xhtml2" xml:lang="en" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
82
5722
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 year later then the first version of XHTML 1.0, the second edition is actually newer. Furthermore, XHTML 1.1 is not really the follow-up of XHTML 1.0" I thought that XHTML 1.1 was the follow-up to XHTML 1.0 and that XHTML 2.0 will someday be the...
1
938
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 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 =...
12
2416
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
2597
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 in strict mode. What happened? Why the shift? What's the problem with XHTML that has everyone saying it be avoided in most cases? Can I take it that this group seems to think HTML5 is going to be the future direction of the web rather than...
11
3113
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 non-trivial exercise. inserting '&lt;' and '&gt;' causes the browser to write the text to the page as literal text rather than as the intended script element. Using escape codes seemed to work (makes it standard compliant) but the text is not written to...
30
2276
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 this in PHP: <?php echo '<?xml version="1.0" encoding="iso-8859-1"?>'; ?>
15
5408
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 xhtml1-strict DOCTYPE, I get a dead script and dozens of error messages like "Error in parsing value in property 'width'. Declaration dropped." on Line 0. This page doesn't work in Firefox but is valid xhtml:...
10
4281
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'); document.getElementsByTagName('body').appendChild(div); alert(div); alert(div.style) }, true);
0
9504
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10400
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
10190
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
10134
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
9977
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
9011
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
7523
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
6754
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();...
1
4084
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

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.