473,388 Members | 1,496 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,388 software developers and data experts.

Creating a document type in C#

I'm trying to programmatically create a document type using the
CreateDocumentType method of XmlDocument.

The document type declaration is:
<!DOCTYPE procedure PUBLIC
"-//LMSSC//DTD XML//CAEWriter Minimal Revisable Units 2.0.2//Vulcan//EN"
"vulcan-cae.dtd">

Using the method generates an error with the second parameter.
CreateDocumentType("project",
"-//LMSSC//DTD XML//CAEWriter Minimal Revisable Units 2.0.2//Vulcan//EN"
null,
"vulcan-cae.dtd">

I"ve tried various combinations, but can't generate the desired output.
Including "-//LMSSC//DTD XML//CAEWriter Minimal Revisable Units
2.0.2//Vulcan//EN" always generates an error.

Any pointers?
Scott
Mar 7 '06 #1
3 6747


scottl wrote:

The document type declaration is:
<!DOCTYPE procedure PUBLIC
"-//LMSSC//DTD XML//CAEWriter Minimal Revisable Units 2.0.2//Vulcan//EN"
"vulcan-cae.dtd">


You need e.g. C# (with no line break inside of the string literals)

XmlDocument xmlDocument = new XmlDocument();
XmlDocumentType documentTypeDeclaration =
xmlDocument.CreateDocumentType(
"procedure",
"-//LMSSC//DTD XML//CAEWriter Minimal Revisable Units 2.0.2//Vulcan//EN",
"vulcan-cae.dtd",
null
);

Note that the system id (e.g. vulcan-cae.dtd) needs to point to an
existing file.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Mar 7 '06 #2
Thanks, however the error isn't on the system parameter, which was a typo by
the way. That should have been the fourth parameter.

The error I get when running the following variant is:
CreateDocumentType("procedure", "-//LMSSC//DTD XML//CAEWriter Minimal
Revisable Units 2.0.2//Vulcan//EN", null,null);

An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll
Additional information: The path is not of a legal form.

This text works fine when loading the document with the declaration
pre-existing in the document. Now I'm trying to build the document.

Scott

"Martin Honnen" wrote:


scottl wrote:

The document type declaration is:
<!DOCTYPE procedure PUBLIC
"-//LMSSC//DTD XML//CAEWriter Minimal Revisable Units 2.0.2//Vulcan//EN"
"vulcan-cae.dtd">


You need e.g. C# (with no line break inside of the string literals)

XmlDocument xmlDocument = new XmlDocument();
XmlDocumentType documentTypeDeclaration =
xmlDocument.CreateDocumentType(
"procedure",
"-//LMSSC//DTD XML//CAEWriter Minimal Revisable Units 2.0.2//Vulcan//EN",
"vulcan-cae.dtd",
null
);

Note that the system id (e.g. vulcan-cae.dtd) needs to point to an
existing file.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Mar 7 '06 #3


scottl wrote:

The error I get when running the following variant is:
CreateDocumentType("procedure", "-//LMSSC//DTD XML//CAEWriter Minimal
Revisable Units 2.0.2//Vulcan//EN", null,null);

An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll
Additional information: The path is not of a legal form.


Hmm, I see that error here with .NET 1.1. When I compile and run with
..NET 2.0 I don't get any error.
I am not sure there is anything wrong with that public id, it rather
looks like you have hit a bug with CreateDocumentType in .NET 1.1.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Mar 7 '06 #4

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

Similar topics

20
by: svend | last post by:
I'm messing with some code here... Lets say I have this array: a1 = ; And I apply slice(0) on it, to create a copy: a2 = a1.slice(0); But this isn't a true copy. If I go a1 = 42, and then...
1
by: Don Stefani | last post by:
Hello, I have a form that I want to submit "onchange", OK I've got that working, but when the form submits, I want to pass along a value to a CGI script, as if that value was in a hidden form...
2
by: pshvarts | last post by:
(I'm new in SOAP) I get some wsdl file (from apache service ). I tried creating SOAP client with .NET - trying to add Web Reference and get error like: "Custom tool error: Unable to import...
6
by: Adam Tilghman | last post by:
Hi all, I have found that IE doesn't seem to respect the <SELECT> "multiple" attribute when set using DOM methods, although the attribute/property seems to exist and is updated properly. Those...
5
by: sam | last post by:
Hi all, I am dynamically creating a table rows and inerting radio buttons which are also dynamically created. Everything works fine in Firefox as expected. But I am not able to select radio...
3
by: patrickkellogg | last post by:
I have this code when you click the buttom is suppose to add a job history. it works with firefox, opera, but not ie. (please note - new entries don't have all the elements in them yet, but...
2
by: somaskarthic | last post by:
Hi In my php code , i dynamically created table rows on button click event. Each row contain 3 selectboxes, 7 checkboxes . On each click of these elements i need to submit the form and save the...
2
by: yomadhu | last post by:
I created a dynamic form in javascript. Am unable to get those values in to php to display. I need all details. If i add 10 rows the i need to display those all values. Can any one help me for that...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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...

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.