dtd

How do I validate an XML document against a DTD in C#?

I don't want to do anything fancy, I just want to make sure a document is valid, and print an error message if it is not. Google pointed me to this, but it seems XmlValidatingReader is obsolete (at least, that's what MonoDevelop tells me). Edit: I'm trying Mehrdad's tip, but I'm having trouble. I think I've got most of it, but I can't f...

Localization of HTML documents?

XML documents can be localized by referring to an external DTD document that contains the translations. For example in Mozilla XULRunner it looks like this: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <!DOCTYPE window SYSTEM "chrome://configpanel/locale/configpanel.dtd"> <window title="&CONFIG_P...

When should a DTD be made public

When creating a custom external DTD you have the choice of making it private or public. When should a DTD be made public? In this case I'm creating a DTD for an xml file which will describe product. The XML will be created by our client, filled with data from their old system. we will import this data into the new system we are building...

how to represent it in dtd ?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ? ...

DTD flash open source engine?

DTD flash flex action script open source engine? I need some open source engine for creating some games like Desktop Tower Defense games Does it exist?) So… What do I need? I need - • Open Source Libs • Tutorials • Blog posts/Articles ...

DTD element type problem

I'm constructing DTD which has 'fuel_system' element.I want to restrict the text between tag.It must be only carbureted or fuel-injected.How can I do this ? I don't mention something like this = > attribute type (carbureted,fuel-injected) , because I want to force this rule in tags not the attribute of fuel_system.. ...

XML Reader wants ProhibitDTD to be false but it is!

Here is the code Stream stream = request.InputStream; String xsd = // Path to file XmlReaderSettings settings = new XmlReaderSettings(); if (xsd.Length != 0 && File.Exists(xsd)) { settings.ProhibitDtd = false; settings.Schemas.Add("", xsd); settings.ValidationType = ValidationType.Schema; } else { throw new cXMLException("XSD ...

Validating with DTD - connection forcibly closed

I'm validating a document with the DTD in the document which is not on my machine, it is stored on the internet. I am currently getting the following exception System.Xml.XmlException: An error has occurred while opening external DTD 'http://xml.cxml.org/schemas/cXML/1.2.020/cXML.dtd': Unable to connect to the remote server ---&gt; Sy...

How to derive DTD (or other XML spec format) from XML file samples

Do you know of a tool that will derive a DTD (or other XML structure specification format) from a sample set of XML files? Currently the only (automatic) validation we have for an xml encoded DSL is a legacy parser written in Perl, but for consistency reasons all perl code must be ported to C-sharp. ...

XML Resolver takes ages - Stops request going to server, or does it?

I am processing an XML document who's DTD is on a server that doesn't respond and the request times out. XmlReaderSettings settings = new XmlReaderSettings(); settings.ProhibitDtd = false; settings.XmlResolver = new cXMLResolver(); settings.ValidationEventHandler += ValidationEventHandler; settings.ValidationType = ValidationType....

How to control DTD reading with .NET?

A C# program of ours reads an XML file. The XML file has standalone='no' header. The DOCTYPE used to look like: <!DOCTYPE foo SYSTEM "silly.dtd"> where silly.dtd is not sitting right there next to the file. For various reasons, I changed this to <!DOCTYPE foo PUBLIC "-//Some Public Id" "urn:outerspace:silly.dtd"> I expected noth...

Validate an Xml file against a DTD with a proxy. C# 2.0

I have looked at many examples for validating an XML file against a DTD, but have not found one that allows me to use a proxy. I have a cXml file as follows (abbreviated for display) which I wish to validate: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.018/InvoiceDetail.dtd"&gt; <c...

From Sax to Dom with DTD (python)

I need a validated DomTree with DTD (to use getElementById). Validating and Parsing works, but the dom does't work properly: from xml.dom import minidom from xml.dom.pulldom import SAX2DOM from lxml import etree import lxml.sax from StringIO import StringIO data_string = """\ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE foo [ <!EL...

HTML: Do we really need different DocTypes?

why w3c has the conventions of different Doc-types .. ? Instead they could have recommended only one Doc-type (say loose type.. as it would prone to less number of SILLY errors) and would have standardized it to all browsers (including the ones in mob and PDAs) ..I haven't got any satisfying answer in any tutorial yet .. I have been read...

problem validating XML against DTD in C#

This has been bugging me for a couple days. I'm trying to load a XML from an uploaded file to into an XmlDocument object and get the following yellow-screen-of-death: For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the settings int...

Add a dtd using nokogiri builder

I am using nokogiri to generate svg pictures. I would like to add the correct xml preamble and svg DTD declaration to get something like: <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"&gt; <svg> ... With builder I could use instruct! and declare!...

Transforming DTD's with Python

I'm looking for a library to help me parse and transform DTDs using Python. The only thing I have found so far is xmlproc, but that seems ancient and doesn't seem to support serialization of DTDs. There's this for Java but I'd prefer a Python solution. Edit: by "serialization" of DTDs I mean that ideally I'd like to be able to parse the...

validating xml file with dtd using jsp

Is there any way to validate an XML file with its DTD, using a JSP in Eclipse? If so, how can we do it? ...

Hidden Features of XML, DTD and XML Schema

With all of the other hidden features questions on SO, how can we forget XML? What are the hidden features of XML, DTD and XML Schema? ...

How to resolve local DTDs without System.Xml.Utils.Dll(XmlPreloadedResolver)?

I use an external DTD to validate my xml files. Since the XmlReader seem to look for the DTD only in the folder where the xml file is, I need to somehow tell the reader to look into a specific folder where my dtd's are. I though of XmlPreloadedResolver to solve this but I cannot find System.Xml.Utils.Dll in the GAC. Isn't this a standa...