Perfect, thanks!

Craig.

On 2010-06-13, at 4:15 PM, Martin Bolz wrote:

> Hi Craig,
> 
> provided xmlContext is setup and mappingAsStream is a valid InputStream of 
> the castor mapping file 'mapping.xml', execution of MapToInfo should print 
> 'XmlName: myAdress'.
> 
> -----mapping.xml----------
> ...
> <c:class name="userhelp.Adress" auto-complete="true">
>   <c:map-to xml="myAdress"/>
> </c:class>
> ...
> ----mapping.xml-----------
> 
> ------MapToInfo.java------
> ...
> Marshaller marshaller = xmlContext.createMarshaller();
> 
> Mapping mapping = new Mapping();
> mapping.loadMapping(new InputSource(mappingAsStream));
> marshaller.setMapping(mapping);
> 
> ClassDescriptor desc = marshaller.getResolver().resolve(Adress.class);
> 
> if(desc instanceof XMLClassDescriptor) {
>   System.out.println("XmlName: "+((XMLClassDescriptor)desc).getXMLName());
> }
> ...
> ------MapToInfo.java------
> 
> Hope it helps!
> 
> Regards,
> 
> Martin
> 
> -------- Original-Nachricht --------
>> Datum: Sun, 13 Jun 2010 13:59:45 -0500
>> Von: Craig Tataryn <[email protected]>
>> An: [email protected]
>> Betreff: [castor-user] map-to xml attribute value given a class
> 
>> Assuming I have access to an XMLContext containing a bunch of mappings, I
>> was wondering if there was a way I could, at runtime, ask the Context
>> "what's the value of the <map-to> element's "xml" attribute for class
>> com.package.SomeClass"?
>> 
>> I believe what I'm looking for is a method that is of the form:
>> 
>> XMLClassDescriptor getXMLClassDescriptorForClass(Class mappedClass)
>> 
>> 
>> Thanks,
>> 
>> Craig.
>> 
>> --
>> Craig Tataryn
>> site: http://www.basementcoders.com/
>> podcast: http://www.basementcoders.com/?feed=podcast
>> itunes: http://itunes.apple.com/podcast/the-basement-coders
>> irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin
>> twitter: craiger
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>> 
>>    http://xircles.codehaus.org/manage_email
>> 
> 
> -- 
> GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.  
> Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
> 
> ---------------------------------------------------------------------
> 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