Validation of an XML and DTD
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 2
- Joined: Mon Aug 21, 2017 12:21 pm
Validation of an XML and DTD
I have a problem with my XML and DTD and I can't understand what it is. Normally, my xml is well formed:
My DTD:
My validation: xmllint CONTRE.xml --dtdvalid CONTRE.dtd --noout
Errors:
Can anybody help me? Thank you! 
Code: Select all
<?xml version='1.0' encoding='UTF-8' standalone="no"?>
<!DOCTYPE corpus SYSTEM "POUR.dtd">
<corpus>
<position type="contre">
<discours auteur="Aécio Neves" id="1" date="25/08/2016" lieu="Senado Federal">
blablabla
</discours>
</position>
</corpus>
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<!ELEMENT corpus (position, discours)>
<!ELEMENT position (type)>
<!ATTLIST contre (#CDATA)>
<!ELEMENT discours (auteur, id, date, lieu)>
<!ATTLIST auteur (#CDATA)>
<!ATTLIST id (#CDATA)>
<!ATTLIST date (#CDATA)>
<!ATTLIST lieu (#CDATA)>
Errors:
Code: Select all
CONTRE.dtd:5: parser error : ATTLIST: no name for Attribute
<!ATTLIST contre (#CDATA)>
^
CONTRE.dtd:5: parser error : Content error in the external subset
<!ATTLIST contre (#CDATA)>
^

-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Validation of an XML and DTD
Hi,
You can try to google and follow a DTD tutorial.
The ATTLIST keyword connects an element with an attribute (name,value) definition.
For example if you define this element:
you can define an attribute for it like:
meaning that "contre" is an attribute of element "position", that it has simple character data and that it can be missing from the document (that #IMPLIED part).
Regards,
Radu
You can try to google and follow a DTD tutorial.
The ATTLIST keyword connects an element with an attribute (name,value) definition.
For example if you define this element:
Code: Select all
<!ELEMENT position (type)>
Code: Select all
<!ATTLIST position contre CDATA #IMPLIED>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service