473,699 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlDocument.Loa d(file) without entity resolving?

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.Loa d(file), I get a
FileNotFoundExc eption, because of the DTD pointer in the SYSTEM identifier.
I'd rather skip all the entity resolving and just read the well-formed XML.
Is there a simple way to do this?

Here's the code, in C#:

// Make a DOM Document of the included file
XmlDocument d = new XmlDocument();
d.Load(file);

// Import the node
XmlNode n = xmlDoc.ImportNo de(d.DocumentEl ement, true);
xmlDoc.Document Element.AppendC hild(n);

Thanks,

Gustaf
Nov 12 '05 #1
2 6840
Gustaf Liljegren wrote:
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.Loa d(file), I get a
FileNotFoundExc eption, because of the DTD pointer in the SYSTEM identifier.
I'd rather skip all the entity resolving and just read the well-formed XML.
Is there a simple way to do this?

Here's the code, in C#:

// Make a DOM Document of the included file
XmlDocument d = new XmlDocument();


Try
d.XmlResolver = null;

PS. You may want take a look at XInclude when it comes to combining XML
docs.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #2
Oleg Tkachenko <oleg@NO!SPAM!P LEASEtkachenko. com> wrote:
d.XmlResolver = null;
Yes! Thank you!
PS. You may want take a look at XInclude when it comes to combining
XML docs.


It's XInclude I'm trying to implement. Maybe I should stop wasting time and
look for a finished implementation, but it's fun. :o)

Gustaf
Nov 12 '05 #3

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

Similar topics

2
568
by: Eric Falsken | last post by:
Eric Falsken <eric@db4o.com> wrote on 04 Dec 2005: > craigkenisston@hotmail.com wrote on 19 Nov 2005: > >> I'm working in the migration of an asp.net application in 1.1 to 2.0. >> I'm new to this application, just worked with that some days. >> Today, I decided to open the project in VS.2005 and everything seemed >> to be fine, all opened and everything was migrated. I have been >> working on improvements on it this day. >>
1
10793
by: urs | last post by:
Two days ago, I built an ASP.NET 2.0 application and published it on a shared IIS 6 Web server. After publishing, and during the whole day, it worked fine. The server remained untouched since. Today, I wanted to access the home page of the application again with a browser. But instead of the proper page, I just got an ugly message: Server Error in '/' Application.
1
3563
by: ddelaney | last post by:
I've seen this posted before in many places, but have yet to find a real fix. I have a web application on dev server right now, and randomly, hours or days, it returns the expception posted below. If I copy the incHeader.ascx.vb over to the server again, it appears to recompile and works fine, again, for random period of times. Even precompiling is no help. Is there a fix or workaround so this can some stability? Any help at all is...
4
2742
by: CPD | last post by:
From PHP, doing a DROP TABLE and a CREATE TABLE is successful, but doing a LOAD FILE keeps failing, with the error "Access denied for user 'db_user'@'localhost' (using password: YES)". The DROP/CREATE code and the LOAD FILE code are in separate .php files which I am running from my browser, but both commands are executed with mysql_query(). Don't know what I'm doing wrong, so I would appreciate any help with this. Both files run the...
2
11104
by: semedao | last post by:
Hi All, I developed Outlook add-in with VS 2005 , everything work fine , until the machine reboot unnormally , when I opened the solution again many projects was not there ! (I have more then 10 project that depends each other). I add them again , also add the primary output again to the setup project.
4
3979
by: Richard Bysouth | last post by:
Hi I am running a site built on asp.net 1.1 on a windows server 2003 (which is running asp.net 2.0 - shared hosting at my webhost). The site is low traffic and very simple (mostly static text apart from a couple of usercontrols that pull info from a sql db). The problem I'm getting is that it will run fine for a few days, then suddenly the following error will occur: --------------------------------------------------
2
2597
by: John Bailey | last post by:
I have checked around and could not find anything here that exactly matches my issue, which is odd since I have found numerous posts on this in other news groups. I have a ASP .Net 2.0 site that is distributed as code (the pages are not precompiled, but code behind is used). From time to time I get the following error: Could not load file or assembly 'App_Web_u2h48fgb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its...
2
151650
by: antonyliu2002 | last post by:
I am testing AJAX. I've downloaded the AJAX Extension and the CTP December package and installed on BOTH my development machine and the production server. Then I created a very very simple web application, which contains a button and a label. When the button is clicked, some message is shown on the label. That's it. The AJAX works great on my development machine, but on the production server, I got the typical error as follows:
1
8331
by: Steve Wofford | last post by:
I am recieving the following. This happens when I moved it from my development system to our production SBS 2003 w/ latest .net frameworks and service packs . I developed under XPSP2 and VS2008. The error is pointing to the Web.Config of my application. System.Data.Entity was missing from the server, but was on the dev system. I tried to add, but didnt help: C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5
0
8689
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9178
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
9035
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...
0
8885
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
7752
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
6534
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...
1
3058
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
2
2348
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2010
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.