Hi, Frédéric wrote: >> 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 ? > Good question, I think we've got used to do this way like when we > started two years ago. ;-). Honestly, as I have been working on the source code generation part extensivley (in the last two years), I'd never generate domain classes from an XMl schema and supply a manual mapping.
The descriptors generated by castor's code generator cover a lot of things, incl. all the restrictions as defined within the XML schema and namespace handling. In addition, there's a few features that either cannot be defined at all (using a mapping file), or with a lot more effort (e.g. validators). > I will tke a look at it even if I don't understand why the manual way > does not work. I can still have a look at this, if you wanted me to do so. But i#d rather avoid this .... ;-). It is quite a high load these days, and many of the issues/problems reported are either not trivial or take a lot of time to analyze. > >> 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 >> >> >> > > --------------------------------------------------------------------- > 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

