473,554 Members | 5,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Xml.XmlD ocument with (x)html entities

Hello all,

I'm having a bit of a problem with System.Xml.XmlD ocument. 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.Loa dXml, 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 3949
pe*******@gmail .com wrote:
I'm having a bit of a problem with System.Xml.XmlD ocument. 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.Loa dXml, 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.Dat aSet 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
1866
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 absolute requirement. For any SGML or XML parser it serves to enable entities such as DTDs and modules to be resolved locally. Hitherto,...
7
4232
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 the types of metadata, but the id() function applied to the IDREFS attribute allways returns nothing. I have tried it from xslt and using the...
1
17111
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 characters like . Using the CreateTextNode method I create a text node containing "\u0001a" (C# string literal notation). As far as I...
3
4861
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 object and GetElementsByTagName method to find the "selection". Any suggestion/comment? Thanks in advance.
1
3023
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 loader parses the incoming entities and converts them to their character references automatically. How would I retain the entity? Example incoming...
5
5778
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 method of getting xml data into these two classes differs? (xmldocument uses the load method, whereas xpathdocument doesn't have this available and...
1
3940
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 gets changed to "&#10" and doesn't render new lines in the Excel sheet. Can anyone help? Many thanks,
0
1326
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 &Aacute; and so forth. The function must return a nodeset including the transformed text whithin some newly created tags: e.g. the text "a dummy text" becomes <someTag>...
14
2717
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 call works when i construct a string representation of the content of the xml and then, use the "loadxml" method to of Xml.XmlDocument . But it...
0
7581
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...
0
7782
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. ...
1
7541
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...
0
7872
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...
0
6123
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...
0
5142
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...
0
3545
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3533
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1114
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.