Werner Guttmann wrote:

But let's try to get yourself going first. Can you please rewrite your
code as follows:

XMLContext context = new XMLContext();
context.setProperty(XMLConfiguration.LENIENT_ID_VALIDATION, true);
Unmarshaller u = context.createUnmarshaller();
u.setRoot(aClass);

u.setRoot did not work for me--I had to use u.setClass. Is that correct? Also, I think I had the wrong configuration key (ENIENT_ID_VALIDATION vs LENIENT_SEQUENCE_ORDER). My code now looks like this:

XMLContext context = new XMLContext();
context.setProperty(XMLConfiguration.LENIENT_SEQUENCE_ORDER, true);
Unmarshaller u = context.createUnmarshaller();
u.setClass(aClass);
Object foo = u.unmarshal(reader);

How does that sound?

Using the code above, I got past the validation error, but now got:

java.lang.NoClassDefFoundError: org/apache/oro/text/regex/MalformedPatternException
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:164)
at org.castor.xml.AbstractInternalContext.getRegExpEvaluator(AbstractInternalContext.java:325) at org.exolab.castor.xml.validators.PatternValidator.initEvaluator(PatternValidator.java:262) at org.exolab.castor.xml.validators.PatternValidator.validate(PatternValidator.java:200) at org.exolab.castor.xml.validators.StringValidator.validate(StringValidator.java:302) at org.exolab.castor.xml.validators.StringValidator.validate(StringValidator.java:340) at org.exolab.castor.xml.FieldValidator.validateInstance(FieldValidator.java:324)
        at 
org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:271)
at org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:1072) at org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:910) at org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:910)
        at org.exolab.castor.xml.Validator.validate(Validator.java:135)
at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:915) at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:1159)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown 
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)


Per this message:

http://osdir.com/ml/java.castor.user/2005-01/msg00018.html

I suppose I need to get apache oro as a dependency, so I'll give that a try.

Thanks for your help.

Alex

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to