`

JAXB 深入学习<1>

阅读更多
说白了就是一个api将 xml+schema->java object. 或 java object -> schema. for webservice wsdl file.

JAXB Architecture

This section describes the components and interactions in the JAXB processing model.

Architectural Overview

Figure 17-1 shows the components that make up a JAXB implementation.

Figure 17-1 JAXB Architectural Overview

A JAXB implementation consists of the following architectural components:

  • Schema compiler: Binds a source schema to a set of schema-derived program elements. The binding is described by an XML-based binding language.

  • Schema generator: Maps a set of existing program elements to a derived schema. The mapping is described by program annotations.

  • Binding runtime framework: Provides unmarshalling (reading) and marshalling (writing) operations for accessing, manipulating, and validating XML content using either schema-derived or existing program elements.

The JAXB Binding Process

Figure 17-2 shows what occurs during the JAXB binding process.

Figure 17-2 Steps in the JAXB Binding Process

The general steps in the JAXB data binding process are:

  1. Generate classes: An XML schema is used as input to the JAXB binding compiler to generate JAXB classes based on that schema.

  2. Compile classes: All of the generated classes, source files, and application code must be compiled.

  3. Unmarshal: XML documents written according to the constraints in the source schema are unmarshalled by the JAXB binding framework. Note that JAXB also supports unmarshalling XML data from sources other than files/documents, such as DOM nodes, string buffers, SAX Sources, and so forth.

  4. Generate content tree: The unmarshalling process generates a content tree of data objects instantiated from the generated JAXB classes; this content tree represents the structure and content of the source XML documents.

  5. Validate (optional): The unmarshalling process optionally involves validation of the source XML documents before generating the content tree. Note that if you modify the content tree in Step 6, below, you can also use the JAXB Validate operation to validate the changes before marshalling the content back to an XML document.

  6. Process content: The client application can modify the XML data represented by the Java content tree by means of interfaces generated by the binding compiler.

  7. Marshal: The processed content tree is marshalled out to one or more XML output documents. The content may be validated before marshalling.

More about Unmarshalling

Unmarshalling provides a client application the ability to convert XML data into JAXB-derived Java objects.

More about Marshalling

Marshalling provides a client application the ability to convert a JAXB-derived Java object tree back into XML data.

By default, the Marshaller uses UTF-8 encoding when generating XML data.

Client applications are not required to validate the Java content tree before marshalling. There is also no requirement that the Java content tree be valid with respect to its original schema to marshal it back into XML data.

More about Validation

Validation is the process of verifying that an XML document meets all the constraints expressed in the schema. JAXB 1.0 provided validation at unmarshal time and also enabled on-demand validation on a JAXB content tree. JAXB 2.0 only allows validation at unmarshal and marshal time. A web service processing model is to be lax in reading in data and strict on writing it out. To meet that model, validation was added to marshal time so one could confirm that they did not invalidate the XML document when modifying the document in JAXB form.

 

分享到:
评论

相关推荐

    jdk10+ java.lang.NoClassDefFoundError: javax/xml/ws/Service 错误

    jdk升级之后出现异常:java.lang.NoClassDefFoundError: javax/xml/ws/Service 1、解决方案jdk降级至1.8之前 ... &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt; &lt;version&gt;2.3.1&lt;/version&gt; &lt;/dependency&gt; .....

    jaxb-impl-2.3.0.1.jar

    &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt; &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt; &lt;version&gt;2.3.0.1&lt;/version&gt;

    Java and XML, 3rd Edition

    包括核心接口和XPath支持&lt;br&gt;*StAX应用程序编程接口,包括StAX的工厂方法(factory)、文档生成和XMLPull&lt;br&gt;*使用JAXB进行数据绑定,使用新的JAXB 2.0 annotation&lt;br&gt;*使用RSS进行网络同步和podcasting&lt;br&gt;*表示层...

    openapi-jaxb:XSD中的OpenApi注释-> DTO生成

    OpenApi 3插件 目录 问题 4.3。... &lt; groupId&gt;hu.icellmobilsoft.jaxb&lt;/ groupId&gt; &lt; artifactId&gt;openapi-jaxb&lt;/ artifactId&gt; &lt; version&gt;1.1.0&lt;/ version&gt; &lt;/ dependency&gt; 2. openapi-jaxb插件 swa

    jaxb-core.rar

    &lt;dependency&gt; &lt;groupId&gt;com.aliyun&lt;/groupId&gt; &lt;artifactId&gt;dysmsapi20170525&lt;/artifactId&gt; &lt;version&gt;2.0.4&lt;/version&gt; &lt;/dependency&gt;

    xjc-javadoc-plugin:XJC javadoc插件,基于xsd添加javadocs

    xjc-javadoc-plugin ... &lt;groupId&gt;org.jvnet.jaxb2.maven2&lt;/groupId&gt; &lt;artifactId&gt;maven-jaxb22-plugin&lt;/artifactId&gt; &lt;version&gt;0.12.3&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;xjc&lt;/id&gt; &lt;goals&gt;

    jaxb xml

    jaxb&lt;br&gt;jaxb

    xjc-inst:用于实例化的 XJC 插件

    用于实例化的 XJC 插件 该插件使 XJC 能够实例化从 XML-Schemas 生成的类中的字段。... &lt;groupId&gt;org.jvnet.jaxb2.maven2&lt;/groupId&gt; &lt;artifactId&gt;maven-jaxb2-plugin&lt;/artifactId&gt; &lt;version&gt;0.8.1&lt;/version&gt;

    iFramework:iFramework 是一组围绕 GWT 平台、JAXB 和其他几个知名框架和库的工具和 API,应该有助于减少新的 Web 应用程序开发时间

    &lt; iframework&gt;0.4.0&lt;/ iframework&gt; &lt;/ properties&gt; 依赖项: &lt;!-- GWTP MVP (client-side) extension --&gt; &lt; dependency&gt; &lt; groupId&gt;pro.redsoft.iframework&lt;/ groupId&gt; &lt; artifactId&gt;iframework-gwtpx...

    JAXB Unmarshalling @XmlAnyElement

    解决List&lt;Object&gt; 没法转 具体对象问题 SOAP +XML JAXB Unmarshalling @XmlAnyElement

    martian-framework-jaxb:JAXB的Java框架

    火星框架jaxb 该软件包提供了有用的辅助类,这些... &lt;artifactId&gt;martian-framework-jaxb&lt;/artifactId&gt; &lt;version&gt;21.04.00.00&lt;/version&gt; &lt;/dependency&gt; 执照 根据Apache License 2.0分发。 有关更多信息,请参见。

    ph-sbdh:用于读写UN CEFACT标准业务文档标头文档的Java库

    &lt; version&gt;x.y.z&lt;/ version&gt; &lt;/ dependency&gt; 新闻和值得注意 v4.1.2-进行中更新为ph-commons 10 v4.1.1-2020-09-17 更新为雅加达JAXB 2.3.3 增加了禁用SBD(H)Marshaller XSD验证的可能性 将Java 8日期和时间

    maven-jaxb2-plugin:用于XML模式编译的最先进的JAXB2 Maven插件

    JAXB2 Maven插件欢迎使用org.jvnet.jaxb2.maven2:maven-jaxb2-plugin ,这是用于XML Schema编译的最先进且功能齐全的Maven插件。 这个Maven插件包装并... 将插件添加到您的pom.xml :&lt; project&gt;...&lt; build&gt;&lt; plugin

    tareaJavaXML-JSON_02

    api 2.3.1 &lt;dependency&gt; &lt;groupId&gt;javax.activation&lt;/groupId&gt; &lt;artifactId&gt;activation&lt;/artifactId&gt; &lt;version&gt;1.1&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.glassfish.jaxb&lt;/groupId&gt; &lt;artifactId&gt;jaxb-...

    jaxb-2_1_9.zip

    jaxb-2_1_9.zip jaxb最新版本 转:http://blog.sina.com.cn/s/blog_5ce5700e0100bowu.html 使用MyEclipse5.5+jboss-5.0.0.CR1+JDK1.6,在启动时报了一个错误: java.lang.LinkageError: JAXB 2.0 API is being ...

    spring-boot-soap-security:具有安全性的WS SOAP的Spring Boot项目

    &lt;artifactId&gt;jaxb2-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.6&lt;/version&gt; WS配置和安全性 com.memorynotfound.server.SoapServerConfig 使用@EnableWs注释加载beers.xsd并定义该Web服务所在的位置: 安全 ...

    wiseml-java:WiseML 的 JAXB 绑定

    WiseML 的 JAXB 绑定 建造 无需安装。 要构建它,您需要 Java 6 或更高版本以及 2.0 或更高版本。 在克隆此存储库之前,请确保使用“git config --global core.autocrlf input”在您的机器上启用 CRLF/LF 的自动...

    JAXB的使用JAXB的使用

    JAXB的使用JAXB的使用JAXB的使用JAXB的使用

    jaxb-api-2.2 jaxb-impl

    2.不是把下载的这个jar文件放在sun网站给出的&lt;java-home&gt;/lib/endorsed 下,而是要自己试验确定应该放在哪个目录下: 确定放在哪个目录下的方法如下: 首先要看你的项目是java项目还是java web项目: A, java项目...

    java学习之jaxb的学习一

    NULL 博文链接:https://lijie-insist.iteye.com/blog/2160015

Global site tag (gtag.js) - Google Analytics