Test demonstrates that the empty-element tag must be use for an elements that are declared EMPTY.
<!DOCTYPE doc [ <!ELEMENT doc (e*)> <!ELEMENT e EMPTY> <!ATTLIST e a1 CDATA "v1" a2 CDATA "v2" a3 CDATA #IMPLIED> ]> <doc> <e a3="v3"/> <e a1="w1"/> <e a2="w2" a3="v3"/> </doc>
Expected result | Actual result for org.dom4j.io.aelfred.SAXDriver |
---|---|
<?xml version="1.0" encoding="UTF-8"?> <ConformanceResults> <startDocument/> <startElement> <namespaceURI/> <localName>doc</localName> <qualifiedName>doc</qualifiedName> <attributes/> </startElement> <ignorable>\n</ignorable> <startElement> <namespaceURI/> <localName>e</localName> <qualifiedName>e</qualifiedName> <attributes> <attribute> <namespaceURI/> <localName>a1</localName> <qualifiedName>a1</qualifiedName> <value>v1</value> <type>CDATA</type> </attribute> <attribute> <namespaceURI/> <localName>a2</localName> <qualifiedName>a2</qualifiedName> <value>v2</value> <type>CDATA</type> </attribute> <attribute> <namespaceURI/> <localName>a3</localName> <qualifiedName>a3</qualifiedName> <value>v3</value> <type>CDATA</type> </attribute> </attributes> </startElement> <endElement> <namespaceURI/> <localName>e</localName> <qualifiedName>e</qualifiedName> </endElement> <ignorable>\n</ignorable> <startElement> <namespaceURI/> <localName>e</localName> <qualifiedName>e</qualifiedName> <attributes> <attribute> <namespaceURI/> <localName>a1</localName> <qualifiedName>a1</qualifiedName> <value>w1</value> <type>CDATA</type> </attribute> <attribute> <namespaceURI/> <localName>a2</localName> <qualifiedName>a2</qualifiedName> <value>v2</value> <type>CDATA</type> </attribute> </attributes> </startElement> <endElement> <namespaceURI/> <localName>e</localName> <qualifiedName>e</qualifiedName> </endElement> <ignorable>\n</ignorable> <startElement> <namespaceURI/> <localName>e</localName> <qualifiedName>e</qualifiedName> <attributes> <attribute> <namespaceURI/> <localName>a1</localName> <qualifiedName>a1</qualifiedName> <value>v1</value> <type>CDATA</type> </attribute> <attribute> <namespaceURI/> <localName>a2</localName> <qualifiedName>a2</qualifiedName> <value>w2</value> <type>CDATA</type> </attribute> <attribute> <namespaceURI/> <localName>a3</localName> <qualifiedName>a3</qualifiedName> <value>v3</value> <type>CDATA</type> </attribute> </attributes> </startElement> <endElement> <namespaceURI/> <localName>e</localName> <qualifiedName>e</qualifiedName> </endElement> <ignorable>\n</ignorable> <endElement> <namespaceURI/> <localName>doc</localName> <qualifiedName>doc</qualifiedName> </endElement> <endDocument/> </ConformanceResults> | <?xml version="1.0" encoding="UTF-8"?> <ConformanceResults> <startDocument/> <resolveEntity> <systemID>file:/home/elharo/SAXTest/xmlconf/xmltest/valid/sa/044.xml</systemID> </resolveEntity> <startElement> <namespaceURI/> <localName>doc</localName> <qualifiedName>doc</qualifiedName> <attributes/> </startElement> <ignorable>\n</ignorable> <startElement> <namespaceURI/> <localName>e</localName> <qualifiedName>e</qualifiedName> <attributes> <attribute> <namespaceURI/> <localName>a1</localName> <qualifiedName>a1</qualifiedName> <value>v1</value> <type>CDATA</type> </attribute> <attribute> <namespaceURI/> <localName>a2</localName> <qualifiedName>a2</qualifiedName> <value>v2</value> <type>CDATA</type> </attribute> <attribute> <namespaceURI/> <localName>a3</localName> <qualifiedName>a3</qualifiedName> <value>v3</value> <type>CDATA</type> </attribute> </attributes> </startElement> <endElement> <namespaceURI/> <localName/> <qualifiedName>e</qualifiedName> </endElement> <ignorable>\n</ignorable> <startElement> <namespaceURI/> <localName>e</localName> <qualifiedName>e</qualifiedName> <attributes> <attribute> <namespaceURI/> <localName>a1</localName> <qualifiedName>a1</qualifiedName> <value>w1</value> <type>CDATA</type> </attribute> <attribute> <namespaceURI/> <localName>a2</localName> <qualifiedName>a2</qualifiedName> <value>v2</value> <type>CDATA</type> </attribute> </attributes> </startElement> <endElement> <namespaceURI/> <localName/> <qualifiedName>e</qualifiedName> </endElement> <ignorable>\n</ignorable> <startElement> <namespaceURI/> <localName>e</localName> <qualifiedName>e</qualifiedName> <attributes> <attribute> <namespaceURI/> <localName>a1</localName> <qualifiedName>a1</qualifiedName> <value>v1</value> <type>CDATA</type> </attribute> <attribute> <namespaceURI/> <localName>a2</localName> <qualifiedName>a2</qualifiedName> <value>w2</value> <type>CDATA</type> </attribute> <attribute> <namespaceURI/> <localName>a3</localName> <qualifiedName>a3</qualifiedName> <value>v3</value> <type>CDATA</type> </attribute> </attributes> </startElement> <endElement> <namespaceURI/> <localName/> <qualifiedName>e</qualifiedName> </endElement> <ignorable>\n</ignorable> <endElement> <namespaceURI/> <localName/> <qualifiedName>doc</qualifiedName> </endElement> <endDocument/> </ConformanceResults> |