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
11
votes
2 answers

Element that can only have one of two text values?

I'm constructing a DTD which has a 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,…
Şeref Acet
  • 311
  • 1
  • 7
  • 15
11
votes
4 answers

Validate XML using a custom DTD in PHP

Is there a way (without installing any libraries) of validating XML using a custom DTD in PHP?
michael
  • 4,427
  • 6
  • 38
  • 57
10
votes
2 answers

XML format specification (DTD, XSD..) for Unit Test Reports

A lot of tools produces and consumes the same XML File format for Unit Test report. Example (source):
Jmini
  • 9,189
  • 2
  • 55
  • 77
10
votes
3 answers

The best way to validate XML in a unit test?

I have a class with a ToString method that produces XML. I want to unit test it to ensure it is producing valid xml. I have a DTD to validate the XML against. Should I include the DTD as a string within the unit test to avoid a dependency on it, or…
Corin Blaikie
  • 17,718
  • 10
  • 37
  • 39
10
votes
5 answers

Yet another question regarding the html5 dtd/schema

If there is no DTD or schema to validate the H5 document against, how are we supposed to do document validation? And by document validation, I mean "how are we supposed to ensure our html5 documents are both syntactically accurate and structurally…
jkilgrow
  • 193
  • 1
  • 10
10
votes
3 answers

JAXB SAXParseException when unmarshalling document with relative path to DTD

I have a class that unmarshals xml from a 3rd party source (I have no control over the content). Here is the snippet that unmarshals: JAXBContext jContext = JAXBContext.newInstance("com.optimumlightpath.it.aspenoss.xsd"); Unmarshaller unmarshaller…
Bill Dolan
  • 359
  • 1
  • 4
  • 12
10
votes
2 answers

Error while unmarshal an XML with JAXB caused by DTD file

I try to unmarhshal a file XML file (test.xml) with JAXB (javax.xml.bind.JAXB) but it gives me this error: [org.xml.sax.SAXParseException; systemId: file:/C:/Users/EXAMPLE/AppData/Local/Eclipse/workspace_4.4.0/EXAMPLE/test.xml; lineNumber: 2;…
LoremIpsum
  • 505
  • 4
  • 8
  • 20
10
votes
1 answer

How to use the same element name for different purposes ( in XML and DTD )?

I Want to create a DTD schema for this xml document: S1 S2 CS101
Abdullah
  • 5,445
  • 10
  • 41
  • 48
10
votes
3 answers

An error has occurred opening extern DTD (w3.org, xhtml1-transitional.dtd). 503 Server Unavailable

I'm trying to do xpath queries over an xhtml document. Using .NET 3.5. The document looks like this:
Cheeso
  • 189,189
  • 101
  • 473
  • 713
10
votes
1 answer

Achieving full justification in HTML and CSS: works in limited-quirks mode but no-quirks mode messes up the height

I am trying to achieve full justification (as distinct from left justification, where the final line is left-aligned rather than justified) in HTML and CSS. I have this document, plus a doctype definition: