Hello Radu,

ok. Now I understand what is meant with "qualified".
We get documents that look like

<root>
 <child1>...</child1>
 <child2>...</child2>
 ...
</root>

And with a String operation I change the  <root> to <root xmlns="....">
And I created the schema after analysing the document structure and documentation. I know that this is not the way it should be, but currently we do not have the time and power to discuss this with the document creators.

But thanks for your help and the clarification.
As it is expensive I will omit the validate() operation and catch possible problems with other checks.

Jürgen

Radu Preotiuc-Pietro schrieb:
Well, since validation is a somewhat expensive operation, parse() doesn't do it 
by default, that's why you should call validate() explicitly.

As far as elementFormDefault is concerned, if your partner's document looks 
like:

<ns:root xmlns:ns="....">
  <child1>...</child1>
  <child2>...</child2>
  ...
</ns:root>

then that corresponds to elementFormDefault="unqualified" (or no elementFormDefault at 
all since "unqualified" is the default)

but if the document looks like

<ns:root xmlns:ns="....">
  <ns:child1>...</ns:child1>
  <ns:child2>...</ns:child2>
  ...
</ns:root>

or, equivalently

<root xmlns="....">
  <child1>...</child1>
  <child2>...</child2>
  ...
</root>

then you do need the elementFormDefault="qualified", both to validate the 
document and to make the binding work.

Radu

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 11, 2006 2:56 AM
To: [email protected]
Subject: Re: too generic Object returned

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\BookonTr
a
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]

_______________________________________________________________________
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]

Reply via email to