How do I define HTML entity references inside a valid XML document?
If you can modify the the XML to include an inline DTD you can define the entities there: <!DOCTYPE yourRootElement [ <!ENTITY bull “•”> …. ]>
If you can modify the the XML to include an inline DTD you can define the entities there: <!DOCTYPE yourRootElement [ <!ENTITY bull “•”> …. ]>
In an ideal world, you’d be able to validate using a Validator. Something like this: SchemaFactory schemaFactory = SchemaFactory .newInstance(XMLConstants.XML_DTD_NS_URI); Schema schema = schemaFactory.newSchema(new File( “xmlValidate.dtd”)); Validator validator = schema.newValidator(); validator.validate(new StreamSource(“xmlValidate.xml”)); Unfortunately, the Sun implementation (at least, as of Java 6) does not include support for creating a Schema instance from a DTD. You … Read more
If you happen to have Visual Studio, open the DTD file an you should have a button to “Create Schema” out of it. I haven’t checked if it was available on Express edition, though.
I got rid of this annoying warning by specifying <!DOCTYPE xml> after the <?xml … > tag instead of specifying something else (like templates in your case). <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE xml>
There is no HTML5 DTD. The HTML5 RC explicitly says this when discussing XHTML serialization, and this clearly applies to HTML serialization as well. DTDs have been regarded by the designers of HTML5 as too limited in expressive power, and HTML5 validators (basically the HTML5 mode of http://validator.nu and its copy at http://validator.w3.org/nu/) use schemas … Read more
From the Differences Between DTDs and Schema section of the Converting a DTD into a Schema article: The critical difference between DTDs and XML Schema is that XML Schema utilize an XML-based syntax, whereas DTDs have a unique syntax held over from SGML DTDs. Although DTDs are often criticized because of this need to learn … Read more
You have duplicate DOCTYPE declarations. If you want to reference an external DTD: test.xml <?xml version=’1.0′ encoding=’UTF-8′?> <!DOCTYPE email SYSTEM “test.dtd”> <email> <von>test@test.com</von> <zu>xxx@example.com</zu> <titel>Hello</titel> <text>Dear John….;-).</text> <prior type=”schnell”/> </email> test.dtd <!ELEMENT email (von,zu,titel,text,prior)> <!ELEMENT von (#PCDATA)> <!ELEMENT zu (#PCDATA)> <!ELEMENT titel (#PCDATA)> <!ELEMENT text (#PCDATA)> <!ELEMENT prior EMPTY> <!ATTLIST prior type CDATA #REQUIRED > … Read more
Try setting features on the DocumentBuilderFactory: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setNamespaceAware(true); dbf.setFeature(“http://xml.org/sax/features/namespaces”, false); dbf.setFeature(“http://xml.org/sax/features/validation”, false); dbf.setFeature(“http://apache.org/xml/features/nonvalidating/load-dtd-grammar”, false); dbf.setFeature(“http://apache.org/xml/features/nonvalidating/load-external-dtd”, false); DocumentBuilder db = dbf.newDocumentBuilder(); … Ultimately, I think the options are specific to the parser implementation. Here is some documentation for Xerces2 if that helps.
Keep in mind that an anchor isn’t just a link, it’s also something to which one can link. (Though the former use is far more common than the latter.) Quoting W3C (old, but relevant): An anchor is a piece of text which marks the beginning and/or the end of a hypertext link. To that end, … Read more
Basically, the DOCTYPE describes the HTML that will be used in your page. Browsers also use the DOCTYPE to determine how to render a page. Not including a DOCTYPE or including an incorrect one can trigger quirks mode. The kicker here is, that quirks mode in Internet Explorer is quite different from quirks mode in … Read more