随笔分类 -  Java

上一页 1 2 3 4 5 6 7 8 9 下一页
JAXB - Annotations, Class Fields as Attributes: XmlAttribute
摘要:Provided that XML lets you represent a data item as a single value, there is no cut-and-dried rule for deciding between using an element or an attribu 阅读全文
posted @ 2016-05-20 15:30 huey2672 阅读(149) 评论(0) 推荐(0)
JAXB - Annotations, The Annotation XmlElement
摘要:The basic annotation for a field that's intended to be an element is XmlElement. It permits you to define the XML element name, the namespace, whether 阅读全文
posted @ 2016-05-20 15:28 huey2672 阅读(194) 评论(0) 推荐(0)
JAXB - Annotations, Controlling Element Selection: XmlAccessorType, XmlTransient
摘要:If JAXB binds a class to XML, then, by default, all public members will be bound, i.e., public getter and setter pairs, or public fields. Any protecte 阅读全文
posted @ 2016-05-20 14:05 huey2672 阅读(358) 评论(0) 推荐(0)
JAXB - Annotations, The Object Factory: XmlRegistry, XmlElementDecl
摘要:To be able to create objects from XML elements, the unmarshaller must have an object factory with methods for creating all sorts of objects. Therefore 阅读全文
posted @ 2016-05-20 13:11 huey2672 阅读(580) 评论(0) 推荐(0)
JAXB - Annotations, Annotations for the Schema: XmlSchema
摘要:This annotation can only be used with a package. It defines parameters that are derived from the xsd:schema element. It must be written on a file pack 阅读全文
posted @ 2016-05-20 13:05 huey2672 阅读(178) 评论(0) 推荐(0)
JAXB - Annotations, Annotation for Classes: XmlType
摘要:This annotation adds information that would be available from a schema type, but isn't implied by a Java class declaration. The annotation has several 阅读全文
posted @ 2016-05-20 12:56 huey2672 阅读(176) 评论(0) 推荐(0)
JAXB - Annotations, Top-level Elements: XmlRootElement
摘要:A class that describes an XML element that is to be a top-level element, i.e., one that can function as an XML document, should be annotated with XmlR 阅读全文
posted @ 2016-05-20 12:48 huey2672 阅读(476) 评论(0) 推荐(0)
JAXB - Calling marshal
摘要:Only a handful of source code lines is required to make a JAXB Marshaller object write a document tree as an XML file. First you obtain a Marshaller f 阅读全文
posted @ 2016-05-20 11:07 huey2672 阅读(221) 评论(0) 推荐(0)
JAXB - The Object Factory
摘要:Usually hidden in the middle of the list of the classes derived from the types defined in an XML schema there will be one class called ObjectFactory. 阅读全文
posted @ 2016-05-20 10:56 huey2672 阅读(388) 评论(0) 推荐(0)
JAXB - Hello World with Namespace
摘要:如果元素带有命名空间,那么处理方式与 JAXB - Hello World 会略有不同。 1. XML Schema: 2. 编译 schema 生成 Java 类: 3. 修改生成的 GreetingListType.java 文件,添加 @XmlRootElement,指定根元素的名称和命名空间 阅读全文
posted @ 2016-05-19 21:41 huey2672 阅读(336) 评论(0) 推荐(0)
JAXB - Validate Document before It is Unmarshalled
摘要:Validation A considerable part of the XML Schema language deals with facets, enabling the programmer to restrict the basic datatypes. We have seen tha 阅读全文
posted @ 2016-05-18 21:19 huey2672 阅读(371) 评论(0) 推荐(0)
JAXB - Unmarshalling
摘要:A simple approach for unmarshalling an XML document consists of the creation of a JAXB context and the call to unmarshal the document. A JAXBContext o 阅读全文
posted @ 2016-05-18 19:41 huey2672 阅读(250) 评论(0) 推荐(0)
JAXB - XML Schema Types, Defining Subtypes
摘要:Although object orientation isn't a key feature of XML or the XML Schema language, it's still possible to apply the fundamental OO paradigm when desig 阅读全文
posted @ 2016-05-18 16:26 huey2672 阅读(250) 评论(0) 推荐(0)
JAXB - XML Schema Types, Defining Types for XML Elements With Content
摘要:Content: A Value The content of an XML element may be some value, or one or more subordinate elements, or even a combination of both. Let's look at an 阅读全文
posted @ 2016-05-18 15:09 huey2672 阅读(385) 评论(0) 推荐(0)
JAXB - XML Schema Types, Defining Types for XML Elements Without Content
摘要:Types for XML elements are constructed using xsd:complexType, even if they do not have content. The snippet below defines a simple element with two at 阅读全文
posted @ 2016-05-18 14:31 huey2672 阅读(134) 评论(0) 推荐(0)
JAXB - XML Schema Types, Defining an Enumeration
摘要:If you want a data type that enumerates discrete values you should use a restriction of the schema type xsd:string, enumerating all the values as you 阅读全文
posted @ 2016-05-18 14:16 huey2672 阅读(168) 评论(0) 推荐(0)
JAXB - XML Schema Types, Binary Data
摘要:Data that has no "natural" representation with printable characters must, for inclusion in an XML file, still be represented in printable characters. 阅读全文
posted @ 2016-05-18 13:54 huey2672 阅读(186) 评论(0) 推荐(0)
JAXB - XML Schema Types, Date and Time
摘要:JAXB binds all three of the schema types xsd:date, xsd:time and xsd:dateTime to XMLGregorianCalendar. This class is in the package javax.xml.datatype. 阅读全文
posted @ 2016-05-18 13:16 huey2672 阅读(378) 评论(0) 推荐(0)
JDK Tools - xjc: 将 XML Schema 编译成 Java 类
摘要:xjc 是 JAXB 将 xsd 生成 Java 类的工具。 命令格式 xjc [ options ] schema file/URL/dir/jar ... [-b bindinfo ] ... 命令参数 -d dir 在指定的目录生成 Java 类。指定的目录必须是已存在的,XJC 不会创建该目 阅读全文
posted @ 2016-05-18 12:22 huey2672 阅读(537) 评论(0) 推荐(0)
JAXB - Hello World
摘要:We'll stick with the tradition and use a sort of "Hello World" XML document to illustrate the typical scenario for creating the Java classes and their 阅读全文
posted @ 2016-05-18 10:05 huey2672 阅读(204) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 下一页