473,387 Members | 1,859 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.

System.Xml.XmlDocument with (x)html entities

Hello all,

I'm having a bit of a problem with System.Xml.XmlDocument. The scenario
is as follows:

I receive a dataset containing some data fetched from database. I can
retrieve a string containing the data with Dataset.GetXml method.
Inside the xml document, in a datatable field, I have an xhtml document
that may contain xhtml entities (for example   or '). When I
do a XmlDocument.LoadXml, these xhtml entities crash the LoadXml
method.

I've tried looking into the XmlResolver class, but haven't found a way
to get it to work with XmlDocument. Anyone?
TIA,

Sdr

Aug 20 '06 #1
3 3929
pe*******@gmail.com wrote:
I'm having a bit of a problem with System.Xml.XmlDocument. The scenario
is as follows:

I receive a dataset containing some data fetched from database. I can
retrieve a string containing the data with Dataset.GetXml method.
Inside the xml document, in a datatable field, I have an xhtml document
that may contain xhtml entities (for example   or '). When I
do a XmlDocument.LoadXml, these xhtml entities crash the LoadXml
method.
You can make your XML well-formed by adding a DOCTYPE to (X)HTML DTD
containing entity definitions -
http://www.w3.org/TR/xhtml-modulariz...acter_Entities

--
Oleg Tkachenko [XML MVP, MCPD]
http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net
Aug 21 '06 #2
Thanks for your answer Oleg,

this will not solve my problem. Due to a number of reasons, and can't
add doctype definitions to the actual xml document. I receive a
System.Data.DataSet from DAL layer, and have to take this for granted.
I suppose the actual question here is how to do the exact same thing
programatically.

Sdr

Aug 21 '06 #3

Hello all,

I managed to find a solution. I found a good code example at Scott
Willeke's blog
(http://blogs.pingpoet.com/overflow/a...05/07/20.aspx). Looking
at the solution, no wonder I couldn't figure this one out right away.
Scott, if you're reading this, keep up the good work.

Sdr

Aug 21 '06 #4

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

Similar topics

0
by: Nick Kew | last post by:
Rationale ========= Many applications today benefit from an SGML and/or XML Entity Catalogue to dereference entities referenced by a Public Identifier. For a validating SGML parser this is an...
7
by: Microsoft News | last post by:
Hi all. Does id() xpath function work in System.XML? I have built dtd, schema, xdr for a simple xml which includes attributes definded as ID and IDREFS. Validation is occurring properly for all...
1
by: Martin Honnen | last post by:
With both .NET 1.0 and 1.1 I have found the following strange behaviour where System.Xml.XmlDocument.LoadXml doesn't throw an error when parsing a text node with a character reference to an invalid...
3
by: awong | last post by:
Hi there, I was trying to convert the following VB6 code to VB.NET. But I can't find a corresponding System.XML object for MSXML IXMLDOMSelection. I am thinking to use System.XML XMLNodeList...
1
by: AJ Brown | last post by:
I'm loading an XmlDocument object from a string using LoadXml. The string is a well-formed XML fragment (see example) and loads fine, however there are entities (&) within attribute values. The...
5
by: Ben R. | last post by:
Hi, Could someone explain the functional difference between these classes? From what I understand, xpathdocument is faster in some scenarios, but I'm not sure why. Further, why is it that the...
1
by: st | last post by:
Hi, I'm using xmlDocument.Save(xmlTextWriter) to create an Excel-readable file. All works well, except where I've replaced the carriage return chars in the .innertext to XML-compliant " "; It...
0
by: Dan | last post by:
I have built an XSLT extension C# class where a function receives as input a text and transforms some of its charcodes into entities, e.g. A with acute accent becomes Á and so forth. The...
14
by: jens Jensen | last post by:
Hello, I'm calling a webmethod from a webservice written in java. I need to pass an xml file as parameter to the webmethod. I therefore use System.Xml.XmlDocument to load the xml file. The...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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.