Okay, first off: how come you are using a mapping file when you have an XML schema at your hands. Castor XML has the source generator (code generator) component, that allows you to generate code (domain classes and descriptor classes) from the XML schema.
Why not use those classes rather than supplying a manual mapping file ? Werner Frédéric wrote: >> Sorry, but I need more information to seriously look at this. How does >> your relevant XML schema fragment look like ? And the corresponding XML >> document ? > Here's a modified (I had to remove few lines, sorry) schema fragment : > <?xml version="1.0" encoding="UTF-8"?> > <xsd:schema > targetNamespace="http://www.mycompany.com/mysoftware" > xmlns="http://http://www.mycompany.com/mysoftware" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > elementFormDefault="qualified" > attributeFormDefault="unqualified"> > > <xsd:element name="ImportVectorToWork"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="OutputFileName" minOccurs="1" > maxOccurs="1"> > <xsd:simpleType> > <xsd:restriction > base="xsd:string"> > <xsd:pattern > value="\w+"></xsd:pattern> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > </xsd:sequence> > <xsd:attribute name="Type" type="enumVectorType" > use="required"></xsd:attribute> > </xsd:complexType> > </xsd:element> > > The XML file : > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> > <ImportVectorToWork Type="Vector1" > xmlns="http://www.mycompany.com/mysoftware"> > <OutputFileName>MyVector1</OutputFileName> > </ImportVectorToWork> > > The mapping file: > <?xml version="1.0" encoding="UTF-8" ?> > <mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns="http://castor.exolab.org/" > xmlns:mysoft="http://www.mycompany.com/mysoftware" > xsi:schemaLocation="http://castor.exolab.org/mapping.xsd"> > > <!-- description>Mapping of the available commands</description--> > <!-- > =================================================================== > --> > <!-- ImportVectorToWork --> > <!-- > =================================================================== --> > > <class name="my.company.xml.command.ImportVectorToWork" > auto-complete="false"> > > <!-- description>Mapping of the ImportVectorToWork > class.</description--> > > <map-to xml="ImportVectorToWork" > ns-uri="http://www.mycompany.com/mysoftware" /> > > <field name="outputFileName" type="string" required="true"> > <bind-xml name="eplf:OutputFileName" node="element"/> > </field> > > <field name="vectorType" type="string" required="true"> > <bind-xml name="eplf:Type" node="attribute"/> > </field> > </class> > </mapping> > > Reading it, I suspect this part (attributeFormDefault="unqualified") > to be wrong. could it be it ? > > Fred >> Werner >> >> Frédéric wrote: >>> Hello, >>> I currently have a problem validating the XML streams I receive. When >>> validation is off, everything is correct but when I turn it on, I >>> receive this exception according to an atribute which is present : >>> org.exolab.castor.xml.MarshalException: ImportVectorToWorkFormat is >>> missing required attribute: Type >>> >>> It's a problem for me as I coded restrictions on the fields and >>> attributes in the XSD >>> and I want them to be checked without having to check them by hand. >>> FYI, I currently use Castor version 1.1.2.1 with Java 1.6 >>> >>> Do you have any idea or clue ? >>> Thanks in advance >>> >>> Fred >>> >>> --------------------------------------------------------------------- >>> 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 >> >> >> > > --------------------------------------------------------------------- > 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

