Hi all,

        I've generated code using Castor to read my xml files.  The code
generation part went fine, and all the code compiles and so on.
Unfortunately when I try to unmarshal data from the file I get:


org.exolab.castor.xml.MarshalException: The following exception occured
while validating field: _objects of class:
ca.gc.drdc_rddc.atlantic.mc2cd.fomreader2.ObjectModel: The following
exception occured while validating field: _objectClassList of class:
ca.gc.drdc_rddc.atlantic.mc2cd.fomreader2.Objects: The following
exception occured while validating field: _attributeList of class:
ca.gc.drdc_rddc.atlantic.mc2cd.fomreader2.ObjectClass: The following
exception occured while validating field: _name of class:
ca.gc.drdc_rddc.atlantic.mc2cd.fomreader2.Attribute:
HLAprivilegeToDeleteObjectdoes not match the required regular
expression: "[\w-._:]+"{File: [not available]; line: 4823; column: 15}

Now, I should tell you that the structure of my XML files is that there
is a top level element called "ObjectModel" that contains lots of other
elements.  What I tried to do that generated that error is this (I've
omitted the try-catch for clarity):

                FileReader reader;
                ObjectModel om = null;

                reader = new FileReader(".\\xml\\rpr2-d18.xml");
                om = ObjectModel.unmarshal(reader);

I did download the Castor source and I stepped through to find the line
that causes the problem.  It exception seems to be thrown in line 748 of
org.castor.xml.Unmarshaller which is:

                parser.parse(source);

When I examine the value of "source" I see that it is an instance of:

                org.xml.sax.InputSource

While parser is an instance of:

                com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl

I did some playing around with my xml file and found that the problem
seems to centre around one particular XML element in my files, for the
error message I've attached it's this one:

                <attribute name="HLAprivilegeToDeleteObject"/>

This particular instance of <attribute/> is always the first one in any
of my files.  I tried removing it just to see what would happen, and the
same error is generated on the next one in the file, i.e. the first one
the parser encounters.

So, any idea what I can do to fix this?  Altering my schema is NOT an
option as it's part of an IEEE standard and I must be able to use it.

-Allan

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

    http://xircles.codehaus.org/manage_email


Reply via email to