Great. Now let me ask you a question: given that his problem seems to occur again and again (despite having a FAQ entry et alias), how would you feel about giving us some of your time and create a new HOW-TO ?
Werner Wells, Richard wrote: > Werner > > That seems to be the issue. For some reason I did not add those to the > project. Adding them in seems to have taken care of it. > > Thanks > Rick > > -----Original Message----- > From: Werner Guttmann [mailto:[EMAIL PROTECTED] > Sent: Thursday, May 22, 2008 4:32 PM > To: [email protected] > Subject: Re: [castor-user] [XML] problems trying to implement Castor > > Richard, > > when you generated Java sources from your XML schema, the code generator > generated two sets of classes: > > a) your domain classes (as outlined below) > b) descriptor classes. > > Did you package the latter ones as well with your application ? It looks > to me like this might not be the case. > > Regards > Werner > > PS Why not try to marshal useful XML from a sample object instance ? > Usually this indicates if something is wrong with e.g. configuration, > missing descriptor classes, .... > > Wells, Richard wrote: >> I am trying to implement Castor to put XML requests into a Java > object. >> On a very simple input request, I was able to make it work, but I have >> an issue now with moderately more complex ones. >> >> I used the source generator tool to create classes from a schema file >> for the request. The XML request itself looks like this. >> >> <GetAccountBalancesRequest> >> <MSSTInd>false</MSSTInd> >> <Accounts> >> <Account> >> <AcctNo>X10152382</AcctNo> >> <CESGInd>false</CESGInd> >> </Account> >> <Account> >> <AcctNo>X10625310</AcctNo> >> <CESGInd>false</CESGInd> >> </Account> >> </Accounts> >> </GetAccountBalancesRequest> >> >> The Schema for that looks like this. >> >> <?xml version="1.0" encoding="UTF-8"?> >> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> >> <xsd:element name="CESGInd" type="xsd:string"/> >> <xsd:element name="GetAccountBalancesRequest"> >> <xsd:complexType> >> <xsd:sequence> >> <xsd:element ref="MSSTInd"/> >> <xsd:element ref="Accounts"/> >> </xsd:sequence> >> </xsd:complexType> >> </xsd:element> >> <xsd:element name="AcctNo" type="xsd:string"/> >> <xsd:element name="MSSTInd" type="xsd:string"/> >> <xsd:element name="Account"> >> <xsd:complexType> >> <xsd:sequence> >> <xsd:element ref="AcctNo"/> >> <xsd:element ref="CESGInd"/> >> </xsd:sequence> >> </xsd:complexType> >> </xsd:element> >> <xsd:element name="Accounts"> >> <xsd:complexType> >> <xsd:sequence> >> <xsd:element maxOccurs="unbounded" ref="Account"/> >> </xsd:sequence> >> </xsd:complexType> >> </xsd:element> >> </xsd:schema> >> >> I ran the SourceGenerator to create the classes, and ended up with an >> Account, Accounts, and GetAccountBalancesRequest java files. >> >> I put those in place in my code, and run it something like this. >> >> GetAccountBalancesRequest inputRequest = new >> GetAccountBalancesRequest(); >> inputRequest= GetAccountBalancesRequest.unmarshal(new >> StringReader(xmltmp)); >> >> When I do that, and look at the contents of inputRequest, the MSSTInd >> field is populated ok, but the accounts are null. It seems it's doing > on >> with the simple elements, but not properly dealing with the complex >> elements. >> >> Anyone do anything similar, and run into these issues? Something else > I >> should be doing here that I'm missing? This is my first try at using >> Castor like this. >> >> --------------------------------------------------------------------- >> 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

