com.sun.xml.txw2.annotation
Annotation Type XmlElement


@Retention(value=RUNTIME)
@Target(value={METHOD,TYPE})
public @interface XmlElement

Specifies the name of the XML element.

Used on method

When used on methods declared on interfaces that derive from TypedXmlWriter, it specifies that the invocation of the method will produce an element of the specified name.

The method signature has to match one of the following patterns.

Child writer: TW foo()
TW must be an interface derived from TypedXmlWriter. When this method is called, a new child element is started, and its content can be written by using the returned TW object. This child element will be ended when its _commit method is called.
Leaf element: void foo(DT1,DT2,...)
DTi must be datatype objects. When this method is called, a new child element is started, followed by the whitespace-separated text data from each of the datatype objects, followed by the end tag.

Used on interface

When used on interfaces that derive from TypedXmlWriter, it associates an element name with that interface. This name is used in a few places, such as in TXW.create(Class,XmlSerializer) and TypedXmlWriter._element(Class).

Author:
Kohsuke Kawaguchi

Optional Element Summary
 String ns
          The namespace URI of this element.
 String value
          The local name of the element.
 

value

public abstract String value
The local name of the element.

Default:
""

ns

public abstract String ns
The namespace URI of this element.

If the annotation is on an interface and this paramter is left unspecified, then the namespace URI is taken from XmlNamespace annotation on the package that the interface is in. If XmlNamespace annotation doesn't exist, the namespace URI will be "".

If the annotation is on a method and this parameter is left unspecified, then the namespace URI is the same as the namespace URI of the writer interface.

Default:
"##default"


Copyright © 2012 Oracle. All Rights Reserved.