dtd-parsing

XML and DTD: The content of element type must match

不羁的心 提交于 2020-01-30 08:58:05
问题 I'm learning XML at the moment and I'm struggling with the first DTD extension. My DTD : <!ELEMENT biblio (livre*) > <!ELEMENT livre (achat , auteurs, titre ) > <!ATTLIST livre langue CDATA #IMPLIED ref CDATA #IMPLIED> <!ELEMENT achat EMPTY > <!ATTLIST achat date CDATA #IMPLIED lieu CDATA #IMPLIED> <!ELEMENT titre (#PCDATA)> <!ATTLIST titre genre CDATA #IMPLIED type NMTOKEN #IMPLIED> <!ELEMENT auteurs (auteur+) > <!ELEMENT auteur ( nom?, prenom? ,sexe?) > <!ELEMENT nom (#PCDATA)> <!ELEMENT

Xhtml Invalid Characters?

六月ゝ 毕业季﹏ 提交于 2019-12-11 13:39:01
问题 I have made custom xhtml valdidator in .NET(validating through dtd + some extra rules) and I have noticed a discrepancy between my validation and w3c validation. In my validator I get the following error when there is colon in the id (let's say : id="mustang:horse") (Error) The 'id' attribute has an invalid value according to its data type. But I do not get any errors on w3c for this pattern. I tried to find a list of invalid characters for an attribute in xml/xhtml but couldn't find it?

Parsing dtd file with lxml library (python)

帅比萌擦擦* 提交于 2019-12-11 12:17:12
问题 I need your help. I use lxml library to parsing dtd file. How can i get c subexpression in this example? dtd = etree.DTD(StringIO('<!ELEMENT a (b,c,d)>')) I try this content = dtd.elements()[0].content left, right = content.left, content.right but it left of right subexpression. http://lxml.de/validation.html#id1 回答1: I'm completely guessing (I've never touched this before) but: from io import StringIO from lxml import etree dtd.elements()[0].content.right.left #>>> <lxml.etree.

How to load an inline DTD for use with XDocument?

冷暖自知 提交于 2019-11-30 17:29:35
问题 I have a question regarding how to include a document type definition into an XML file, or from and XML file, that is being loaded into XDocument, in WP7. I have DTD file that is similar to this: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE root [ <!ELEMENT root (Person*)> <!ELEMENT Person (Name*, Description*)> <!ELEMENT Name (#PCDATA)> <!ELEMENT Description (#PCDATA)> <!ENTITY egrave "è"> <!ENTITY eacute "é"> <!ENTITY euro "€"> ]> I need to add this DTD to the XML I'm getting to catch