users@jaxb.java.net

Re: Help about "[ERROR] XPath error: null"

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Wed, 1 Jun 2011 07:48:08 +0200

For instance, inline in the xsd:

<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="ai ci"
   jxb:version="1.0">

<xsd:complexType name="ElemType">
  <xsd:annotation>
    <xsd:appinfo><ci:code><![CDATA[
    public String toString(){
        return name;
    }]]>
    </ci:code></xsd:appinfo>
  </xsd:annotation>
...

xjc -extension -Xinject-code ...

I prefer inline, because then the Java code is at least close to the data
definition in the XML schema. First development of non-trivial methods is
probably done best in the generated code.
-W





On 31 May 2011 20:09, Nicolas VINOT <aeris_at_imirhil.fr> wrote:

> Le mardi 31 mai 2011 09:30:48, vous avez écrit :
>
> > it was a problem with namespaces in the xml declaration.. try this..
>
>
> Thanks a lot, it's working =)
>
>
> I have an other question about customization.
>
>
> I have to insert some custom methods into generated binding classes.
>
>
> To achieve this without loosing modifications after regeneration, I hoped I
> can declare superclass for those generated classes, but it seems
> <xjc:superClass> can only be on <globalBindings> and not on other scopes.
>
>
> What is the best way for inserting custom methods into JAXB generated
> classes ?
>
>
> Thanks in advance for your responses
>
> --
>
> Nicolas VINOT
>