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

Marcio DeBarros

Usenet Archive
Joined
Oct 1, 2003
Messages
6
Reaction score
0
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>
</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
548,208
Messages
3,104,802
Members
249,594
Latest member
henrywalsh

Latest Threads

Top