|
Re: NPE during schema validation [message #45501 is a reply to message #45440] |
Tue, 25 May 2004 15:27 |
Eclipse User |
|
|
|
Originally posted by: user.domain.invalid
you have not declared a type in <element name="CA"
substitutionGroup="xsd1:CA2" abstract="false"
final="#all"/> so anyType is assumed. however, the type must be
the type or a subtype of the head of the substitution group and that
type is type="xsd1:CAType" by reference to CA3. anyType is a supertype,
not a subtype, of xsd1:CAType so the schema is not valid.
norwood sisson
me@me.com wrote:
> I'm putting together some testcases for an XSD based project I'm working
> on when I hit a NullPointerException validating a somewhat contrived
> schema. I'm not even certain that the schema is valid, but if it isn't I
> would have thought that there would be a more meaningful diagnostic than
> an NPE so I figured I'd raise it with you guys to see what you think.
>
> Here's my schema:
>
> <schema targetNamespace="http://com/schemas/ACTDIInterface"
> xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:xsd1="http://com/schemas/ACTDIInterface">
> <complexType name="CAType">
> <sequence>
> <element name="el1" type="xsd1:typeRef"/>
> </sequence>
> </complexType>
> <simpleType name="typeRef">
> <restriction base="string"/>
> </simpleType>
> <element name="CA" substitutionGroup="xsd1:CA2" abstract="false"
> final="#all"/>
> <element name="CA2" ref="xsd1:CA3" abstract="false" />
> <element name="CA3" type="xsd1:CAType" abstract="false" />
> </schema>
>
> The problem seems to be related to element CA which has a
> substitutionGroup of CA2 which in turn references CA3. This may be an
> illegal scenario for all I know.
>
> Here is the exception stack trace:
>
> java.lang.NullPointerException
> at
> org.eclipse.xsd.impl.XSDElementDeclarationImpl.validate(XSDE lementDeclarationImpl.java:1016)
>
> at
> org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteComponentImpl.java:541)
>
> at org.eclipse.xsd.impl.XSDSchemaImpl.validate(XSDSchemaImpl.ja va:1493)
> at ...
>
>
>
> Paul.
|
|
|
Re: NPE during schema validation [message #45530 is a reply to message #45501] |
Tue, 25 May 2004 15:41 |
Eclipse User |
|
|
|
Originally posted by: NOpcooperSPAM.uk.ibm.com
Ok, that sounds convincing. Thanks for the fast response.
I do think if it would be better for this error scenario to be reported
either as a diagnostic or as a more meaningful exception rather than as
a NullPointerException. I've managed to code a whole load of erroneous
schemas so far but this is the first time I've had an NPE out of the XSD
validation code.
If the schema is at fault then, as a general rule, I like to be able to
return some kind of vaguely meaningful message to the user. In this
scenario all I can really do is report that schema validation failed.
Thanks.
Paul.
|
|
|
Re: NPE during schema validation [message #45560 is a reply to message #45530] |
Tue, 25 May 2004 16:13 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Paul,
It should't produce an NPE. Please open a bugzilla for your sample schema.
Paul Cooper wrote:
> Ok, that sounds convincing. Thanks for the fast response.
>
> I do think if it would be better for this error scenario to be reported
> either as a diagnostic or as a more meaningful exception rather than as
> a NullPointerException. I've managed to code a whole load of erroneous
> schemas so far but this is the first time I've had an NPE out of the XSD
> validation code.
>
> If the schema is at fault then, as a general rule, I like to be able to
> return some kind of vaguely meaningful message to the user. In this
> scenario all I can really do is report that schema validation failed.
>
> Thanks.
>
> Paul.
|
|
|
Re: NPE during schema validation [message #45648 is a reply to message #45560] |
Tue, 25 May 2004 17:04 |
Eclipse User |
|
|
|
Originally posted by: NOpcooperSPAM.uk.ibm.com
I've opened Bug Report 63916.
Thanks.
Ed Merks wrote:
> Paul,
>
> It should't produce an NPE. Please open a bugzilla for your sample schema.
>
>
> Paul Cooper wrote:
>
>
>>Ok, that sounds convincing. Thanks for the fast response.
>>
>>I do think if it would be better for this error scenario to be reported
>>either as a diagnostic or as a more meaningful exception rather than as
>>a NullPointerException. I've managed to code a whole load of erroneous
>>schemas so far but this is the first time I've had an NPE out of the XSD
>>validation code.
>>
>>If the schema is at fault then, as a general rule, I like to be able to
>>return some kind of vaguely meaningful message to the user. In this
>>scenario all I can really do is report that schema validation failed.
>>
>>Thanks.
>>
>>Paul.
>
>
|
|
|
|
|
Re: NPE during schema validation [message #587547 is a reply to message #45530] |
Tue, 25 May 2004 16:13 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Paul,
It should't produce an NPE. Please open a bugzilla for your sample schema.
Paul Cooper wrote:
> Ok, that sounds convincing. Thanks for the fast response.
>
> I do think if it would be better for this error scenario to be reported
> either as a diagnostic or as a more meaningful exception rather than as
> a NullPointerException. I've managed to code a whole load of erroneous
> schemas so far but this is the first time I've had an NPE out of the XSD
> validation code.
>
> If the schema is at fault then, as a general rule, I like to be able to
> return some kind of vaguely meaningful message to the user. In this
> scenario all I can really do is report that schema validation failed.
>
> Thanks.
>
> Paul.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03886 seconds