Oh. Well, that explains a lot. But that doesn't seem to completely solve the problem. When I do that, I get a new error: org.jibx.runtime.JiBXException: Expected "{http://www.w3.org/2000/svg}g" start tag, found "{http://www.w3.org/2000/svg}defs" start tag (line 6, col 9) at org.jibx.runtime.impl.UnmarshallingContext.throwStartTagNameError(UnmarshallingContext.java:286) at org.jibx.runtime.impl.UnmarshallingContext.matchStart(UnmarshallingContext.java:706) at org.jibx.runtime.impl.UnmarshallingContext.parseToStartTag(UnmarshallingContext.java:727) at com.cdmtech.svg.elements.SVGRoot.JiBX_SVGRoot_JiBX_unmarshal_3_1(SVGRoot.java) at com.cdmtech.svg.elements.JiBX_SVGRoot_JiBXSVGRoot_access1.unmarshal() at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2537) at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2680)
Changed mapping for SVGRoot: <mapping name="svg" class="svg.elements.SVGRoot" extends="svg.elements.Graphic"> <structure map-as="svg.elements.Graphic"/> <value name="viewBox" field="viewBox" style="attribute" usage="optional"/> </mapping> Do I have to do something to make it an anonymous map-as? On Tue, Mar 4, 2008 at 9:17 AM, Qazi, Karim <[EMAIL PROTECTED]> wrote: > You have to put a <structure map-as="your.parent.class"/> in the child > mapping to inherit the actual attributes defined in the base class. > > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Tuesday, March 04, 2008 8:45 AM > To: jibx-users@lists.sourceforge.net > Subject: [jibx-users] Question concerning extensions in mappings > > I seem to be having a problem with extending mappings. The problem > runs like this: > > I have a base class, and a collection of derived classes. Some of the > derived classes extend other derived classes. When I attempt to build > a jibx file for them, I would like to not have to specify the same > element or attribute more then once. So, I create the base class as a > mapping, then the type which can contain the other types as a second > mapping. > > Actually, maybe I can just explain by example best. This is an > initial pass at writing one of the files I was trying to do this with. > It is attempting to restore a small subset of SVG into a small > collection of classes. > > <binding> > <namespace uri="http://www.w3.org/2000/svg" default="elements"/> > <mapping name="svg" class="svg.elements.SVGRoot" > extends="svg.elements.Graphic"> > <value name="viewBox" field="viewBox" style="attribute" > usage="optional"/> > </mapping> > <!-- not derived from Graphic for the moment, not for any > particular reason though --> > <mapping name="defs" class="svg.elements.SVGDefs" > extends="svg.elements.SVGBase"> > <collection field="children" item-type="svg.elements.SVGBase"/> > </mapping> > <mapping name="style" class="svg.elements.SVGStyle" > extends="svg.elements.SVGBase"> > <value name="type" field="type" usage="optional" > style="attribute"/> > <value field="data" usage="optional" style="cdata"/> > </mapping> > <mapping name="rect" class="svg.elements.Rect" > extends="svg.elements.SVGBase"> > </mapping> > <mapping name="g" class="svg.elements.Graphic" > extends="svg.elements.SVGBase"> > <collection field="children" item-type="svg.elements.SVGBase"/> > </mapping> > <mapping class="svg.elements.SVGBase" abstract="true"> > <value name="style" field="styleTextValue" usage="optional" > style="attribute"/> > <value name="class" field="classValue" usage="optional" > style="attribute"/> > <value name="transform" field="transform" usage="optional" > style="attribute"/> > <value name="id" field="id" usage="optional" style="attribute"/> > </mapping> > </binding> > > The problem comes when I try and run the restore. I get the following > error. > org.jibx.runtime.JiBXException: Expected > "{http://www.w3.org/2000/svg}svg" end tag, found > "{http://www.w3.org/2000/svg}defs" start tag (line 6, col 9) > at > org.jibx.runtime.impl.UnmarshallingContext.parsePastCurrentEndTag(Unmars > hallingContext.java:792) > at > com.cdmtech.svg.elements.JiBX_SVGRoot_JiBXSVGRoot_access2.unmarshal() > at > org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(Unmarshallin > gContext.java:2537) > at > org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(Unmarshalli > ngContext.java:2680) > > Not sure if this style of chained inheritence was legal or not, I > decided to check the documentation. I was unable to find anything > that helps. So why is my collection not being inherited? If I get > rid of the inheritence and just put the collection in the SVGRoot > mapping, it works just fine (for relative values of just fine). > Please help. Or, feel free to call me an idiot with reasons. Either > one, so long as its helpful. > > ------------------------------------------------------------------------ > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users