Yes, in retrospect "substitutes" or something of the sort would have 
been a better name than "extends". Another thing to clean up for 2.0 
binding definitions.

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Joanna Muench wrote:
> Thanks for the clarification, Dennis. The documentation definitely could use 
> some work, since I would say the use of the attribute name "extends" in this 
> situation breaks the principle of least surprise, leading at least this 
> impatient developer down the wrong path. Unfortunately a cursory glance at 
> Figure 16 reinforced my mis-interpretation. Testing documentation is much 
> harder 
> than testing code.
>
> Joanna
>
>
> Dennis Sosnoski wrote:
>   
>> Hi Joanna,
>>
>> The extends="..." attribute is only needed for a mapping when you're 
>> implementing the equivalent of schema substitution groups. It's not 
>> intended for use where you're just doing the equivalent of schema type 
>> extension. The tutorial at 
>> http://jibx.sourceforge.net/tutorial/binding-mappings.html#inherit has 
>> some discussion of this, though it's probably not as clear as it should 
>> be about the distinction.
>>
>>   - Dennis
>>
>> Dennis M. Sosnoski
>> SOA and Web Services in Java
>> Training and Consulting
>> http://www.sosnoski.com - http://www.sosnoski.co.nz
>> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
>>
>>
>>
>> Joanna Muench wrote:
>>     
>>> I've encountered this error and I'm not sure how to work around it. 
>>> The scenario is that I have two schemas I'm trying to map and recently 
>>> created a new type, ModeledNumericQuantity, that extends an existing 
>>> type NumericQuantity. The new mapping looks as such:
>>>
>>>    <mapping abstract="true" 
>>> class="edu.iris.ws.core.ModeledNumericQuantity" 
>>> extends="edu.iris.ws.base.NumericQuantity">
>>>         <structure name="Residual" field="residual" usage="optional"/>
>>>     </mapping>
>>>
>>> But once I add this, I get an error on all my structures that use 
>>> NumericQuantity:
>>>  name attribute not allowed on reference to mapping with extensions;
>>>
>>> These structure look like this:
>>>         <structure name="Depth" field="depth"/>
>>>
>>> But if I remove the name attribute, not too surprisingly I get a class 
>>> cast exception:
>>>  java.lang.ClassCastException: edu.iris.ws.base.NumericQuantity
>>>
>>> The schemas I am working from are online at:
>>> http://www.iris.edu/schema/common/xml/baseDataTypes.xsd
>>> http://www.iris.edu/schema/common/xml/coreDataTypes.xsd
>>>
>>> The bindings are attached. Any help on how to refer to mappings with 
>>> extensions would be most appreciated.
>>>
>>> Thanks, Joanna
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <binding xmlns:xsd="http://www.iris.edu/phasepick/xsd";>
>>>
>>>     <mapping abstract="true" class="edu.iris.ws.base.Author">
>>>         <value name="Name" field="name" usage="optional"/>
>>>         <value name="AuthorKey" field="authorKey" usage="optional"/>
>>>         <structure name="Link" field="link" usage="optional"/>
>>>         <structure name="Comment" field="comment" usage="optional"/>
>>>         <structure name="Institution" field="institution" usage="optional"/>
>>>         <value name="ID" field="ID" style="attribute"/>
>>>     </mapping>
>>>
>>>     <mapping abstract="true" class="edu.iris.ws.base.Link">
>>>         <value name="Description" field="description" usage="optional"/>
>>>         <value name="URL" field="url" style="attribute"/>
>>>         <value name="title" field="title" style="attribute"/>
>>>     </mapping>
>>>
>>>     <mapping abstract="true" class="edu.iris.ws.base.Comment">
>>>         <value name="Text" field="text" usage="optional"/>
>>>         <structure name="Author" usage="optional"/>
>>>         <structure name="Link" usage="optional"/>
>>>     </mapping>
>>>
>>>     <mapping abstract="true" class="edu.iris.ws.base.ExtraElements">
>>>         <structure ordered="false" choice="true">
>>>             <structure name="Comment" field="comment" usage="optional"/>
>>>             <structure name="Link" field="link" usage="optional"/>
>>>         </structure>
>>>         <value name="CreateTime" field="createTime"/>
>>>     </mapping>
>>>     
>>>     <mapping abstract="true" class="edu.iris.ws.base.ErrorDescription">
>>>         <value name="errorType" field="errorType" style="attribute"/>
>>>         <value name="errorUnits" field="errorUnits" style="attribute" 
>>> usage="optional"/>
>>>         <value name="errorValue" field="errorValue" style="attribute"/>
>>>     </mapping>
>>>     
>>>     <mapping abstract="true" class="edu.iris.ws.base.NumericQuantity">
>>>         <collection field="errors" usage="optional">
>>>             <structure name="Error"/>
>>>         </collection>
>>>         <value name="value" field="value" style="attribute"/>
>>>         <value name="units" field="units" style="attribute" 
>>> usage="optional"/>
>>>     </mapping>
>>>     
>>>     <mapping abstract="true" class="edu.iris.ws.base.TimeQuantity">
>>>         <collection field="errors" usage="optional">
>>>             <structure name="Error"/>
>>>         </collection>
>>>        <value name="value"  field="value" style="attribute"/>    
>>>     </mapping>
>>>     
>>>     <mapping abstract="true" class="edu.iris.ws.base.GeoLocation">
>>>         <structure field="latitude"/>
>>>         <structure field="longitude"/>
>>>         <structure field="elevation" usage="optional"/>
>>>         <value name="datum" field="datum" usage="optional" 
>>> default="WGS84"/> 
>>>     </mapping>
>>>     
>>>     <mapping abstract="true" class="edu.iris.ws.base.TimeRange">
>>>         <value name="startTime" field="startTime" style="attribute"/>
>>>         <value name="stopTime" field="stopTime" style="attribute" 
>>> usage="optional"/>
>>>     </mapping>
>>>  
>>> </binding>
>>>   
>>> ------------------------------------------------------------------------
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <binding xmlns:xsd="http://www.iris.edu/phasepick/xsd";>
>>>     
>>>     <mapping abstract="true" class="edu.iris.ws.core.OriginLocation" 
>>> extends="edu.iris.ws.base.GeoLocation">
>>>         <structure map-as="edu.iris.ws.base.GeoLocation"/>
>>>         <structure name="Depth" field="depth"/>
>>>         <value name="Time" field="time"/>
>>>     </mapping>
>>>     
>>>     <mapping abstract="true" class="edu.iris.ws.core.SeismicRegion">
>>>         <value name="code" field="code" style="attribute"/>
>>>         <value field="name" style="text" usage="optional"/>
>>>     </mapping>
>>>     
>>>     <mapping abstract="true" class="edu.iris.ws.core.Residual">
>>>         <value name="residual" field="residual" style="attribute"/>
>>>         <value name="units" field="units" style="attribute" 
>>> usage="optional"/>
>>>         <value name="modelName" field="modelName" style="attribute" 
>>> usage="optional"/>
>>>     </mapping>
>>>     
>>>     <mapping abstract="true" class="edu.iris.ws.core.ModeledTimeQuantity" 
>>> extends="edu.iris.ws.base.TimeQuantity">
>>>         <structure name="Residual" field="residual" usage="optional"/>
>>>     </mapping>
>>>     
>>>    <mapping abstract="true" class="edu.iris.ws.core.ModeledNumericQuantity" 
>>> extends="edu.iris.ws.base.NumericQuantity">
>>>         <structure name="Residual" field="residual" usage="optional"/>      
>>>   
>>>     </mapping>
>>>     
>>>     <mapping type-name="xsd:EventType" abstract="true" 
>>> class="edu.iris.ws.core.Event">
>>>         <structure name="Author" field="author"/>
>>>         <structure name="PreferredOrigin" field="preferredOrigin" 
>>> map-as="xsd:OriginType" usage="optional"/>
>>>         <collection field="origins">
>>>             <structure name="Origin" map-as="xsd:OriginType"/>
>>>         </collection>
>>>     </mapping>
>>>     
>>>     <mapping type-name="xsd:OriginType" abstract="true" 
>>> class="edu.iris.ws.core.Origin">
>>>         <value name="Catalog" field="catalog" usage="optional"/>
>>>         <structure name="Contributor" field="contributor"/>
>>>         <structure name="Source" field="source" usage="optional"/>
>>>         <structure name="Location" field="location"/>
>>>         <structure name="Region" field="region" usage="optional"/>
>>>         <structure name="SemiMajorAxisLength" field="semiMajorAxis" 
>>> usage="optional"/>
>>>         <structure name="SemiMinorAxisLength" field="semiMinorAxis" 
>>> usage="optional"/>
>>>         <structure name="OriginSolution" field="originSolution" 
>>> map-as="xsd:OriginSolutionType" usage="optional"/>
>>>         <structure name="PreferredMagnitude" field="preferredMagnitude" 
>>> map-as="xsd:MagnitudeType" usage="optional"/>
>>>         <collection field="magnitudes" >
>>>              <structure name="Magnitude" map-as="xsd:MagnitudeType"/>
>>>         </collection>
>>>             <collection field="arrivals">
>>>             <structure name="Arrival" map-as="xsd:ArrivalType"/>
>>>         </collection>
>>>         <structure field="extraElements" usage="optional"/>
>>>     </mapping>
>>>     
>>>     <mapping type-name="xsd:MagnitudeType" abstract="true" 
>>> class="edu.iris.ws.core.Magnitude">
>>>         <value name="type" field="type" style="attribute"/>
>>>         <value name="value" field="value" style="attribute"/>
>>>         <structure name="Contributor" field="contributor" usage="optional"/>
>>>         <value name="Version" field="version" usage="optional"/>
>>>         <value name="NumStations" field="numStations" usage="optional"/>
>>>         <structure name="Error" field="errorDescription" usage="optional"/>
>>>         <structure field="extraElements" usage="optional"/>
>>>     </mapping>
>>>     
>>>     <mapping type-name="xsd:ArrivalType" abstract="true" 
>>> class="edu.iris.ws.core.Arrival">
>>>         <structure name="Contributor" field="contributor" usage="optional"/>
>>>         <structure name="WaveformIdentifier" field="waveformId" 
>>> map-as="xsd:WaveformIdentifierType"/>
>>>         <value name="Phase" field="phase"/>
>>>         <structure name="ArrivalTime" field="arrivalTime"/>
>>>         <structure name="EventStationDistance" 
>>> field="eventStationDistance"/>
>>>         <structure name="EventStationAzimuth" field="eventStationAzimuth"/>
>>>         <!-- 
>>>             <structure name="ObservedAzimuth" field="observedAzimuth" 
>>> usage="optional"/>
>>>             <structure name="ObservedSlowness" field="observedSlowness" 
>>> usage="optional"/>
>>>         <value name="SignalNoiseRatio" field="signalNoiseRatio" 
>>> usage="optional"/>
>>>         <structure name="Amplitude" field="amplitude" usage="optional"/>
>>>         <structure name="Period" field="period" usage="optional"/>
>>>         <value name="Pick" field="pick" usage="optional"/>
>>>         <value name="OnsetQuality" field="onsetQuality" usage="optional"/>
>>>         <value name="Filter" field="filter" usage="optional"/>
>>>         <structure field="extraElements" usage="optional"/>
>>>         -->
>>>     </mapping>    
>>>
>>>     <mapping type-name="xsd:WaveformIdentifierType" abstract="true" 
>>> class="edu.iris.ws.core.WaveformId">
>>>         <structure name="ChannelIdentifier" field="channel" 
>>> map-as="xsd:ChannelIdType"/>
>>>         <structure name="TimeRange" field="timeRange" usage="optional"/>
>>>     </mapping>
>>>
>>>     <mapping type-name="xsd:ChannelIdType" abstract="true" 
>>> class="edu.iris.ws.core.ChannelId">
>>>         <structure name="Network">
>>>             <structure name="Institution">
>>>                 <value name="id" field="institutionId" style="attribute" 
>>> usage="optional" default="FSDN"/>
>>>             </structure>
>>>             <value name="code" field="networkCode" style="attribute"/>
>>>         </structure>
>>>         <structure name="Station">
>>>             <value name="code" field="stationCode" style="attribute"/>
>>>         </structure>
>>>         <structure name="Channel">
>>>             <value name="code" field="channelCode" style="attribute"/>
>>>         </structure>
>>>         <structure name="Location">
>>>             <value name="code" field="locationCode" style="attribute" 
>>> usage="optional"/>
>>>         </structure>
>>>         <structure field="extraElements" usage="optional"/>
>>>     </mapping>
>>>     
>>>     <mapping type-name="xsd:OriginSolutionType" abstract="true" 
>>> class="edu.iris.ws.core.OriginSolution">
>>>         <value name="NumberPhases" field="numberPhases" usage="optional"/>
>>>         <value name="NumberStations" field="numberStations" 
>>> usage="optional"/>
>>>         <value name="AzimuthGapDegrees" field="azimuthGap" 
>>> usage="optional"/>
>>>         <structure name="MinStationDistance" field="minStationDist" 
>>> usage="optional"/>
>>>         <structure name="MaxStationDistance" field="maxStationDist" 
>>> usage="optional"/>
>>>         <value name="LocationMethod" field="locationMethod" 
>>> usage="optional"/>
>>>         <value name="EventDescription" field="eventDescription" 
>>> usage="optional"/>
>>>     </mapping>
>>>     
>>>     
>>> </binding>
>>> ------------------------------------------------------------------------
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by DB2 Express
>>> Download DB2 Express C - the FREE version of DB2 express and take
>>> control of your XML. No limits. Just data. Click to get it now.
>>> http://sourceforge.net/powerbar/db2/
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> jibx-users mailing list
>>> jibx-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>>   
>>>       
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> jibx-users mailing list
>> jibx-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>     
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to