|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
complexType extend an external Java classI would share my problem :
In my schema file I declare this : ---------------------------------------------------------------------------------- <xsd:schema ... ... <xsd:complexType name="template-transportable"> <xsd:sequence> <xsd:element name="title" type="xsd:string" /> <xsd:element name="content" type="xsd:base64Binary" xmime:expectedContentTypes="application/octet-stream" /> </xsd:sequence> </xsd:complexType> ... </xsd:schema> ---------------------------------------------------------------------------------- When I generate the class TemplateTransportable.java all is ok; but now I would like this last one inherits from an existing java class (which is not generated by Jaxb). For exemple I have a class com.test.Template somewhere, and I would like my generated class TemplateTransportable extends com.test.Template. I have seen when can declare something ---------------------------------------------------------------------------------- <xsd:schema ... ... <xsd:annotation> <xsd:appinfo> <jaxb:globalBindings> <xjc:superClass name="com.test.Template"/> </jaxb:globalBindings> </xsd:appinfo> </xsd:annotation> </xsd:schema> ---------------------------------------------------------------------------------- But it's not good because all my compexType in the schema file will inherit from this com.test.Template, it's not my goal, I would to apply on only one of my complexType nodes. Anyone has any idea to resolve my problem ? Thanks a lot everybody |
|
|
Re: complexType extend an external Java classEric C. wrote:
> I would share my problem : > > In my schema file I declare this : > > ---------------------------------------------------------------------------------- > <xsd:schema ... > ... > <xsd:complexType name="template-transportable"> > <xsd:sequence> > <xsd:element name="title" type="xsd:string" /> > <xsd:element name="content" type="xsd:base64Binary" > xmime:expectedContentTypes="application/octet-stream" /> > </xsd:sequence> > </xsd:complexType> > ... > </xsd:schema> > ---------------------------------------------------------------------------------- > > When I generate the class TemplateTransportable.java all is ok; but now I > would like this last one inherits from an existing java class (which is not > generated by Jaxb). > For exemple I have a class com.test.Template somewhere, and I would like my > generated class TemplateTransportable extends com.test.Template. > > I have seen when can declare something > ---------------------------------------------------------------------------------- > <xsd:schema ... > ... > <xsd:annotation> > <xsd:appinfo> > <jaxb:globalBindings> > <xjc:superClass name="com.test.Template"/> > </jaxb:globalBindings> > </xsd:appinfo> > </xsd:annotation> > </xsd:schema> > ---------------------------------------------------------------------------------- > But it's not good because all my compexType in the schema file will inherit > from this com.test.Template, it's not my goal, I would to apply on only one > of my complexType nodes. > Hi Eric, Your question is not clear to me. What do you mean by "I would to apply on only one of my complexType nodes"? Specifically, what do you wish to apply? What do you mean by "one of my complexType nodes"? Perhaps an example of the desired generated class would help. Thanks. -- Regards, Farrukh Web: http://www.wellfleetsoftware.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
[ANN]VTD-XML 2.7VTD-XML 2.7 is released and can be downloaded at
http://sourceforge.net/projects/vtd-xml/files/. Below is a summary of what are the new features and enhancements. Expanded VTD-XML's Core API a.. VTDNav: toStringUpperCase, toStringLowerCase, contains(), endsWith(), startsWith() b.. Extended VTD added in-memory buffer support Improved Xpath a.. Added the following XPath 2.0 functions: abs(), ends-with(), upper-case(), lower-case() b.. Added support for variable reference * significantly enhanced XPath syntax, checking error reporting (Special thanks to Mark Swanson) c.. Internal performance tuning Bug fixes and Code Enhancement a.. C version significantly removed warning message, fix memory leak during Xpath expression parsing, b.. Various bug fies (Special thanks to Jon Roberts, John Zhu, Matej Spiller, Steve Polson, and Romain La Tellier) --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: complexType extend an external Java classHi Eric,
there are two ways to achieve what you want. (1) Modify your xjc compilation process to run twice, once without the vendor specific customization, and once, in some other working directory, with the <xjc:superClass>. (Putting the customization into a separate bindings file will make this a matter of using and not using xjc's -b option). Then, simply copy the class with the suitable "extends" onto the sibling one. Of course, if you have several such classes, it's going to be a mess. (2) Check how far it is possible to obtain the base class com.test.Template via xjc compilation and define a complex schema type accordingly, and use the extension mechanism of XML Schema to define template-transportable as a subclass of Template. For missing methods and stuff you can use a (standard) plugin for xjc, to inject arbitrary Java code into a class body: xjc -extension -Xinject-code ... which lets you add arbitrary code to any class: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:ci="http://jaxb.dev.java.net/plugin/code-injector" jxb:extensionBindingPrefixes="ci" jxb:version="2.0"> <xsd:complexType name="..."> <xsd:annotation><xsd:appinfo><ci:code><![CDATA[ public int hashCode()... ]]></ci:code></xsd:appinfo></xsd:annotation> -W On Wed, Sep 30, 2009 at 8:30 PM, Eric C. <coureux.eric@...> wrote:
|
| Free embeddable forum powered by Nabble | Forum Help |