Migration from J2SE 1.4 to J2SE 5: cannot validate XML file

N

nstanevski

Hello,
I have a code I run on J2SE 1.4 which fails while running on 1.5. Seems
that 1.4 built-in JAXP 1.1 ("Crimson" implementation) conflicts 1.5
built-in JAXP 1.3 ("Xerces" implementation). Following is the snippet
causing the problem:

import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
......
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(true);
try{
DocumentBuilder db = dbf.newDocumentBuilder();
ErrorHandler myErrHnd = new XMLParseErrHandler();
db.setErrorHandler(myErrHnd);
Document doc = db.parse(XMLFile); //EXCEPTION THROWN HERE
.....
}
Exception text is: "The name token is required in the enumerated type
list for the "TransferFunction" attribute declaration".
Here DTD validation fails. Into this DTD "TransferFunction" attribute
is used like that:
<!ATTLIST Layer
TransferFunction %TRANSFERFUNCTION; #IMPLIEDWhere %TRANSFERFUNCTION is enum-ed like that:
<!ENTITY % TRANSFERFUNCTION "(
value_1|
value_2|
...
)">

I would be glad if somebody helps me fix this DTD in order to be
successfully validated in J2SE 5.
Thanks,
-Nikolay
 

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

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top