dtd

Attribute value “001” of type ID must be an NCName when namespaces are enabled

只愿长相守 提交于 2019-12-12 16:39:12
问题 So i'm creating a xml file with my own DTD. The simplified XML is as follows: <!DOCTYPE catalog [ <!ELEMENT catalog (product+)> <!ELEMENT product (title?, price, creation_date?, weight?, color, description?)> <!ELEMENT creation_date (day, month, year)> <!ATTLIST product category (art|dinner_set|ovenware) "art"> <!ATTLIST product id ID #REQUIRED> <!ELEMENT id (#PCDATA)> <!ELEMENT title (#PCDATA)> <!ELEMENT price (#PCDATA)> <!ELEMENT day (#PCDATA)> <!ELEMENT month (#PCDATA)> <!ELEMENT year (

DTD - uniqueness of ID attributes

爱⌒轻易说出口 提交于 2019-12-12 13:25:05
问题 According to the DTD specification on the ID attribute type: Validity constraint: ID Values of type ID MUST match the Name production. A name MUST NOT appear more than once in an XML document as a value of this type; i.e., ID values MUST uniquely identify the elements which bear them. Which of the following explanations is correct? Values must differ among all instances of all attributes of type ID. Values must differ among all instances of the same attribute of type ID. In other words, given

Does python's xml.etree.ElementTree support DTD?

北城余情 提交于 2019-12-12 10:14:11
问题 Does xml.etree.ElementTree support DTD? if it supports it, can I force ElementTree check a XML file against a dtd file, even if the XML file already has one. (internal or external). 回答1: I'm not sure about xml.etree , but lxml supports DTD validation: http://lxml.de/validation.html 来源: https://stackoverflow.com/questions/5396135/does-pythons-xml-etree-elementtree-support-dtd

Check for malicious XML before allowing DTD loading?

谁说胖子不能爱 提交于 2019-12-12 09:58:38
问题 Since libxml 2.9, loading external entities has been disabled when parsing XML, to prevent XXE attacks. In that case, to be able to load a DTD file when parsing the XML with PHP's DOMDocument, LIBXML_DTDLOAD must be specified. What would be a good way to verify that only the expected DTD will be loaded, before enabling LIBXML_DTDLOAD ? One approach I can think of (as shown in the example code below) would be to keep entity loading disabled, parse the XML file once, check that the DOCTYPE

Java SAX Parser raises UnknownHostException

岁酱吖の 提交于 2019-12-12 09:37:41
问题 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

How to define in Liquibase a set of default columns, def. PKs, def. indexes, def. values for table creation?

霸气de小男生 提交于 2019-12-12 08:57:16
问题 I just looking around to reduce effort and errors on table creation on liquibase. Is it possible to create a set of default colums for tables? columns: int ID varchar UUID timestamp createdTs timestamp updatedTs int lockVersion constraints ID not NULL and with autogenerated key (as primary key) UUID not NULL createdTS not NULL with default CURRENT_TIMESTAMP updatedTS not NULL with default CURRENT_TIMESTAMP lockVersion not NULL index ID UUID so for example: genericTable.xml <changeSet author=

Requiring an attribute be defined if and only if a child element is not present for an element in a DTD

一个人想着一个人 提交于 2019-12-12 06:32:37
问题 Consider the following definition from a DTD: <!ELEMENT application (calculator)?> <!ATTLIST application uri CDATA #REQUIRED > My problem is that I want the uri attribute to be defined if and only if there is not a calculator element. Is there a way to require this? 回答1: @Alejandro is right. That's not possible with a DTD nor is it possible with XML Schema. You can do this using a co-occurrence constraint with a RelaxNG schema or you could use Schematron in conjunction with any of those

XmlDocument.Load not processing DTD?

拥有回忆 提交于 2019-12-12 03:27:27
问题 I am trying to build & develop a Security POC, this code is part of an app that I've extracted into a smaller app because I am having some difficulty with it. String str = "<?xml version=\"1.0\"?><!DOCTYPE foo[<!ELEMENT foo ANY> <!ENTITY word \"A\">]><foo>&word;</foo>"; System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); xDoc.LoadXml(str); xDoc.Save(@"C:\Temp\xdoc.xml"); Consider the xml string contains a DTD entity word, which is referenced in my actual xml. When the document is

Comments inside HTML/SGML/XML/DTD declarations

笑着哭i 提交于 2019-12-12 03:22:45
问题 In the W3C HTML 4.01 DTDs and earlier, inline comments are frequently used within declarations. For example, the HTML 2.0 Strict DTD has: <!ENTITY % HTML.Version "-//IETF//DTD HTML 2.0 Strict//EN" -- Typical usage: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Strict//EN"> <html> ... </html> -- > where the HTML entity declaration contains a comment between two double hyphens -- . However, DTD validators seem to flat out reject these sorts of internal comments and throw an error. Are the validators

HTMLEditorKit and Custom tags in the JEditorPane

我们两清 提交于 2019-12-12 02:29:55
问题 I use the instructions to add my own tag http://java-sl.com/custom_tag_html_kit.html class MyParserDelegator extends ParserDelegator { public MyParserDelegator() { try { Field f=javax.swing.text.html.parser.ParserDelegator.class.getDeclaredField("dtd"); f.setAccessible(true); DTD dtd=(DTD)f.get(null); javax.swing.text.html.parser.Element div=dtd.getElement("div"); dtd.defineElement("button", div.getType(), true, true,div.getContent(),null, null,div.getAttributes()); } catch