Java Reference
In-Depth Information
public enum Suit {
SPADES,
HEARTS,
DIAMONDS,
CLUBS;
public String value() {
return name();
}
public static Suit fromValue(String v) {
return valueOf(v);
}
}
This source file matches your Suits schema, and has been generated in the package cor-
responding
to
an
inversion
of
the
suits
namespace.
The
namespace ht-
is
translated
into
the
package
name
tp://ns.soacookbook.com/suits
com.soacookbook.ns.suits .
Now that you have the basic idea, let's look at a more complex real-world example. The Cata-
log.xsdfrom earlier was declared as shown in Example 2-11 .
Example2-11.Catalog schema declaration
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://ns.soacookbook.com/catalog"
targetNamespace="http://ns.soacookbook.com/catalog">
//...
I won't repeat the entire listing here. We'll focus only on its Book type, as shown in
Example 2-12 .
Example2-12.Book type as declared in Catalog.xsd
<xsd:complexType name="Book">
<xsd:sequence>
<xsd:element name="isbn" type="ISBN"/>
<xsd:element name="author" type="Author"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="category" type="Category"/>
</xsd:sequence>
</xsd:complexType>
Search WWH ::




Custom Search