Hello Radu,
root.validate() yields true with elementFormDefault="qualified" in the
schema.
root.validate() yields false without elementFormDefault="qualified".
I am not quite sure what this means in respect of the XML documents we
get from our partners.
They are of very simple structure. When I look at them they seem to be
valid XML but maybe not valid according to the schema.
But another question arises:
Should not the parse() method throw a sort of
document-not-valid-exception instead of just giving the impression that
everything is allright?
Or do I miss something here?
Jürgen
Radu Preotiuc-Pietro schrieb:
Can you call '.validate()' on the root object and see if there are any errors? I suspect
this to be the "elementFormDefault" problem...
Radu
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 06, 2006 6:09 AM
To: [email protected]
Subject: Re: too generic Object returned
Hello,
I resolved this problem.
In the Schema I had to change the schema tag to
<xs:schema targetNamespace="http://bookon.de/lmweb/regionlist"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:bo="http://bookon.de/lmweb/regionlist">
adding the namespace http://bookon.de/lmweb/regionlist And originally I did not
specify any type for the element ZIEL I changed this to
<xs:element name="ZIEL" type="bo:ZIEL" minOccurs="0" maxOccurs="unbounded"/>
and now this is as expected. The 'ant test' goal runs without any error message.
But... the next problem is at hand.
The testprogramm (modfied SchemaEnumTest started through 'ant test') reads in a
sample xml File with the right namespace.
And all getter methods return null. Trying to access the very first element in
the document does not throw an exception, but returns a null reference.
The 'ant run' goal works perfectly reading in the sample xml File and passing
it back out via tostring().
So I assume that the sample xml file is ok.
Has anybody encountered something similar?
I suspect it to be something really simple, but can't see it.
Thanks for your help,
Jürgen
Jürgen Hoffmann schrieb:
Hello,
get an "incompatible types" error which I am now hunting for a few hours, but
can't resolve.
I installed xmlbeans-2.1.0 and tried the SchemaEnum sample. It works perfectly.
Then I copied the SchemaEnum sample to a new folder in the samples folder and
started modifying it piece by piece.
And now I get this "incompatible types" error.
[javac]
C:\Programme\ApacheSoftwareFoundation\xmlbeans-2.1.0\samples\BookonTra
velIt\src\de\bookon\travelit\BookonTravelItTest.java:50: incompatible
types
found : org.apache.xmlbeans.XmlObject[]
required: de.bookon.lmweb.regionlist.ZIEL[]
ZIEL[] ziele = root.getZIELArray();
I looked in the created sources folder and found that the method getZIELArray()
is indeed created returning such a generic object:
org.apache.xmlbeans.XmlObject[].
When I compare this to the enumeration sample there a comparable
method is the getLineItemArray() which returns a
org.apache.xmlbeans.samples.enumeration.schemaenum.easypo.LineItem[]
and not such a generic object like org.apache.xmlbeans.XmlObject[]
Where can I influence this?
The getZIELArray() method should return an object of type
de.bookon.lmweb.regionlist.ZIEL[] as the compiler rightful says.
The Schema starts with
<?xml version="1.0" encoding="ISO-8859-1"?> <xs:schema
targetNamespace="http://bookon.de/lmweb/regionlist"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
Thanks for your help,
Jürgen
_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]