Annotation Type XmlSchema


Identifies the default XML namespaces at the package level.
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Sets the default XML namespace URL for all classes in this and child packages.
    Sets the default XML prefix for all classes in this and child packages.
    Lists all namespace mappings to be used on all classes within this package.
  • Element Details

    • namespace

      Sets the default XML namespace URL for all classes in this and child packages.

      Must either be matched with a prefix() annotation, or an xmlNs() mapping with the same @XmlNs(namespaceURI) value.

      Returns:
      The annotation value.
      Default:
      ""
    • prefix

      Sets the default XML prefix for all classes in this and child packages.

      Must either be matched with a namespace() annotation, or an xmlNs() mapping with the same XmlNs.prefix() value.

      Returns:
      The annotation value.
      Default:
      ""
    • xmlNs

      Lists all namespace mappings to be used on all classes within this package.

      The purpose of this annotation is to allow namespace mappings to be defined in a single location and referred to by name through just the @Xml(prefix) annotation.

      Inherited by child packages.

      Example:

      Contents of package-info.java...

      // XML namespaces used within this package. @XmlSchema(prefix="ab", namespaces={ @XmlNs(prefix="ab", namespaceURI="http://www.apache.org/addressBook/"), @XmlNs(prefix="per", namespaceURI="http://www.apache.org/person/"), @XmlNs(prefix="addr", namespaceURI="http://www.apache.org/address/"), @XmlNs(prefix="mail", namespaceURI="http://www.apache.org/mail/") } ) package org.apache.juneau.examples.addressbook; import org.apache.juneau.xml.annotation.*;

      Class in package using defined namespaces...

      package corg.apache.juneau.examples.addressbook; // Bean class, override "ab" namespace on package. @Xml(prefix="addr") public class Address { // Bean property, use "addr" namespace on class. public int id; // Bean property, override with "mail" namespace. @Xml(prefix="mail") public String street, city, state; }

      Returns:
      The annotation value.
      Default:
      {}