In my application I have to use 2 versions of same XML schema (HL7v3
medical schemas). it worked fine with one version but after generating
the second jar for the new schea version I got this error when
validating my XML with the new jar:
java.lang.NullPointerException
at
org.apache.xmlbeans.impl.validator.Validator.beginEvent(Validator.java:404)
at
org.apache.xmlbeans.impl.validator.Validator.nextEvent(Validator.java:247)
at
org.apache.xmlbeans.impl.store.Validate.emitEvent(Validate.java:172)
at
org.apache.xmlbeans.impl.store.Validate.process(Validate.java:79)
at org.apache.xmlbeans.impl.store.Validate.<init>(Validate.java:39)
at org.apache.xmlbeans.impl.store.Xobj.validate(Xobj.java:1860)
at
org.apache.xmlbeans.impl.values.XmlObjectBase.validate(XmlObjectBase.java:343)
The older jar works fine.
The schema files are quite huge, ~2400 classes were generated per schema
version into the jars.
The XML I'm trying to parse and validate is following:
<PRPA_IN411001UV01 xmlns="urn:hl7-org:v3"></PRPA_IN411001UV01>
(I got the same error with filled XML content)
The schema is something like this:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="urn:hl7-org:v3" xmlns:mif="urn:hl7-org:v3/mif"
targetNamespace="urn:hl7-org:v3" elementFormDefault="qualified">
...
<xs:element name="PRPA_IN411001UV01">
<xs:complexType>
<xs:complexContent>
<xs:extension base="PRPA_IN411001UV01.MCCI_MT000100UV01.Message">
<xs:attribute name="ITSVersion" type="xs:string" use="required"
fixed="XML_1.0"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="PRPA_IN411001UV01.MCCI_MT000100UV01.Message">
<xs:sequence>
<xs:group ref="InfrastructureRootElements"/>
<xs:element name="id" type="II"/>
...
</xs:sequence>
<xs:attributeGroup ref="InfrastructureRootAttributes"/>
</xs:complexType>
...
</xs:schema>
generator config, wich adds namespace, prefix and suffix:
<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config">
<xb:namespace uri="urn:hl7-org:v3">
<xb:package>ee.ut.clinics.ehl.common.schemas.communicator.hl7</xb:package>
<xb:prefix>EhlHL7v1</xb:prefix>
<xb:suffix>_1XB</xb:suffix>
</xb:namespace>
</xb:config>
java code wchich should parse and validate the xml:
EhlHL7v1PRPAIN411001UV01Document_1XB doc2 =
EhlHL7v1PRPAIN411001UV01Document_1XB.Factory.parse(validXML);
return doc2.validate();
The mentioned exception occurs during validating. Looking at the
XMLBeans 2.0.0 source wasn't wery helpful:
assert elementType != null;
if (elementType.isNoType())
If I try to read the content of doc2 I also get a nullpointerException
from generated impl classes.
The same construction worked fine with other similar schemas, but not
with this one.
Maybe the reason is, that the schemas were in the same xml namespace. I
generated classes with different preffixes.
After I combined two schemas and generated one jar everything worked
fine. But it is only a temporary solution - both schemas include some
basic types that have been changed in newer versions.
Has anybody encountered a similar problem or can give me a hint?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]