dtd

What resources can I use to validate a DTD?

喜你入骨 提交于 2019-12-06 03:36:16
问题 What resources are available to validate a DTD? I want to be clear: I am not talking about validating XML documents against a DTD. I am talking about making sure that the DTD itself is valid. 回答1: I work with Oxygen xml editor, you can try for 30 day trial! Works very well with xml files, dtd, xslt... When you write DTD code you can validate it (document menu > validate). The dtd file is an xml file which describe a xml file. This code: <?xml version="1.0" encoding="UTF-8"?> <!ELEMENT chapter

The markup declarations contained or pointed to by the document type declaration must be well-formed

和自甴很熟 提交于 2019-12-06 00:17:13
I have written one XML, but in that XMLon very first line I am getting an error The markup declarations contained or pointed to by the document type declaration must be well-formed below is that XML (space after angular brackets is intentional) <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apche.org/dtds/struts-2.0.dtd"> <struts> <package name="default" extends="struts-default"> <action name="getTutorial" class="org.koushik.javabrains.action.TutorialAction"> <result name="success">/success.jsp<

How can I ignore DTD validation but keep the Doctype when writing an XML file?

心已入冬 提交于 2019-12-05 21:53:13
I am working on a system that should be able to read any (or at least, any well-formed) XML file, manipulate a few nodes and write them back into that same file. I want my code to be as generic as possible and I don't want hardcoded references to Schema/Doctype information anywhere in my code. The doctype information is in the source document, I want to keep exactly that doctype information and not provide it again from within my code. If a document has no DocType, I won't add one. I do not care about the form or content of these files at all, except for my few nodes. custom EntityResolvers or

Referring to a local DTD in Java

六眼飞鱼酱① 提交于 2019-12-05 20:02:24
问题 I have some XML that I'm parsing with a SAX parser in Java. It starts with this preamble: <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 3.0//EN" "http://www.w3.org/Math/DTD/mathml3/mathml3.dtd"> How do I change this to use a local DTD? I suppose I could do something like this: <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 3.0//EN" "file:///c:/MathML/mathml3.dtd"> Not exactly like that, but something like that. However, I need the path to be independent of the user's system. How do I use a local DTD

HTML5 is not based on SGML, and therefore does not require a reference to a DTD

戏子无情 提交于 2019-12-05 18:13:38
From: http://www.w3schools.com/tags/tag_doctype.asp The < !DOCTYPE > declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in. In HTML 4.01, the < !DOCTYPE > declaration refers to a DTD, because HTML 4.01 was based on SGML. The DTD specifies the rules for the markup language, so that the browsers render the content correctly. HTML5 is not based on SGML, and therefore does not require a reference to a DTD. Tip: Always add the < !DOCTYPE > declaration to your HTML documents, so that the browser knows what type of document to expect

Can I reference an external DTD for the structure of an ELEMENT in a DTD?

旧街凉风 提交于 2019-12-05 14:41:09
Can I define a DTD such that elements in it have their structures defined in an external DTD? I mean something like the following (this is an example that I know is invalid in several ways, but which hopefully will give you an idea of what I am looking for): <?xml version="1.0" encoding="UTF-8"?> <!ENTITY % MessageHdr-DTD SYSTEM "./messagehdr.dtd"> <!ENTITY % MessageBody-DTD SYSTEM "./messagebody.dtd"> <!ELEMENT Message (MessageHdr, MessageBody)> <!ELEMENT MessageHdr (MessageHdr-DTD)> <!ELEMENT MessageBody (MessageBody-DTD)> The attempt here is to represent that a Message requires a MessageHdr

How to ignore inline DTD when parsing XML file in Java

。_饼干妹妹 提交于 2019-12-05 13:29:33
I have a problem reading a XML file with DTD declaration inside (external declaration is solved). I'm using SAX method (javax.xml.parsers.SAXParser). When there is no DTD definition parsing looks like for example StartEement-Characters-StartElement-Characters-EndElement-Characters...... So there is characters method called immediately after Start or End element and thats how I need it to be. When DTD is in file parsing schema changes to for example StartElement-StartElement-StartElement-Characters-EndEement-EndEement-EndEement. And I need Characters method after every element. So I'm asking is

How to apply validation of local DTD file to xml file in java?

风格不统一 提交于 2019-12-05 10:46:20
I need to parse a bunch of incoming XML documents but it does not contain DTD declaration. Currently I am parsing xml documents using SAX Parser but without DTD validation. Now I want to apply DTD validation. DTD is created by myself. How can I validate an XML file using DTD created by myself (SAX parser) ? I found some tutorials using Transformer but all for DOM Parser. How to parse XML file using SAX Parser and also applying DTD validation. Any help.... Below is a sample that I believe could help to do what you want: private void loadXML(Reader reader) throws ParserConfigurationException,

XmlDocument and slow schema processing

我与影子孤独终老i 提交于 2019-12-05 09:43:22
I have an xml template document that I need to load into an XmlDocument. eg myXMLDocument.Load(myXMLFile); However this is very slow as it loads in the dtd. I have tried both "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" and a local copy of the dtd. Both take more or less the same time. If I turn of loading the dtd by setting the resolver to null (for example), I then get errors such as "Reference to undeclared entity 'nbsp'" if the document contains these. I need to use an XmlDocument as I need to manipulate the DOM before outputting the document. How can I get round these problems? You can

Java SAX Parser raises UnknownHostException

独自空忆成欢 提交于 2019-12-05 05:36:04
The XML file I want to parse starts with : <!DOCTYPE plist PUBLIC "-//...//DTD PLIST 1.0//EN" "http://www.....dtd"> So when I start the SAX praser, it tries to access this DTD online, and I get a java.net.UnknownHostException. I cannot modify the XML file before feeding it to the SAX parser I have to run even with no internet connection How can I change the SAX Parser behaviour so that it does not try to load the DTD ? Thanks. javax.xml.parsers.SAXParserFactory factory = javax.xml.parsers.SAXParserFactory.newInstance(); factory.setValidating(false); javax.xml.parsers.SAXParser parser = factory