dtd and validation
Féliciano Matias <[email protected]>
| Newsgroups | gmane.linux.rpm.metadata |
|---|---|
| Message-ID | <[email protected]> |
I am trying to learn XML (It's very _very_ very (!) hard...).
I use this xml file :
http://linux.duke.edu/projects/metadata/samples/repomd-sample.xml
With this dtd :
http://linux.duke.edu/projects/metadata/dtd/repomd.dtd
Add this to repond-samble.xml :
<!DOCTYPE metadata SYSTEM "http://linux.duke.edu/projects/metadata/dtd/repomd.dtd">
Here is the result of "xmllint --valid repomd-sample.xml" :
repomd-sample.xml:3: element repomd: validity error : No declaration for attribute xmlns of element repomd
<repomd xmlns="http://linux.duke.edu/projects/metadata/dtd/repomd.dtd">
^
repomd-sample.xml:3: element repomd: validity error : root and DTD name do not match 'repomd' and 'metadata'
<repomd xmlns="http://linux.duke.edu/projects/metadata/dtd/repomd.dtd">
^
repomd-sample.xml:5: element location: validity error : No declaration for attribute href of element location
<location href="repodata/other.xml.gz"/>
^
repomd-sample.xml:5: element location: validity error : No declaration for element location
<location href="repodata/other.xml.gz"/>
^
repomd-sample.xml:6: element checksum: validity error : No declaration for attribute type of element checksum
<checksum type="md5">65dbc8d68e2e96034344a2c2ce874f20</checksum>
^
repomd-sample.xml:6: element checksum: validity error : No declaration for element checksum
<checksum type="md5">65dbc8d68e2e96034344a2c2ce874f20</checksum>
^
repomd-sample.xml:7: element timestamp: validity error : No declaration for element timestamp
<timestamp>1086753915</timestamp>
^
repomd-sample.xml:8: element open-checksum: validity error : No declaration for attribute type of element open-checksum
<open-checksum type="md5">81bddf957dd61cf21a3bd7ffc2b7bc3e</open-checksum>
^
repomd-sample.xml:8: element open-checksum: validity error : No declaration for element open-checksum
<open-checksum type="md5">81bddf957dd61cf21a3bd7ffc2b7bc3e</open-checksum>
^
repomd-sample.xml:9: element data: validity error : Element data was declared #PCDATA but contains non text nodes
</data>
^
repomd-sample.xml:9: element data: validity error : Element data does not carry attribute href
</data>
^
repomd-sample.xml:9: element data: validity error : Element data does not carry attribute timestamp
</data>
^
repomd-sample.xml:11: element location: validity error : No declaration for attribute href of element location
<location href="repodata/filelists.xml.gz"/>
^
repomd-sample.xml:11: element location: validity error : No declaration for element location
<location href="repodata/filelists.xml.gz"/>
^
repomd-sample.xml:12: element checksum: validity error : No declaration for attribute type of element checksum
<checksum type="md5">6c0bdc1686e1d35ac2f29003cdb92493</checksum>
^
repomd-sample.xml:12: element checksum: validity error : No declaration for element checksum
<checksum type="md5">6c0bdc1686e1d35ac2f29003cdb92493</checksum>
^
repomd-sample.xml:13: element timestamp: validity error : No declaration for element timestamp
<timestamp>1086753915</timestamp>
^
repomd-sample.xml:14: element open-checksum: validity error : No declaration for attribute type of element open-checksum
<open-checksum type="md5">703fa9a87e6c7cb019d11c81b7917504</open-checksum>
^
repomd-sample.xml:14: element open-checksum: validity error : No declaration for element open-checksum
<open-checksum type="md5">703fa9a87e6c7cb019d11c81b7917504</open-checksum>
^
repomd-sample.xml:15: element data: validity error : Element data was declared #PCDATA but contains non text nodes
</data>
^
repomd-sample.xml:15: element data: validity error : Element data does not carry attribute href
</data>
^
repomd-sample.xml:15: element data: validity error : Element data does not carry attribute timestamp
</data>
^
repomd-sample.xml:17: element location: validity error : No declaration for attribute href of element location
<location href="repodata/primary.xml.gz"/>
^
repomd-sample.xml:17: element location: validity error : No declaration for element location
<location href="repodata/primary.xml.gz"/>
^
repomd-sample.xml:18: element checksum: validity error : No declaration for attribute type of element checksum
<checksum type="md5">2549cd1835ada623f62d46376c7ad0ef</checksum>
^
repomd-sample.xml:18: element checksum: validity error : No declaration for element checksum
<checksum type="md5">2549cd1835ada623f62d46376c7ad0ef</checksum>
^
repomd-sample.xml:19: element timestamp: validity error : No declaration for element timestamp
<timestamp>1086753915</timestamp>
^
repomd-sample.xml:20: element open-checksum: validity error : No declaration for attribute type of element open-checksum
<open-checksum type="md5">71dfd32bb3ef560ebcb8b659320f5bfd</open-checksum>
^
repomd-sample.xml:20: element open-checksum: validity error : No declaration for element open-checksum
<open-checksum type="md5">71dfd32bb3ef560ebcb8b659320f5bfd</open-checksum>
^
repomd-sample.xml:21: element data: validity error : Element data was declared #PCDATA but contains non text nodes
</data>
^
repomd-sample.xml:21: element data: validity error : Element data does not carry attribute href
</data>
^
repomd-sample.xml:21: element data: validity error : Element data does not carry attribute timestamp
</data>
^
repomd-sample.xml:22: element repomd: validity error : No declaration for element repomd
</repomd>
^
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE metadata SYSTEM "http://linux.duke.edu/projects/metadata/dtd/repomd.dtd">
<repomd xmlns="http://linux.duke.edu/projects/metadata/dtd/repomd.dtd">
<data type="other">
<location href="repodata/other.xml.gz"/>
<checksum type="md5">65dbc8d68e2e96034344a2c2ce874f20</checksum>
<timestamp>1086753915</timestamp>
<open-checksum type="md5">81bddf957dd61cf21a3bd7ffc2b7bc3e</open-checksum>
</data>
<data type="filelists">
<location href="repodata/filelists.xml.gz"/>
<checksum type="md5">6c0bdc1686e1d35ac2f29003cdb92493</checksum>
<timestamp>1086753915</timestamp>
<open-checksum type="md5">703fa9a87e6c7cb019d11c81b7917504</open-checksum>
</data>
<data type="primary">
<location href="repodata/primary.xml.gz"/>
<checksum type="md5">2549cd1835ada623f62d46376c7ad0ef</checksum>
<timestamp>1086753915</timestamp>
<open-checksum type="md5">71dfd32bb3ef560ebcb8b659320f5bfd</open-checksum>
</data>
</repomd>
The dtd :
<?xml version="1.0" encoding="UTF-8"?> <=== why ??? It's a dtd not a XML document
<!ELEMENT repository (name*, contact*, description*, key*, metadata)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT contact (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT key (#PCDATA)>
<!ATTLIST key type CDATA #REQUIRED>
<!ELEMENT metadata (data+)> # metadata or repomd ?
<!ELEMENT data (#PCDATA)> # should be data(location, checksum, timestamp, open-checksum)
<!ATTLIST data type CDATA #REQUIRED # location does not existe
timestamp CDATA #REQUIRED
href CDATA #REQUIRED
xml:base CDATA #IMPLIED>
Seems to me that the dtd does not correspond to the xml file.
If the dtd is useless, then it should be removed.
_______________________________________________
Rpm-metadata mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/rpm-metadata
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQBB6sf7AlHlXNHHbFMRAp7wAKDFEyV77T7HctsvTACNSaVMauir+QCghXoy eY5eJoI8o7xjOE7/zdiz6Ug= =eUQX -----END PGP SIGNATURE-----