Jennifer,

it more looks like a bug to me, to be honest. Cany ou please create a
new Jira issue at

http://jira.codehaus.org/browse/CASTOR

and attach all relevant information to it, including XML schema files,
XML sample document(s), ....

Thanks in advance
Werner

Jennifer Thorsley wrote:
> Hi Werner,
> 
> Thank you for answering. It's a first time problem. What the result we
> get from castor:
> 
>   <?xml version="1.0" encoding="UTF-8"?> <probe>
>       <ip>1.1.1.2</ip>
>       <ss7card xml-ss7-card-count="2" valid="true"
>  xml-gb-card-count="0">
>               <xml-ss7-card valid="true">
>                       <ip>1.1.1.1</ip>
>               </xml-ss7-card>
>               <xml-ss7-card valid="true">
>                       <ip>1.1.1.3</ip>
>               </xml-ss7-card>
>       </ss7card>
>  </probe>
> 
> Does not validate with the original xsd. The result we are trying to
> achieve does:
> 
>  <?xml version="1.0" encoding="UTF-8"?> <probe>
>       <ip>1.1.1.2</ip>
>       <ss7card>
>               <ip>1.1.1.1</ip>
>       </ss7card >
>       <ss7card>
>               <ip>1.1.1.3</ip>
>       </ss7card >
>  </probe>
> 
> I think it is common that xsd:group elements do not have a tag
> representation in the xml. I've tried some work arounds like declaring
> the xsd:group (Card) as transient in a mapping file, but then all
> subgroups are hidden too. Is there possibly some solution using a
> mapping file?
> 
> Thank you,
> Jennifer
> 
> -----Original Message-----
> From: Werner Guttmann [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, 13. June, 2007 11:51
> To: [email protected]
> Subject: Re: [castor-user] suppress xsd:choice in xml
> 
> Not sure. Is this a first time problem, or is this a result of e.g.
> upgrading to a newer Castor version ?
> 
> Werner
> 
> Jennifer Thorsley wrote:
>>  
>> Hello,
>>
>> We are having a problem with xml generation using castor.
>>
>> We have a schema which declares a choice within a group (sorry about 
>> the
>> formatting):
>>
>> <?xml version="1.0" encoding="UTF-8"?> <xsd:schema 
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
>>      <!-- Probe -->
>>      <xsd:element name="probe">
>>              <xsd:complexType>
>>                      <xsd:sequence>
>>                              <xsd:element name="ip"
>> type="xsd:string"/>
>>                              <xsd:group ref="Card"/>
>>                      </xsd:sequence>
>>              </xsd:complexType>
>>      </xsd:element>
>>      <xsd:group name="Card">
>>              <xsd:choice>
>>                      <xsd:element ref="ss7card"
>> maxOccurs="unbounded"/>
>>                      <xsd:element ref="gbcard"
>> maxOccurs="unbounded"/>
>>              </xsd:choice>
>>      </xsd:group>
>>      <!-- SS7Card -->
>>      <xsd:element name="ss7card">
>>              <xsd:complexType>
>>                      <xsd:sequence>
>>                              <xsd:element name="ip"
>> type="xsd:string"/>
>>                      </xsd:sequence>
>>              </xsd:complexType>
>>      </xsd:element>
>>      <!-- GbCard -->
>>      <xsd:element name="gbcard">
>>              <xsd:complexType>
>>                      <xsd:sequence>
>>                              <xsd:element name="location"
>> type="xsd:string"/>
>>                      </xsd:sequence>
>>              </xsd:complexType>
>>      </xsd:element>
>> </xsd:schema>
>>
>> Source is generated from the xsd. 
>> A with a marshalling done (try/catch removed for brevity):
>>
>>        XmlProbe xmlProbe = new XmlProbe();
>>       xmlProbe.setIp("1.1.1.2");
>>        XmlCard xmlCard = new XmlCard();
>>        
>>      
>>        XmlSs7Card xmlSs7Card = new XmlSs7Card();
>>        xmlSs7Card.setIp("1.1.1.1");
>>        
>>
>>        XmlSs7Card xmlSs7Card2 = new XmlSs7Card();
>>        xmlSs7Card2.setIp("1.1.1.3");
>>        
>>      
>>        xmlCard.setXmlSs7Card(new
> XmlSs7Card[]{xmlSs7Card,xmlSs7Card2});
>>        xmlProbe.setXmlCard(xmlCard);
>>      
>>      Mapping map = new Mapping();
>>      map.loadMapping(Files.getCastorMappingFileUrl());
>>      BufferedWriter writer = new BufferedWriter(
>>      new FileWriter(Files.getOutputFile()));
>>      Marshaller marshaller = new Marshaller(writer);
>>      marshaller.setMapping(map);
>>      marshaller.marshal(xmlProbe);
>>
>>
>> A resulting xml is produced:
>>
>> <?xml version="1.0" encoding="UTF-8"?> <probe>
>>      <ip>1.1.1.2</ip>
>>      <ss7card xml-ss7-card-count="2" valid="true"
>> xml-gb-card-count="0">
>>              <xml-ss7-card valid="true">
>>                      <ip>1.1.1.1</ip>
>>              </xml-ss7-card>
>>              <xml-ss7-card valid="true">
>>                      <ip>1.1.1.3</ip>
>>              </xml-ss7-card>
>>      </ss7card>
>> </probe>
>>
>> However we would like a result that looks:
>>
>> <?xml version="1.0" encoding="UTF-8"?> <probe>
>>      <ip>1.1.1.2</ip>
>>      <ss7card>
>>              <ip>1.1.1.1</ip>
>>      </ss7card >
>>      <ss7card>
>>              <ip>1.1.1.3</ip>
>>      </ss7card >
>> </probe>
>>
>> Here the choice is suppressed (hidden) in the result. Is there anyway 
>> to achieve this?
>>
>> Thank you,
>> Jennifer
>>
>>         
>> Jennifer Thorsley
>> Software Engineer
>> ________________________________
>>
>> Nexus Telecom AG
>> Wireless Network Systems
>> Muertschenstrasse 27
>> P.O. Box 1413
>> CH-8048 Zurich
>> Switzerland
>>
>>
>> Email: [EMAIL PROTECTED]
>> Website:   www.nexustelecom.com 
>>  
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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

Reply via email to