
2012年8月14日
1.logger.info(LogUtils.getLogFmt("ResponseXML", "ResultCode",
"ErrorDesc", "ServiceType", "Version"), new Object[] {
rs.getResponseXML(), rs.getResultCode(), rs.getErrorDesc(),
rs.getServiceType(), rs.getVersion() });
2.logger.error("error when call webservice: " + serviceType, e);
3.logger.info(LogUtils.getLogFmt("RequestXML"), requestXML);
posted @
2012-09-04 18:44 小熊寶貝的每一天 閱讀(185) |
評(píng)論 (0) |
編輯 收藏
ID屬性的聲明必須被置于最后<xs:attribute name="orderid" type="xs:string" use="required"/>
ComplexContent的用法:
<?xml version="1.0" encoding="UTF-8"?>
<xs:element name="employee" type="fullpersoninfo"/>
<xs:complexType name="personinfo">
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="fullpersoninfo">
<xs:complexContent>
<xs:extension base="personinfo">
<xs:sequence>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
posted @
2012-08-21 17:23 小熊寶貝的每一天 閱讀(182) |
評(píng)論 (0) |
編輯 收藏
1.
準(zhǔn)確說是一種Java XML數(shù)據(jù)綁定技術(shù)。
http://www.iteye.com/topic/582459:
<bind-xml name="borndate" node="attribute"/> ,name規(guī)定了這個(gè)值在xml中的顯示名,而node規(guī)定了該值的xml存儲(chǔ)方式,這里是用attribute形式進(jìn)行存儲(chǔ),即寫到了結(jié)點(diǎn)的屬性里。
2.Castor介紹----比較詳細(xì)易懂的BLOG:
http://www.open-open.com/lib/view/open1326514404093.htmlmapping.xml配置如下:
01 | <? xml version = "1.0" encoding = "UTF-8" ?> |
02 | <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd"> |
04 | < class name = "com.hoo.entity.Account" auto-complete = "true" > |
05 | < map-to xml = "Account" /> |
07 | < field name = "id" type = "integer" > |
08 | < bind-xml name = "id" node = "attribute" /> |
11 | < field name = "name" type = "string" > |
12 | < bind-xml name = "name" node = "element" /> |
15 | < field name = "email" type = "string" > |
16 | < bind-xml name = "email" node = "element" /> |
19 | < field name = "address" type = "string" > |
20 | < bind-xml name = "address" node = "element" /> |
23 | < field name = "birthday" type = "com.hoo.entity.Birthday" > |
24 | < bind-xml name = "生日" node = "element" /> |
28 | < class name = "com.hoo.entity.Birthday" > |
29 | < map-to xml = "birthday" /> |
31 | < field name = "birthday" type = "string" > |
32 | < bind-xml name = "birthday" node = "attribute" /> |
首先,看看這個(gè)xml文檔的根元素是mapping,在mapping中可以配置class。也就是我們要轉(zhuǎn)換的JavaObject的配置描述了。
class元素的name屬性就是配置的JavaObject的classpath路徑了。
關(guān)于class元素的auto-complate屬性,如果這個(gè)屬性的值為ture。那么編組后的xml,castor會(huì)自動(dòng)給沒有在mapping配置文件進(jìn)行配置的屬性自動(dòng)編組(轉(zhuǎn)換)到xml中。如果為false,那么在mapping配置文件中出現(xiàn)的屬性將在編組后不現(xiàn)在在編組后的xml中。
map-to就是當(dāng)前class編組后的xml文檔的節(jié)點(diǎn)元素名稱。
field就是描述JavaObject中的屬性,name是Java對(duì)象的屬性名稱,type是類型。關(guān)于配置的type類型也有規(guī)定,你可以參考:http://www.castor.org/xml-mapping.html的field配置講解。
而field還有其他的屬性配置,如get-method應(yīng)該是getter方法、set-method應(yīng)該是setter的方法、has-mehtod 應(yīng)該是hashCode方法,有時(shí)候我們不一定要提高getter、setter方法,我們需要用自己的方法名稱來代替setter、getter。如果當(dāng)前field配置的是集合類型,那么你需要給field元素配置collection屬性。
bind-xml就是綁定(編組)成xml后的xml內(nèi)容的描述,name就是編組后xml的節(jié)點(diǎn)元素名稱,node有2個(gè)值,分別是 attribute、element。attribute是屬性,它會(huì)在節(jié)點(diǎn)元素的屬性中顯示,例如:<account id=”2”></account>
而element則是單獨(dú)的一個(gè)元素,例如:<account><id>2</id></account>
就這個(gè)樣子的。
mapping.xml還可以有其他標(biāo)簽,如:
<include href="other_mapping_file.xml"/>
導(dǎo)入外部xml文件,可以分多個(gè)配置。
posted @
2012-08-21 16:01 小熊寶貝的每一天 閱讀(310) |
評(píng)論 (0) |
編輯 收藏
AnyURI 數(shù)據(jù)類型(AnyURI Data Type)
anyURI 數(shù)據(jù)類型用于規(guī)定 URI。
下面是一個(gè)關(guān)于某個(gè) scheme 中 anyURI 聲明的例子:
<xs:attribute name="src" type="xs:anyURI"/>
文檔中的元素看上去應(yīng)該類似這樣:
<pic src="http://www.w3school.com.cn/images/smiley.gif" />
XML Schema 是基于 XML 的 DTD 替代者。
XML Schema 描述 XML 文檔的結(jié)構(gòu)。
XML Schema 語(yǔ)言也稱作 XML Schema 定義(XML Schema Definition,XSD)。
在此教程中,你將學(xué)習(xí)如何在應(yīng)用程序中讀取和創(chuàng)建 XML Schema 語(yǔ)言,XML Schema 為何比 DTD 更加強(qiáng)大,以及如何在您的應(yīng)用程序中使用 XML Schema。
XML中的Schema元素詳解:
http://www.w3school.com.cn/schema/schema_schema.asp
posted @
2012-08-15 13:07 小熊寶貝的每一天 閱讀(195) |
評(píng)論 (0) |
編輯 收藏
XML Schema:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3school.com.cn"
xmlns="http://www.w3school.com.cn"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
定義簡(jiǎn)易元素
定義簡(jiǎn)易元素的語(yǔ)法:
<xs:element name="xxx" type="yyy"/>
xs:stringxs:decimalxs:integerxs:booleanxs:datexs:time
定義屬性
<xs:attribute name="lang" type="xs:string" fixed="EN"/>
限定(restriction)用于為 XML 元素或者屬性定義可接受的值。對(duì) XML 元素的限定被稱為 facet。
使用 extension 或 restriction 元素來擴(kuò)展或限制元素的基本簡(jiǎn)易類型。
posted @
2012-08-14 17:49 小熊寶貝的每一天 閱讀(205) |
評(píng)論 (0) |
編輯 收藏
WSDL是Web Service的描述語(yǔ)言,是一種接口定義語(yǔ)言,用于描述Web Service的接口信息等。WSDL元素
[1]基于XML語(yǔ)法描述了與服務(wù)進(jìn)行交互的基本
元素:
Type(消息類型):數(shù)據(jù)類型定義的容器,它使用某種類型系統(tǒng)(如XSD)。
Message(消息):通信數(shù)據(jù)的抽象類型化定義,它由一個(gè)或者多個(gè)part組成。
Part:消息參數(shù)
Operation(操作):對(duì)服務(wù)所支持的操作進(jìn)行抽象描述,WSDL定義了四種操作:
1.單向(one-way):端點(diǎn)接受信息;2.請(qǐng)求-響應(yīng)(request-response):端點(diǎn)接受消息,然后發(fā)送相關(guān)消息;3.要求-響應(yīng)(solicit-response):端點(diǎn)發(fā)送消息,然后接受相關(guān)消息;4.通知(notification
):端點(diǎn)發(fā)送消息。
Port Type (端口類型):特定端口類型的具體協(xié)議和數(shù)據(jù)格式規(guī)范。
Binding:特定端口類型的具體協(xié)議和
數(shù)據(jù)格式規(guī)范
Port :定義為綁定和網(wǎng)絡(luò)地址組合的單個(gè)端點(diǎn)。
Service:相關(guān)端口的集合,包括其關(guān)聯(lián)的接口、操作、消息等。
posted @
2012-08-14 14:57 小熊寶貝的每一天 閱讀(188) |
評(píng)論 (0) |
編輯 收藏