Questions tagged [dtd]

DTD stands for "Document Type Definition" as specified in the XML 1.x Recommendations of the W3C. DTDs define formal grammars for XML documents: which tags you can use and where you can use them. Validating XML processors apply this grammar to XML documents to determine whether they conform to these grammars, in which case the document is "valid".

DTD stands for "Document Type Declaration" as specified in the XML 1.x Recommendations of the W3C (see http://www.w3.org/TR/xml/).

The XML document type declaration contains or points to markup declarations that provide a grammar for a class of documents. This grammar is known as a document type definition, or DTD. The document type declaration can point to an external subset (a special kind of external entity) containing markup declarations, or can contain the markup declarations directly in an internal subset, or can do both. The DTD for a document consists of both subsets taken together.

DTDs were also specified in SGML (ISO 8879:1986), the forbear to XML. SGML DTDs are more feature-rich than XML DTDs, allowing for example the specification of tag minimization features.

References:

1433 questions
31
votes
2 answers

How do I validate xml against a DTD file in Python

I need to validate an XML string (and not a file) against a DTD description file. How can that be done in python?
fulmicoton
  • 15,502
  • 9
  • 54
  • 74
30
votes
4 answers

DTD or XML Schema. Which one is better?

What are the pros / cons in DTD and XML Schemas (I'm not even sure what the official name of the latter is!)? Which is better? Why do we need two ways to do the same thing? Edit: I found this in an article I was reading, which is what prompted me to…
les2
  • 14,093
  • 16
  • 59
  • 76
26
votes
9 answers

Reference to undeclared entity exception while working with XML

I am trying to set the innerxml of a xmldoc but get the exception: Reference to undeclared entity XmlDocument xmldoc = new XmlDocument(); string text = "Hello, I am text α   – —" xmldoc.InnerXml = "

" + text + "

"; This…
Rob
  • 1,163
  • 2
  • 18
  • 28
24
votes
1 answer

xmllint : how to validate an XML using a local DTD file

I have a local DTD file test.dtd. Content is : ]> I'd like to validate an XML using xmllint. This XML has no DOCTYPE in it :
Eric H.
  • 2,152
  • 4
  • 22
  • 34
24
votes
3 answers

Validate an XML file against local DTD file with Java

How can I validate an XML file against a DTD that is stored locally as a file? The XML file does not have any DOCTYPE declaration (or may have one that should then be overridden). I had a look at this thread but besides the fact they are using .NET…
Simon
  • 1,643
  • 2
  • 17
  • 23
23
votes
6 answers

How to disable DTD fetching using JAXB2.0

I'm trying to use JAXB to unmashall some XML which I used xjc to create in the first place. I don't want to do any validation on the unmarshalling, but even though I have disabled the validation according to the JAXB documentation with…
Nick
  • 617
  • 1
  • 7
  • 22
21
votes
2 answers

How do I define HTML entity references inside a valid XML document?

I need to be able to reference named HTML entities like • instead of the Unicode alternative • in an XML document. I have control over some parts of the XML document, such as defining the DOCTYPE, but doing a find-and-replace in the…
mattmc3
  • 17,595
  • 7
  • 83
  • 103
18
votes
3 answers

Ignore DTD specification in scala

I'd like to occasionally ignore the dtd specification while parsing an xml file using Scala. I know that this can be done pretty easily with the java interface by doing DocumentBuilderFactory dbf =…
fozziethebeat
  • 1,180
  • 2
  • 11
  • 27
16
votes
2 answers

How to validate xml with dtd using java?

I have following xml file: E-001 Vinod Vinod1@yahoo.com I have following dtd file:
Sachin J
  • 2,081
  • 12
  • 36
  • 50
16
votes
2 answers

Where is the official podcast DTD?

The podcast howto on the Apple website shows a sample XML file, which refers to a podcast DTD: podcast-1.0.dtd. The DTD is not available at this address, unfortunately. I heard you can validate a feed using feedvalidator.org, but it's only a…
automaciej
  • 429
  • 3
  • 14
16
votes
5 answers

XML, DTD: how to make the order not important

I started off using an XML file and a parser as a convenient way to store my data I want to use DTD to check the structure of the xml files when they arrive. Here is my DTD file < ?xml version="1.0" encoding="UTF-8"?> < !ELEMENT document…
Jason Rogers
  • 19,194
  • 27
  • 79
  • 112
16
votes
3 answers

how to disable dtd at runtime in java's xpath?

I got dtd in file and I cant remove it. When i try to parse it in Java I get "Caused by: java.net.SocketException: Network is unreachable: connect", because its remote dtd. can I disable somehow dtd checking?
IAdapter
  • 62,595
  • 73
  • 179
  • 242
16
votes
9 answers

Is Scala/Java not respecting w3 "excess dtd traffic" specs?

I'm new to Scala, so I may be off base on this, I want to know if the problem is my code. Given the Scala file httpparse, simplified to: object Http { import java.io.InputStream; import java.net.URL; def request(urlString:String):…
JohnMetta
  • 18,782
  • 5
  • 31
  • 57
15
votes
3 answers

Free XSD to DTD conversion utility?

I have a XSD (XML Schema) that I need to convert to a DTD. Is there a free utility or simple way to accomplish this? A XSLT for example? Python scripts are welcome too. Note: this is the opposite direction of the question Free DTD to XSD conversion…
Laurent LAPORTE
  • 21,958
  • 6
  • 58
  • 103
1
2
3
95 96