定制 xmlbeans 所生成的 package
xmlbeans 也是 XML binding 工具之一,不了解的同学可以去了解一下,是这方面比较流行的框架之一。本篇不会长篇累牍的去介绍如何使用,相信在这方面,官方文档已足够。
我们知道,xmlbeans 提供了命令行工具,同时也有 ant task,支持把 xsd 生成 Java class 这一功能。xmlbeans 所生成的这些 classes 的 package 其实是有一定规律的。默认情况下,package 是根据 namespace 和元素类型而定。在某些情况下,特别是这个 xsd 并不是我们所能控制的情形下,我们需要生成不同于 namespace 的 package,这时就需要我们做出一些特殊处理。
Categorized in: Java, SOA · Tagged with: Java, schema, XML
A brief introduction of what is RDF
The Resource Description Framework (RDF) is a language for representing information about resources in the World Wide Web. It provides a graph structure for making statements about things. RDF is designed to be read and understood by computers. It is not designed to be displayed to people. RDF is the W3C standard for encoding knowledge. It is a specification that fills a particular niche for decentralized, distributed knowledge and provides a framework to enable computer applications to handle data.
Categorized in: HTTP / WEB · Tagged with: RDF, SemanticWeb, XML
Tutorial of SOAP with Attachments API for Java
随着web 服务、SOA 概念的兴起,和诸多 SOA 应用的实践,Java 阵营也审时度势,趁势推出相应的 API 以应对这一变化。SOAP 是 Java web 服务栈中很基础的一项技术,web 服务间以 SOAP 消息来互相通信。
SOAP with Attachments API for Java(简称 SAAJ) 就是 Java 阵营为访问 web 服务所提供的基础设施,它简化了对 SOAP 的处理。
SAAJ 包含 2 部分 APIs,其一用于创建消息,添加消息内容,其二则用于建立连接,发送 SOAP 消息。
Categorized in: SOA · Tagged with: SAAJ, SOAP, Webservice, XML
XML 中的 schemaLocation 属性究竟是什么意思?
在 XML 实例文档中有时会发现有 schemaLocation 属性。很多人对此非常疑惑,搞不清这个属性究竟是什么意思,究竟该如何使用。 schemaLocation 属性用来引用(schema)模式文档,解析器可以在需要的情况下使用这个文档对 XML 实例文档进行校验。它的值(URI)是成对出现的,第一个值表示命名空间,第二个值则表示描述该命名空间的模式文档的具体位置,两个值之间以空格分隔。当然,在必要情况下,可以为 schemaLocation 属性指派多个这样的值对。 <p:Person xmlns:p=”http://contoso.com/People” xmlns:v=”http://contoso.com /Vehicles” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation= “http://contoso.com/People http://contoso.com/schemas/people.xsd http://contoso.com/schemas/Vehicles http://contoso.com/schemas/vehicles.xsd http://contoso.com/schemas/People http://contoso.com/schemas/people.xsd”> <name>John</name> <age>28</age> <height>59</height> <v:Vehicle> <color>Red</color> <wheels>4</wheels> <seats>2</seats> </v:Vehicle> </p:Person> 如果为没有目标命名空间的模式文档指定位置,需用 noNamespaceSchemaLocation 属性.
Categorized in: SOA · Tagged with: schema, XML
SMTP Transport Binding for SOAP
SOAP 除了可以 bind 到 HTTP 上外, 也可以 bind 到 SMTP 上. 其实个人感觉, SOAP bind 到 SMTP 上的场景很少会使用到, 通常限于 one-way operation (比如通知等不需要响应). 如果需要实现 request/response, 那么是需要多做一些工作的(下文会有叙述). soap:binding element 的 transport 属性需指定一个 http://xxx(例如:http://schemas.xmlsoap.org/soap/smtp) URL 来表明所要 binding 的 protocol. 似乎这个 URL 是任意形式, 只要能让调用方知道要使用什么协议即可. 在 soap:address 要给定 mailto:xxxx@xxx.xxx 这样形式的 URI. <service name=”StockQuoteServiceBinding_service”> <port name=”StockQuoteServiceBinding_port” binding=”binding:StockQuoteServiceBinding”> <soap:address location=”mailto:getQuote@test.com”/> </port> </service> 注意: [...]
Categorized in: SOA · Tagged with: SOAP, UDDI, Webservice, WSDL, XML
Which style of WSDL should I use? (reship)
A Web Services Description Language (WSDL) binding style can be RPC or document. The use can be encoded or literal. How do you determine which combination of style and use to use? The author describes the WSDL and SOAP messages for each combination to help you decide.
Categorized in: SOA · Tagged with: schema, SOAP, UDDI, Webservice, WSDL, XML
关于 XML standalone 的解释
XML standalone 定义了外部定义的 DTD 文件的存在性. standalone element 有效值是 yes 和 no. 如下是一个例子: <?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?> <!DOCTYPE s1 PUBLIC “http://www.ibm.com/example.dtd” “example.dtd”> <s1>………</s1> 值 no 表示这个 XML 文档不是独立的而是依赖于外部所定义的一个 DTD. 值 yes 表示这个 XML 文档是自包含的(self-contained).
Categorized in: Java, SOA · Tagged with: Java, XML
Java 程序中如何对 XML 文档进行验证?
Table Of Content Introduction Validation when parsing Validation against preparsed schema Validate a DOMSource or SAXSource against preparsed schema Introduction XML 作为一种数据存储和描述语言,这些年得到了广泛运用,尤其以web服务为代表。XML之所以广受欢迎,原因之一是它具有丰富的数据描述手段,你甚至可以对要存储的数据做出各种限制: 字符串长度,数字大小,等等。 最早的XML使用DTD(Document Type Definition)进行定义,后来人们又发明了XML Schema。XML Schema本质上也是一种XML,这相比DTD大大减少了学习曲线,而且XML Schema提供了更丰富的校验机制。 参看《XML Schema 与 XML DTD 的技术比较与分析》,有更详细的比较。

(
(4.00 out of 5)