锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲av日韩综合一区久热,亚洲国产片在线观看,日韩一卡2卡3卡4卡新区亚洲http://m.tkk7.com/andyj2ee/category/7407.htmljava tec skyzh-cnTue, 27 Feb 2007 12:58:43 GMTTue, 27 Feb 2007 12:58:43 GMT60浣跨敤XMLBeans 榪涜java 鏁版嵁姊嗗畾http://m.tkk7.com/andyj2ee/articles/30628.htmljava鍏夌幆java鍏夌幆Tue, 14 Feb 2006 08:13:00 GMThttp://m.tkk7.com/andyj2ee/articles/30628.htmlhttp://m.tkk7.com/andyj2ee/comments/30628.htmlhttp://m.tkk7.com/andyj2ee/articles/30628.html#Feedback0http://m.tkk7.com/andyj2ee/comments/commentRss/30628.htmlhttp://m.tkk7.com/andyj2ee/services/trackbacks/30628.html榪涘叆瀹炶返涔嬪墠錛屾渶濂芥壘綃囨枃绔犲厛浜嗚В涓涓?xmlbeans 鏄敤鏉ュ仛浠涔堢殑
鍙傝冭祫鏂欙細http://xmlbeans.apache.org/
鍙傝冩枃绔狅細XML-Java Data Binding Using XMLBeans

xmlbeans bea 璐$尞鐨勪竴涓紑婧愰」鐩紝鐩殑鏄嬌xml 鏂囦歡鐩存帴杞寲涓簀ava 瀵硅薄錛屽java 瀵硅薄鐨勬搷浣滃彲鐩存帴瀛樹負xml 鏂囦歡錛岀渷鍘諱簡鏂囨。楠岃瘉榪囩▼銆?BR>瀹炵幇鍘熺悊錛氬厛瀹氫箟 xml schema descripter ,緙栬瘧瀹氫箟鐨?*.xsd 鏂囦歡錛屽紩鍏ョ紪璇戝悗鐢熸垚鐨?jar 鍖呫備笌 xmlbeans-Home\lib\xbean.jar  灝卞彲浠ュ湪寮鍙戦」鐩腑浣跨敤浜嗐?BR>

  1. Install XMLBeans.
  2. Compile your schema. Use scomp to compile the schema, generating and jarring Java types. For example, to create a employeeschema.jar from an employeesschema.xsd file:
    scomp -out employeeschema.jar employeeschema.xsd
  3. Write code. With the generated JAR on your classpath, write code to bind an XML instance to the Java types representing your schema. Here's an example that would use types generated from an employees schema:
    File xmlFile = new File("c:\employees.xml"); 
    
    // Bind the instance to the generated XMLBeans types.
    EmployeesDocument empDoc = 
    	EmployeesDocument.Factory.parse(xmlFile); 
    
    // Get and print pieces of the XML instance.
    Employees emps = empDoc.getEmployees(); 
    Employee[] empArray = emps.getEmployeeArray(); 
    for (int i = 0; i < empArray.length; i++) 
    { 
    	System.out.println(empArray[i]); 
    }
瀹炶返涓亣鍒扮殑闂錛?BR>濡備綍淇敼緙栬瘧shema 浜х敓鐨刯ava 綾葷殑package 鐩綍緇撴瀯錛?/FONT>


鍙傝冿細http://wiki.apache.org/xmlbeans/XmlBeansFaq#configPackageName

Can I change the default package names for the java classes generated from my schema?

You can create a file that ends in .xsdconfig to map targetnamespace to packagename. Put the .xsdconfig file in the same directory as the .xsd that you are compiling. Here is an example .xsdconfig:

<!-- An xsdconfig file must begin with a "config" element in the 
        http://www.bea.com/2002/09/xbean/config namespace. Also, be sure
        to declare any namespaces used to qualify types in your schema (here,
        the namespace corresponding to the pol prefix. -->
<xb:config xmlns:pol="http://openuri.org/easypoLocal" 
    xmlns:xb="http://www.bea.com/2002/09/xbean/config">

    <!-- Use the "namespace" element to map a namespace to the Java package
        name that should be generated. -->
    <xb:namespace uri="http://openuri.org/easypoLocal">
        <xb:package>org.openuri.easypo.xsdconfig</xb:package>
    </xb:namespace>

    <!-- Use the "qname" element to map schema type names to generated
        Java type names. In these examples, the name attribute's value is the
        XML element name; the javaname attribute's value is the Java type 
        that should be generated. -->
    <xb:qname name="pol:CUST" javaname="Customer"/>
    <xb:qname name="pol:PURCH_ORDER" javaname="PurchaseOrder"/>
</xb:config>

Notice that you can also map specific element/attribute names to java names.

/!\ Note: If schema doesn't include targenamespace then use

<xb:namespace uri="##any">
  <xb:package>org.openuri.easypo.xsdconfig</xb:package>
</xb:namespace>

to specify package names

/!\ Note: XmlBeans doesn鈥檛 support using two or more sets of java classes (in different packages) mapped to schema types/elements that have the same names and target namespaces, using all in the same class loader. Depending on the direction you are using for the java classes to schema types mapping, some features might not work correctly. This is because even though the package names for the java classes are different, the schema location for the schema metadata (.xsb files) is the same and contains the corresponding implementing java class, so the JVM will always pick up the first on the classpath. This can be avoided if multiple class loaders are used.


鍏堢湅涓涓?scomp 鍛戒護: xmlbeans-home/bin 瑕佸姞鍏ュ埌path 涓紝

scomp 鍙傛暟鍥?BR>緙栧啓鑷繁鐨剆chema鏂囦歡錛歸eather_latlong.xsd
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ct
="http://beans.jhalo.com"
targetNamespace
="http://beans.jhalo.com"
elementFormDefault
="qualified">
<!-- This XML Schema describes xml documents
containing either weather details or latlong
details of a location based on Zipcode Two Global
elements Weather and Latlong, and one Global
Attribute Zipcode are declared.
-->
 
<xsd:element name="Weather">
  
<xsd:complexType>
   
<xsd:sequence>
    
<xsd:element name="Temperature"
         type
="xsd:float"/>
    
<xsd:element name="Humidity"
         type
="xsd:float"/>
    
<xsd:element name="Visibility"
         type
="xsd:float"/>
    
<xsd:element name="Datetime"
         type
="xsd:dateTime"/>
   
</xsd:sequence>
  
<xsd:attribute ref="ct:Zipcode"/>
 
</xsd:complexType>
 
</xsd:element>
 
<xsd:element name="Latlong">
  
<xsd:complexType>
   
<xsd:sequence>
    
<xsd:element name="Latitude"
         type
="xsd:string"/>
    
<xsd:element name="Longitude"
         type
="xsd:string"/>
    
</xsd:sequence>
   
<xsd:attribute ref="ct:Zipcode"/>
  
</xsd:complexType>
 
</xsd:element>
 
<xsd:attribute name="Zipcode"
         type
="xsd:string"/>
</xsd:schema>


#


2
緙栧啓myconfig.xsdconfig 瀛樻斁鍚屼竴鐩綍


#
<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
           xmlns:ct
="http://beans.jhalo.com">

  
<xb:namespace uri="http://beans.jhalo.com http://services.jhalo.com">
    
<xb:package>org.jhalo</xb:package>
  
</xb:namespace> 

  
<xb:namespace uri="##any">
    
<xb:prefix>Xml</xb:prefix>
    
<xb:suffix>Bean</xb:suffix>
  
</xb:namespace>


  
  
<xb:qname name="ct:Zipcode" javaname="Zip" /> 
  
<xb:qname name="ct:Datetime" javaname="Today" />


</xb:config>


濡傛灉涓嶄嬌鐢╩yconfig.xsdconfig 榪涜緙栬瘧
scomp -out weather.jar weather_latlong.xsd 
鐢熸垚鐨?weather.jar 涓猴細com/jhalo/beans/xxxx


浣跨敤 .xsdconfig 緙栬瘧
scomp -out weather.jar weather_latlong.xsd  myconfig.xsdconfig
鐢熸垚jar 緇撴瀯涓猴細 org/jhalo/

鍦ㄥ啓嫻嬭瘯紼嬪簭鍙戠幇, Datetime -->Today 涔熸敼鍙樹簡銆?BR>
import org.apache.xmlbeans.*;
import org.jhalo.XmlLatlongDocumentBean;
import org.jhalo.XmlWeatherDocumentBean;


XmlWeatherDocumentBean wdoc;
XmlWeatherDocumentBean.Weather w;
wdoc 
= XmlWeatherDocumentBean.Factory.newInstance();
= wdoc.addNewWeather();
w.setToday(Calendar.getInstance());

瀹屾瘯.:)~


]]>
主站蜘蛛池模板: 国产V亚洲V天堂无码| 亚洲熟妇无码一区二区三区| 日韩中文字幕精品免费一区| 台湾一级毛片永久免费 | 亚洲综合伊人久久大杳蕉| 久久免费视频观看| 日本最新免费不卡二区在线| yellow视频免费在线观看| 国产又大又长又粗又硬的免费视频| 亚洲精品无码99在线观看 | 国产色爽免费无码视频| 国产aⅴ无码专区亚洲av麻豆| 日韩精品人妻系列无码专区免费 | 老司机福利在线免费观看| 亚洲V无码一区二区三区四区观看 亚洲αv久久久噜噜噜噜噜 | 亚洲av永久中文无码精品| 亚洲精品中文字幕无码蜜桃| 成人毛片免费观看视频| 两性色午夜免费视频| 亚洲女女女同性video| 亚洲AV日韩AV天堂一区二区三区 | 久久亚洲精精品中文字幕| 国产色爽免费无码视频| 国产亚洲欧美在线观看| 亚洲男人天堂影院| 日韩精品亚洲aⅴ在线影院| 成人免费毛片内射美女APP | 久久激情亚洲精品无码?V| 大学生一级特黄的免费大片视频| 四虎影视成人永久免费观看视频| 成人a毛片视频免费看| 亚洲AV无码AV吞精久久| 免费人成视网站在线观看不卡| 久草免费在线观看视频| 99免费在线视频| 瑟瑟网站免费网站入口| 亚洲精品无码aⅴ中文字幕蜜桃| 亚洲成AV人片久久| 水蜜桃亚洲一二三四在线| 亚洲中文久久精品无码ww16| 又黄又大又爽免费视频|