DTD Validation Error: Attribute Value "9999" of type ID must be aname.

  • Thread starter Marcio DeBarros
  • Start date
M

Marcio DeBarros

Hi,

I am using JDOM to create and validate XML document in a Java app. for
the first time, and am getting the error above when I am validating a
document with SAXBuilder with the following DTD:

<?xml version="1.0" encoding="utf-8" ?>
<!-- DTD for a user definition file -->
<!ELEMENT user (username, password, email?)>
<!ATTLIST user id ID #REQUIRED>
<!ELEMENT username (#PCDATA)>
<!ELEMENT password (#PCDATA)>
<!ELEMENT email (#PCDATA)>


And here is the output file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE user SYSTEM "../lib/dtd/user.dtd">
<user id="9999">
<username>SomeUser</username>
<password>mypassword</password>
<email>[email protected]</email>
</user>


The document was created using JDOM, and the during the creation of the
attribute :
Attribute idXML = new Attribute ("id", getId(), Attribute.ID_ATTRIBUTE);
userXML.setAttribute(idXML);


Any ideas on what I am doing wrong here ???

Thanks,

--MD.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top