njmuni . | 28 Aug 02:58 2013
Picon

Getting expected start tag error when unmarshalling unformatted xml

I'm getting this error:

Exception in thread "main" org.jibx.runtime.JiBXException: Expected
"Ogz" start tag, found "OgzNr" start tag (line 1, col 38)
	at org.jibx.runtime.impl.UnmarshallingContext.throwStartTagNameError(UnmarshallingContext.java:220)
	at org.jibx.runtime.impl.UnmarshallingContext.matchStart(UnmarshallingContext.java:644)
	at org.jibx.runtime.impl.UnmarshallingContext.parsePastStartTag(UnmarshallingContext.java:680)
	at com.ups.ops.gio.vo.GioOgzVo.JiBX_binding_unmarshal_1_0(GioOgzVo.java)
	at com.ups.ops.gio.vo.JiBX_bindingGioOgzVo_access.unmarshal()
	at com.ups.ops.gio.vo.GioCurLocGrpVo.JiBX_binding_unmarshal_1_0(GioCurLocGrpVo.java)
	at com.ups.ops.gio.vo.GioShuCompositeVo.JiBX_binding_unmarshal_1_0(GioShuCompositeVo.java)
	at com.ups.ops.gio.vo.JiBX_bindingGioShuCompositeVo_access.unmarshal()
	at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2757)
	at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2914)

When I try to unmarshal this XML (all one line):

<UpsBasDb><CurLocGrp><Loc><Ogz><OgzNr>3229</OgzNr><Cny><CnyCd>US</CnyCd></Cny></Ogz></Loc><Ts>2012-09-28T00:20:32.000-04:00</Ts></CurLocGrp></UpsBasDb>

However, if I pass the same XML formatted with newlines, it works!

<UpsBasDb>
   <CurLocGrp>
      <Loc>
         <Ogz>
            <OgzNr>3229</OgzNr>
            <Cny>
               <CnyCd>US</CnyCd>
            </Cny>
         </Ogz>
(Continue reading)

Archie Cobbs | 28 Aug 03:24 2013

Re: Getting expected start tag error when unmarshalling unformatted xml

I have no idea what is wrong, but that is weird.

Just out of curiosity, I wonder if it has to do with the fact that Ogz is a prefix of OgzNr ?

Try the same test with "OgzNr" replaced with "Foo"...

-Archie


On Tue, Aug 27, 2013 at 7:58 PM, njmuni . <limowrck <at> gmail.com> wrote:
I'm getting this error:

Exception in thread "main" org.jibx.runtime.JiBXException: Expected
"Ogz" start tag, found "OgzNr" start tag (line 1, col 38)
        at org.jibx.runtime.impl.UnmarshallingContext.throwStartTagNameError(UnmarshallingContext.java:220)
        at org.jibx.runtime.impl.UnmarshallingContext.matchStart(UnmarshallingContext.java:644)
        at org.jibx.runtime.impl.UnmarshallingContext.parsePastStartTag(UnmarshallingContext.java:680)
        at com.ups.ops.gio.vo.GioOgzVo.JiBX_binding_unmarshal_1_0(GioOgzVo.java)
        at com.ups.ops.gio.vo.JiBX_bindingGioOgzVo_access.unmarshal()
        at com.ups.ops.gio.vo.GioCurLocGrpVo.JiBX_binding_unmarshal_1_0(GioCurLocGrpVo.java)
        at com.ups.ops.gio.vo.GioShuCompositeVo.JiBX_binding_unmarshal_1_0(GioShuCompositeVo.java)
        at com.ups.ops.gio.vo.JiBX_bindingGioShuCompositeVo_access.unmarshal()
        at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2757)
        at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2914)

When I try to unmarshal this XML (all one line):

<UpsBasDb><CurLocGrp><Loc><Ogz><OgzNr>3229</OgzNr><Cny><CnyCd>US</CnyCd></Cny></Ogz></Loc><Ts>2012-09-28T00:20:32.000-04:00</Ts></CurLocGrp></UpsBasDb>

However, if I pass the same XML formatted with newlines, it works!

<UpsBasDb>
   <CurLocGrp>
      <Loc>
         <Ogz>
            <OgzNr>3229</OgzNr>
            <Cny>
               <CnyCd>US</CnyCd>
            </Cny>
         </Ogz>
      </Loc>
      <Ts>2012-09-28T00:20:32.000-04:00</Ts>
   </CurLocGrp>
</UpsBasDb>

Here is the binding.xml file:

<binding package="com.ups.ops.gio.vo">
  <mapping name="UpsBasDb" class="com.ups.ops.gio.vo.GioShuCompositeVo">

    <structure field="orgLocGrp" usage="optional"/>

    <structure name="CurLocGrp" field="curLocGrp" usage="optional">
          <structure name="Loc">
            <structure field="ogz" type="com.ups.ops.gio.vo.GioOgzVo" />
          </structure>
      <value name="Ts" field="udtTs"/>
    </structure>

  </mapping>

  <mapping name="OrgLocGrp" class="com.ups.ops.gio.vo.GioOrgLocGrpVo"
extends="com.ups.ops.gio.vo.GioOgzVo">
    <structure map-as="com.ups.ops.gio.vo.GioOgzVo"/>
    <structure name="TptDtTm">
      <value name="DtTmVlu" field="shuPuDt" usage="optional"/>
    </structure>
    <value name="Ts" field="udtTs"/>
  </mapping>

  <mapping class="com.ups.ops.gio.vo.GioOgzVo" abstract="true">
    <structure name="Ogz">
      <value name="OgzNr" field="ogzNr"/>
      <structure name="Cny">
        <value name="CnyCd" field="cnyCd"/>
      </structure>
      <structure name="Fac" usage="optional">
        <structure name="FacCny" usage="optional">
          <structure name="CnyCd" usage="optional"/>
        </structure>
        <value name="FacMnm" field="facMnm" usage="optional"/>
        <value name="FacLocNr" field="facLocNr" usage="optional"/>
        <value name="InBdgLocNr" field="inBdgLocNr" usage="optional"/>
      </structure>
    </structure>
    <structure name="Srt" usage="optional">
      <structure name="SrtCgy" usage="optional">
        <value name="Cd" field="srtTypCd" usage="optional"/>
      </structure>
    </structure>
  </mapping>
</binding>

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
jibx-users mailing list
jibx-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users



--
Archie L. Cobbs
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
jibx-users mailing list
jibx-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
njmuni . | 28 Aug 17:57 2013
Picon

Re: Getting expected start tag error when unmarshalling unformatted xml

I narrowed it down - if I insert a single space charater between the
<Loc> and <Ogz> tags, it works.  If I remove that space chacter I get
the error.  The Foo/OgzNr replacement didn't make a difference.

<UpsBasDb><CurLocGrp><Loc>
<Ogz><OgzNr>3229</OgzNr><Cny><CnyCd>US</CnyCd></Cny></Ogz></Loc><Ts>2012-09-28T00:20:32.000-04:00</Ts></CurLocGrp></UpsBasDb>

--Jeff

On Tue, Aug 27, 2013 at 9:24 PM, Archie Cobbs <archie <at> dellroad.org> wrote:
> I have no idea what is wrong, but that is weird.
>
> Just out of curiosity, I wonder if it has to do with the fact that Ogz is a
> prefix of OgzNr ?
>
> Try the same test with "OgzNr" replaced with "Foo"...
>
> -Archie
>
>
> On Tue, Aug 27, 2013 at 7:58 PM, njmuni . <limowrck <at> gmail.com> wrote:
>>
>> I'm getting this error:
>>
>> Exception in thread "main" org.jibx.runtime.JiBXException: Expected
>> "Ogz" start tag, found "OgzNr" start tag (line 1, col 38)
>>         at
>> org.jibx.runtime.impl.UnmarshallingContext.throwStartTagNameError(UnmarshallingContext.java:220)
>>         at
>> org.jibx.runtime.impl.UnmarshallingContext.matchStart(UnmarshallingContext.java:644)
>>         at
>> org.jibx.runtime.impl.UnmarshallingContext.parsePastStartTag(UnmarshallingContext.java:680)
>>         at
>> com.ups.ops.gio.vo.GioOgzVo.JiBX_binding_unmarshal_1_0(GioOgzVo.java)
>>         at com.ups.ops.gio.vo.JiBX_bindingGioOgzVo_access.unmarshal()
>>         at
>> com.ups.ops.gio.vo.GioCurLocGrpVo.JiBX_binding_unmarshal_1_0(GioCurLocGrpVo.java)
>>         at
>> com.ups.ops.gio.vo.GioShuCompositeVo.JiBX_binding_unmarshal_1_0(GioShuCompositeVo.java)
>>         at
>> com.ups.ops.gio.vo.JiBX_bindingGioShuCompositeVo_access.unmarshal()
>>         at
>> org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2757)
>>         at
>> org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2914)
>>
>> When I try to unmarshal this XML (all one line):
>>
>>
>> <UpsBasDb><CurLocGrp><Loc><Ogz><OgzNr>3229</OgzNr><Cny><CnyCd>US</CnyCd></Cny></Ogz></Loc><Ts>2012-09-28T00:20:32.000-04:00</Ts></CurLocGrp></UpsBasDb>
>>
>> However, if I pass the same XML formatted with newlines, it works!
>>
>> <UpsBasDb>
>>    <CurLocGrp>
>>       <Loc>
>>          <Ogz>
>>             <OgzNr>3229</OgzNr>
>>             <Cny>
>>                <CnyCd>US</CnyCd>
>>             </Cny>
>>          </Ogz>
>>       </Loc>
>>       <Ts>2012-09-28T00:20:32.000-04:00</Ts>
>>    </CurLocGrp>
>> </UpsBasDb>
>>
>> Here is the binding.xml file:
>>
>> <binding package="com.ups.ops.gio.vo">
>>   <mapping name="UpsBasDb" class="com.ups.ops.gio.vo.GioShuCompositeVo">
>>
>>     <structure field="orgLocGrp" usage="optional"/>
>>
>>     <structure name="CurLocGrp" field="curLocGrp" usage="optional">
>>           <structure name="Loc">
>>             <structure field="ogz" type="com.ups.ops.gio.vo.GioOgzVo" />
>>           </structure>
>>       <value name="Ts" field="udtTs"/>
>>     </structure>
>>
>>   </mapping>
>>
>>   <mapping name="OrgLocGrp" class="com.ups.ops.gio.vo.GioOrgLocGrpVo"
>> extends="com.ups.ops.gio.vo.GioOgzVo">
>>     <structure map-as="com.ups.ops.gio.vo.GioOgzVo"/>
>>     <structure name="TptDtTm">
>>       <value name="DtTmVlu" field="shuPuDt" usage="optional"/>
>>     </structure>
>>     <value name="Ts" field="udtTs"/>
>>   </mapping>
>>
>>   <mapping class="com.ups.ops.gio.vo.GioOgzVo" abstract="true">
>>     <structure name="Ogz">
>>       <value name="OgzNr" field="ogzNr"/>
>>       <structure name="Cny">
>>         <value name="CnyCd" field="cnyCd"/>
>>       </structure>
>>       <structure name="Fac" usage="optional">
>>         <structure name="FacCny" usage="optional">
>>           <structure name="CnyCd" usage="optional"/>
>>         </structure>
>>         <value name="FacMnm" field="facMnm" usage="optional"/>
>>         <value name="FacLocNr" field="facLocNr" usage="optional"/>
>>         <value name="InBdgLocNr" field="inBdgLocNr" usage="optional"/>
>>       </structure>
>>     </structure>
>>     <structure name="Srt" usage="optional">
>>       <structure name="SrtCgy" usage="optional">
>>         <value name="Cd" field="srtTypCd" usage="optional"/>
>>       </structure>
>>     </structure>
>>   </mapping>
>> </binding>
>>
>>
>> ------------------------------------------------------------------------------
>> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
>> Discover the easy way to master current and previous Microsoft
>> technologies
>> and advance your career. Get an incredible 1,500+ hours of step-by-step
>> tutorial videos with LearnDevNow. Subscribe today and save!
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
>> _______________________________________________
>> jibx-users mailing list
>> jibx-users <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
>
>
> --
> Archie L. Cobbs
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> _______________________________________________
> jibx-users mailing list
> jibx-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk

Gmane