users@jaxb.java.net

Re: jaxb binding string issue

From: pravs <praveenseepathi_at_gmail.com>
Date: Thu, 4 Mar 2010 04:33:44 -0800 (PST)

xml schema is

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
  <xs:element name="GEODS">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="REQUEST"/>
      </xs:sequence>
      <xs:attribute name="cid" use="required" type="xs:NMTOKEN"/>
      <xs:attribute name="spe" use="required" type="xs:NCName"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="REQUEST">
    <xs:complexType>
      <xs:sequence>
        
        <xs:element ref="MB"/>
      </xs:sequence>
      <xs:attribute name="Ref" use="required"/>
      <xs:attribute name="id" use="required" type="xs:NMTOKEN"/>
      <xs:attribute name="subtype" use="required" type="xs:NCName"/>
      <xs:attribute name="success" use="required" type="xs:NCName"/>
      <xs:attribute name="timestamp" use="required"/>
      <xs:attribute name="type" use="required" type="xs:NCName"/>
    </xs:complexType>
  </xs:element>
 
  <xs:element name="MB">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="CODE"/>
      </xs:sequence>
      <xs:attribute name="seq" use="required" type="xs:integer"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="CODE" type="xs:string" />
</xs:schema>

sample xml file
  <?xml version="1.0" standalone="yes" ?>
- <GEODS cid="ggh">
- <REQUEST type="RETURN" subtype="CR"Ref="" success="Y" timestamp="Thu, 4
Mar 2010 at 12:29 PM" id="fM">
 <MB12 seq="01">
  <CODE>VWTR2512S8VDTM2 1 L</CODE>
  </MB>
  </REQUEST>
  </GEODS>

and java code is

final GEODS aerodrome = (GEODS) u.unmarshal(url);// hp);
                        final REQUEST request = aerodrome.getREQUEST();
                        final MB12 mb12 = request.getMB();
Summary summary = new Summary();
summary.setCapCode(mb12.getCAPCODE());

help will be appreciated, do i have to set type in xsd as something
else(other than string), plz advise

thanks,
pravs


Wolfgang Laun-2 wrote:
>
> You'll have to provide more details:
> XML schema or Java class
> sample XML file
> Java code
>
> -W
>
> On Wed, Mar 3, 2010 at 8:23 PM, pravs <praveenseepathi_at_gmail.com> wrote:
>
>>
>> i have a string with following format "xxxxx 1 L" with one space in xml
>> after
>> number 1. I am using jaxb unmarshal method to read xml. but after
>> unmarshal
>> one space after intger 1 in string is converted into two spaces , please
>> suggest me how to overcome this problem. i need to read xml as it is ,
>> without any modifications. do i have to do any settings
>> --
>> View this message in context:
>> http://old.nabble.com/jaxb-binding-string-issue-tp27772534p27772534.html
>> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
>

-- 
View this message in context: http://old.nabble.com/jaxb-binding-string-issue-tp27772534p27780162.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.