Stephen:

I am using the latest M2 version castor-1.0M2.jar.

I can try to produce the XML snippit you need, I have validated the file
against the schema and it is valid. I did notice that there are similar
problems with other group usage. I am first going to try to turn on the
generation of imported schemas. The group that I am looking at is in an
imported schema that is in a different namespace and generated
separately into a different package. This may work and then perhaps it
is related to the location of the schemas. See the blow list of
nxpackages that I am using:

org.exolab.castor.builder.nspackages=\
http://www.nortel.com/SCE/sceApplication=com.nortel.schema.code.applicat
ion.sceApplication,\
http://www.nortel.com/SCE/sceContainer=com.nortel.schema.code.applicatio
n.sceContainer,\
http://www.nortel.com/SCE/sceShared=com.nortel.schema.code.sceShared,\
http://www.nortel.com/SCE/sceBlock=com.nortel.schema.code.application.sc
eBlock,\
http://www.nortel.com/SCE/sceBlockConfigs=com.nortel.schema.code.Data.sc
eBlockConfigs,\
http://www.nortel.com/SCE/sceCallDetailRecords=com.nortel.schema.code.Da
ta.sceCallDetailRecords,\
http://www.nortel.com/SCE/sceAlarmsNLogs=com.nortel.schema.code.Data.sce
AlarmsNLogs,\
http://www.nortel.com/SCE/sceApplicationSettings=com.nortel.schema.code.
Data.sceApplicationSettings,\
http://www.nortel.com/SCE/sceGrammars=com.nortel.schema.code.Data.sceGra
mmars,\
http://www.nortel.com/SCE/scePrompts=com.nortel.schema.code.Data.sceProm
pts,\
http://www.nortel.com/SCE/sceProperties=com.nortel.schema.code.Data.sceP
roperties,\
http://www.nortel.com/SCE/sceGroupss=com.nortel.schema.code.Data.sceGrou
ps,\
http://www.nortel.com/SCE/sceStatistics=com.nortel.schema.code.Data.sceS
tatistics,\
http://www.nortel.com/SCE/sceVariables=com.nortel.schema.code.Data.sceVa
riables,
http://www.nortel.com/SCE/sceJava=com.nortel.schema.code.Data.sceJava

Thanks,
Barbara

-----Original Message-----
From: Stephen Bash [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 03, 2006 12:39 PM
To: [email protected]
Subject: Re: [castor-user] mapping and binding

Barbara-

What version of Castor are you using?  I don't know much about the
SourceGeneration side, but with the correct version of Castor I might
be able to look at the stack trace and figure out what is happening. 
Next question, can you produce the XML snippet you mentioned from
marshalling?  I'll try to look into it and see if I can glean any
information from the stack trace.

Stephen


On 3/3/06, Barbara Prechtl <[EMAIL PROTECTED]> wrote:
> Stephan:
>
> Thanks for your help. I did get the Java objects to marshall without
the
> use of a mapping file.
>
> I am now having problems with the unmarshalling of documents that use
> elements that are of a group type. For instance I have defined in my
> schema a description group as follows:
>
>         <xsd:group name="DescriptionGroup">
>                 <xsd:sequence>
>                         <xsd:element name="description"
> type="xsd:string" minOccurs="0" maxOccurs="1"/>
>                 </xsd:sequence>
>         </xsd:group>
>
> This is used in my NodeType definition:
>
> <xsd:complexType name="NodeType">
>                 <xsd:sequence>
>                         <xsd:group
> ref="shr:DescriptionGroup"></xsd:group>
>                 </xsd:sequence>
> </xsd:complexType>
>
>
> When in my instance document I have the description the unmarshalling
> throws an exception.
>
> <node>
>         <description> comment </description>
> </node>
>
> When I create the classes with the source generator I use the
following
> flags:
>
> generateMappingFiles=true
> createMarshalMethods=true
> GenerateImportedSchemas=false
> Validation=true
>
> I am getting an error every time I try to use the description element
in
> a document. I have noticed that this happens with other group types.
> Does group unmarshalling work?
>
> Thanks,
> Barbara
>
> The error I get is as follows:
>
> Error occurred in read. Target Exception is::
> org.exolab.castor.xml.MarshalException : null
> null{file: [not available]; line: 64; column: 18}
>         at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:669)
>         at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:563)
>         at
>
com.nortel.sce.xml.utils.XmlToJava.readXMLinstanceToObject(XmlToJava.jav
> a:143)
>         at
> com.nortel.sce.xml.utils.XmlUtils.unmarshallXML(XmlUtils.java:89)
>         at
> com.nortel.sce.model.ContainerData.read(ContainerData.java:109)
>         at
> com.nortel.sce.model.ContainerData.<init>(ContainerData.java:52)
>         at
>
com.nortel.sce.model.ApplicationData.getContainerByName(ApplicationData.
> java:135)
>         at com.nortel.sce.model.ModelData.main(ModelData.java:273)
> Caused by: java.lang.NullPointerException
>         at
>
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.jav
> a:1994)
>         at
>
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.jav
> a:1375)
>         at
> org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1376)
>         at
>
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLVal
> idator.java:1214)
>         at
>
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatc
> h(XMLDocumentScanner.java:1171)
>         at
>
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScan
> ner.java:381)
>         at
> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
>         at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:655)
>
>
>
>
> -----Original Message-----
> From: Stephen Bash [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 03, 2006 8:30 AM
> To: [email protected]
> Subject: Re: [castor-user] mapping and binding
>
> Barbara-
>
> I'm not much of an expert on the binding-file side, but I use mapping
> files all the time.  The short answer is no, you don't need both, but
> yes, they both describe Java object <-> XML relations.
>
> In general, I believe, the binding file is used to create Java code
> (that can then be compiled and used in an application) from an XML
> Schema.  The binding file is most often (only?) used with the Castor
> SourceGenerator, which creates Java classes that model an XML schema,
> at which point Castor also creates extra classes (ClassDescriptors and
> FieldDescriptors) that describe how the Java objects "map" to XML.
>
> The mapping file provides an alternate method for the user to specify
> how Java objects transform into XML content.  I tend to think of this
> as how one starts with a Java object model and then creates the XML
> structure from it, but it is much more flexible than that.
>
> Where the two methods somewhat meet is the
> ClassDescriptor/FieldDescriptor level.  When a user loads a mapping,
> Castor reads the mapping file and internally creates the appropriate
> descriptors.  If the SourceGenerator was used, the descriptors exist
> as compiled classes and are instantiated as they are needed (thus the
> mapping file usually isn't required).
>
> That might be more information than you needed, but hopefully it
> answers the question.  Let us know if you have further questions.
>
> Stephen
>
> On 3/3/06, Barbara Prechtl <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > To whom it may concern:
> >
> >
> >
> > I was wondering what the difference between a mapping file and a
> binding
> > file is.
> >
> >
> >
> > Is this correct:
> >
> >
> >
> > A mapping file is used for writing java objects to xml.
> >
> > A binding file is used to read xml to java objects.
> >
> >
> >
> > They both seem to describe the element to object relation. Are both
> needed?
> >
> >
> >
> > Thanks,
> >
> > Barbara
>
> -------------------------------------------------
> If you wish to unsubscribe from this list, please
> send an empty message to the following address:
>
> [EMAIL PROTECTED]
> -------------------------------------------------
>
>

-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to