Hi,
a few observations:
* Castor does not perform XML schema validation upon unmarshalling as
you'd expect (e.g. using JAXP schema validation).
* Castor should still be able to unmarshal your XML.
If you really wanted validation upon unmarshalling, please consider
using POJOs from your XML schema using Castor's source generator, and
you'll get that validation as part of the descriptor classes generated.
Kind regards
Werner Guttmann
On 21.08.2012 11:01, Małgorzata Wolniewicz wrote:
------ Wiadomość oryginalna ------
Temat: Problem with unmarshalling if xml file contains information
about xsd
Data: Tue, 21 Aug 2012 10:44:54 +0200
Nadawca: Małgorzata Wolniewicz <[email protected]>
Odpowiedź-Do: Małgorzata Wolniewicz <[email protected]>
Firma/Organizacja: Poznań Supercomputing and Networking Center
Adresat: [email protected]
Dear Castor users,
I have encountered problem, which seems to be trivial, anyway I have no
idea how to solve it.
I created the simplest example I could. I want to have an xml file,
based on rules defined by my xsd schema, and a java client which will
perform unmarshalling.
My client works if the xml looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<person pesel="12345"
>
<firstname>Gosia</firstname>
<lastname>Wolniewicz</lastname>
<address>My address</address>
<children>
<child>
<data name="Kid1" age="8.0"/>
</child>
<child>
<data name="Kid2" age="4.5"/>
</child>
</children>
</person>
But I would like to include in my xml information which xsd defines it,
but when I add it my client stops working. It does not crash, but data
is not unmarshalled properly. My object has empty fields.
With schema information begin of my xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<person pesel="12345"
xmlns="http://www.example.org/Person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org/Person Person.xsd"
>
...
I enclose my xml (with and without the header), my client and my xsd. I
would be grateful if anyone could suggest how to solve the problem.
Best regards,
Gosia Wolniewicz
--
Małgorzata Wolniewicz
Poznań Supercomputing and Networking Center
Scientific Applications Department
email:[email protected]
www:http://www.man.poznan.pl
skype: gosiawolniewicz
tel. +48 61 858-21-74
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email