473,569 Members | 3,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlDocument.Loa d modifies files ?

Hello group,

Why, when I execute the c# code on the xhtml validate file, the program insert a
couple of hooks at the end of this line ?

....DTD/xhtml1-transitional.dt d"[]>

_The c# code :_

using System;
using System.Xml;

public class Sample
{
public static void Main()
{
XmlDocument doc = new XmlDocument();
doc.Load("test. htm");
doc.Save("test. htm");
System.Console. WriteLine(doc.O uterXml);
}
}
_The original and valid test.htm :_

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml"" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Codah Log File</title>
</head>
<body>
<table id="table_des_l ogs">
<tr>
<td>29/10/2004 10:17</td>
</tr>
</table>
</body>
</html>
_The modified test.htm :_

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d"[]>
<html xmlns="http://www.w3.org/1999/xhtml"" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Codah Log File</title>
</head>
<body>
<table id="table_des_l ogs">
<tr>
<td>29/10/2004 10:17</td>
</tr>
</table>
</body>
</html>

and then the xhtml file, is not valid any more. (dixit validator.w3.or g).
Even if i do a console output, without any save, the problem persist.So i accuse
the 'load' method.
Nov 12 '05 #1
1 2034
teddy311 wrote:
Why, when I execute the c# code on the xhtml validate file, the program insert a
couple of hooks at the end of this line ?

....DTD/xhtml1-transitional.dt d"[]>
Seems like it's a feature of the XmlDocument. But that's definitely not
a bug. XML syntax allows empty internal DTD subset ([] at the end) :

[28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('['
intSubset ']' S?)? '>'

[28b] intSubset ::= (markupdecl | DeclSep)*

and then the xhtml file, is not valid any more. (dixit validator.w3.or g).

Well, I can't reproduce it. validator.w3.or g says " The uploaded file
was checked and found to be valid XML. This means that the resource in
question identified itself as " XML" and that we successfully performed
a formal validation using an SGML or XML Parser (depending on the markup
language used)."

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

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

Similar topics

5
3592
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an instruction document (not data based) - same as using an xml web control. The resulting html is on the client? but what about the server side of...
2
12000
by: Manfred Braun | last post by:
Hi All, I am trying to access xml-files in the internet from my intranet-page. Making XmlDocument.Load() calls internally works fine, but not so to the internet. I think the calls are failing, because we use a proxy-server. Can I specify a specifix proxy in the call and/or in the configuration-files? For the configuration-files, I am not...
2
6830
by: Gustaf Liljegren | last post by:
I need to merge several XML files into one large. All of them has a DOCTYPE tag, but the SYSTEM identifier points to a DTD that doesn't exist. (I use the PUBLIC identifier with catalog files, so the SYSTEM identifiers has no purpose in my application.) Anyway, when I load each document, using XmlDocument.Load(file), I get a...
13
22911
by: Matthew Wieder | last post by:
In my C# application, I have class which has method that opens an XML document, modifies it and saves it out. I run that method for several different XML documents. What I've found is that the Load emthod on the MXLDocument isntance loads the document into memory (as it should) but I have no way of releaseing that memory throughout the...
2
6019
by: Graham Pengelly | last post by:
Hi I am trying to transform on System.Xml.XmlDocument into another using XslTransform without writing the object out to a file. I am guessing it should work something like this... public XmlDocument TransformXmlDoc(XmlDocument docToTransform, string xsltFilePath) { //load the xslt
5
10150
by: Rob Panosh | last post by:
Hello, I am trying to create a xmlDocument from as dataset. My code is listed below. All seems to go well until xmlDocument.Load(CType(ms, System.IO.Stream)) ... I keep getting the following error "The Root Element is Missing" ... any help would be appreciated. Thanks, Rob Panosh
0
2010
by: Ewan Fairweather | last post by:
Hi, I'm generating the below XML in c# for an asp.net application When i've generated this XML the <LaboratoryDetails xmlns=""> element has a blank xmlns set. How do i either a) remove this attribute or b) prevent it from happening in the first place. To generate the xml I've got two template files which i've included at the bottom...
1
2985
by: Ewan Fairweather | last post by:
Hi, I'm generating the below XML in c# for an asp.net application When i've generated this XML the <LaboratoryDetails xmlns=""> element has a blank xmlns set. How do i either a) remove this attribute or b) prevent it from happening in the first place. To generate the xml I've got two template files which i've included at the bottom...
4
1675
by: DanThMan | last post by:
The following code works when I debug and when I install the software and run the .exe, but if I try to open the form in the designer (which causes this code to run), I get an error: Private Sub LoadTestSettings() Dim rootPath As String Dim eventHandler As ValidationEventHandler rootPath = My.Application.Info.DirectoryPath eventHandler =...
0
7703
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
8138
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...
1
7681
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
7983
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
6290
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
3662
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...
1
2118
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
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.