users@jaxb.java.net

reproducible test case for jaxb-xerces interaction problem

From: Andrew Ferguson <Andrew.Ferguson_at_arm.com>
Date: Wed, 8 Sep 2004 18:24:14 +0100

hi,

 I've got a test case consisting of a single java file, and a single xsd
that is failing to parse a file when I'm pretty certain it should be
able to.

would it be possible to send someone a (6K) zip of this? (you need ANT
to build and run the test)

any help appreciated,
thanks,
Andrew
ps. this is the code used to get the error - but I guess the problem is
specific to my xsd?

public class JAXBTest {
        public static void main(String[] arg) throws Exception {
                boolean validating = true;
                
                JAXBContext jc = JAXBContext.newInstance(
"com.arm.dragonfly.wh.jaxb.wxml", JAXBTest.class.getClassLoader());
                
                Unmarshaller u = jc.createUnmarshaller();
                u.setValidating(true);
                
                SAXParserFactory spf = SAXParserFactory.newInstance();
                spf.setValidating(validating);
                SAXParser saxParser = spf.newSAXParser();

                XMLReader xmlReader = saxParser.getXMLReader();
                System.out.println(xmlReader.getClass().getName());

                try {
        
xmlReader.setFeature("http://apache.org/xml/features/validation/schema",
validating);
                } catch(SAXException se) {
                        se.printStackTrace();
                }

                try {
        
xmlReader.setFeature("http://apache.org/xml/features/validation/dynamic"
, validating);
                } catch(SAXException se) {
                        se.printStackTrace();
                }

                FileInputStream fis = new FileInputStream(arg[0]);
                SAXSource source = new SAXSource( xmlReader, new
InputSource(fis) );
                Object result = u.unmarshal(source); // throws
"javax.xml.bind.UnmarshalException: Unexpected end of element {}:VAR"
                
                fis.close();
        }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net