[jdom-interest] Still more Verification

Elliotte Rusty Harold elharo at metalab.unc.edu
Tue Aug 22 19:47:38 PDT 2000

I've updated my versions of the


classes to support the latest CVS build. These are now ready to be 
merged into the main tree. As well as being based on the most current 
tree, they are a little cleaner than the versions I posted yesterday. 
I removed some redundant code and was more consistent overall.

All setter and add methods now check the contents of these items, not 
just the names. In particular, they check every character of the 
contents to make sure it's legal parsed character data and is not, 
for example, a C0 control character like NUL or form feed. They also 
check, for example, to see that the List passed to setMixedContent 
doesn't contain anything funky like a Frame or a Document instead of 
just the expected types. For example, here's the new Attribute 
setValue() method:

     public void setValue(String value) {
         String reason = Verifier.checkCharacterData(value);
         if (reason != null) {
             throw new IllegalDataException(value, reason);
         this.value = value;

Everything's at http://metalab.unc.edu/xml/jdom/
You can find my changes by grepping for  //^^
I put such a comment in front of every method I changed.

I'm going to take a stab at figuring out how to maintain namespace 
prefixes next.

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |

More information about the jdom-interest mailing list