Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

[ת]XMLÏê½â Schema

ÓÐÈË»áÎÊ£¬DTDºÍSchema¶¼ÊǶÔXMLÎĵµµÄÒ»ÖÖÔ¼Êø£¬ÎªÊ²Ã´²»¾ÍÑ¡ÆäÖÐÖ®Ò»£¬¶øÓÖÓÐSchemaÄØ¡£ÒòΪDTD°²È«¶ÈÌ«µÍÁË£¬Ò²¾ÍÊÇ˵ËüµÄÔ¼Êø¶¨ÒåÄÜÁ¦²»×㣬ÎÞ·¨¶ÔXMLʵÀýÎĵµ×ö³ö¸üϸÖµÄÓïÒåÏÞÖÆ¡£ÆäʵϸÐĵÄÈ˻ᷢÏÖ£¬ÔÚDTDÖУ¬Ö»ÓÐÒ»¸öÊý¾ÝÀàÐÍ£¬¾ÍÊÇPCDATA£¨ÓÃÔÚÔªËØÖУ©ºÍCDATA£¨ÓÃÔÚÊôÐÔÖУ©£¬ÔÚÀïÃæдÈÕÆÚÒ²ÐУ¬Êý×Ö»¹ÐУ¬×Ö·û¸üÊÇûÎÊÌâ¡£¶øSchemaÕýÊÇÕë¶ÔÕâЩDTDµÄȱµã¶øÉè¼ÆµÄ£¬SchemaÊÇÍêȫʹÓÃXML×÷ΪÃèÊöÊֶΣ¬¾ßÓкÜÇ¿µÄÃèÊöÄÜÁ¦£¬À©Õ¹ÄÜÁ¦ºÍ´¦Àíά»¤ÄÜÁ¦µÈ¡£ÏÂÃæÈÃÎÒÃÇ¿´Ò»¸ö¼òµ¥µÄÀý×Ó°É£º
hello.xml
-------------------
<?xml version="1.0"?>
<greeting>Hello World!!</greeting>
 
˵Ã÷£º
Ò»¸ö¸ùÔªËØ£ºgreeting£»ÇÒÕâ¸öÔªËز»º¬ÊôÐÔ£¬ÎÞ×ÓÔªËØ£¬ÄÚÈÝÊÇ×Ö·û´®¡£
hello.xsd
£­£­£­£­£­£­£­£­£­£­
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="greeting" type="xsd:string"/>
</xsd:schema>
˵Ã÷£º
XML SchemaÎĵµºó׺ÃûÊÇ.xsd£¬ÍêÈ«·ûºÏXMLÓï·¨£¬¸ùÔªËØÊÇschema£¬ÃüÃû¿Õ¼äxmlns:xsd="http://www.w3.org/2001/XMLSchema£¬ÓÃÔªËØ<element>¶¨ÒåʵÀýÎĵµÖеÄÔªËØ£¬Èçgreeting¡£xsd:string¾ÍÊǶ¨ÒåµÄÊý¾ÝÀàÐÍÁË£¬ÆäÖеÄÊý¾ÝÀàÐÍÓкܶ࣬±ÈÈ磺int,double,dateTime,Boolean,long,integer,float,µÈ£¬×ÜÖ®JavaµÈÓïÑÔÀïÓеÄÊý¾ÝÀàÐÍËü¶¼ÓУ¬µ«ÒªÒÔ“xsd:”¿ªÍ·¡£
ÈÃÎÒÃÇÔÙ¿´Ò»¸öÀïÃæÓÐ×ÓÎÞËصÄÀý×Ó£º
customer.xml
-----------
<customer>
<name>teiki</name>
<address>No.237, Road Waitan, Shanghai</address>
</customer>
Ôò¿ÉÒÔд³öÒÔϵÄXML SchemaÎĵµ£º
customer.xsd
----------------
1: <?xml version="1.0"?>
2: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3: <xsd:element name="customer">
4: <xsd:complexType>
5: <xsd:sequence>
6: <xsd:element name="name" type="xsd:string"/>
7: <xsd:element name="address" type="xsd:string" />
8: </xsd:sequence>
9: </xsd:complexType>
10: </xsd:element>
11: </xsd:schema>
˵Ã÷£º
ʵÀýÎĵµcustomer.xmlÖУ¬<customer>ÔªËغ¬ÓÐÁ½¸ö×ÓÔªËØ£¬ÔÚSchemaÖз²ÊÇÓÐÁ½¸öÒÔÉϵÄ×ÓÔªËØ£¬¾ÍÈÏΪÊ


Ïà¹ØÎĵµ£º

ÓÃSAXReader½âÎöxmlÎĵµ

     ʹÓÃSAXReaderÐèÒªµ¼Èëdom4j-full.jar°ü¡£
     dom4jÊÇÒ»¸öJavaµÄXML API£¬ÀàËÆÓÚjdom£¬ÓÃÀ´¶ÁдXMLÎļþµÄ¡£dom4jÊÇÒ»¸ö·Ç³£·Ç³£ÓÅÐãµÄJava XML API£¬¾ßÓÐÐÔÄÜÓÅÒì¡¢¹¦ÄÜÇ¿´óºÍ¼«¶ËÒ×ÓÃʹÓõÄÌص㣬ͬʱËüÒ²ÊÇÒ»¸ö¿ª·ÅÔ´´úÂëµÄÈí¼þ£¬¿ÉÒÔÔÚSourceForgeÉÏÕÒµ½Ëü¡£
 &n ......

XML×Ö·û´®ºÍXML DOCUMENTµÄÏ໥ת»»¡¾×ª¡¿

ÔÚ×öÒ»°ãµÄXMLÊý¾Ý½»»»¹ý³ÌÖУ¬ÎÒ¸üÀÖÒâ´«µÝXML×Ö·û´®£¬¶ø²»ÊǸñʽ»¯µÄXML Document¡£Õâ¾ÍÉæ¼°µ½XML×Ö·û´®ºÍXml DocumentµÄת»»ÎÊÌ⣬˵°×ÁËÕâÊǸöºÜ¼òµ¥µÄÎÊÌ⣬±¾Îľ͸÷ÖÖXML½âÎöÆ÷·Ö±ðÁоÙÈçÏ£¬ÒÔ·½±ã×Ô¼º½ñºó²éÔÄ¡£
Ò»¡¢Ê¹ÓÃ×îԭʼµÄjavax.xml.parsers£¬±ê×¼µÄjdk api
// ×Ö·û´®×ªXML
String xmlStr = "......";
S ......

SAXReaderµÄÖ÷ÒªÓ÷¨£¨XML£©


java ´úÂë
package com.dc.framework.taglib;   
import java.io.FileInputStream;   
import java.io.FileNotFoundException;   
import java.util.HashMap;   
import java.util.Iterator;   
import java.util.List; &nb ......

JAVA²Ù×÷XMLµÄÍêÕûÀý×Ó(²éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý)

ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="GBK"?>
<books>
<book>
<name>¹þÀﲨÌØ</name> ......

InfoPath¿ª·¢£º»ñÈ¡XMLÎļþÖеÄÊý¾Ý

±¾ÎÄʾÀýÔ´´úÂë»òËزÄÏÂÔØ
¡¡¡¡±¾½ÚµÄÄÚÈÝ£º
¡¡¡¡ÈçºÎÔÚInfoPathÖÐʹÓÃÊý¾ÝÁ¬½ÓÀ´´ÓXMLÎļþÖлñÈ¡Êý¾Ý
¡¡¡¡ÈçºÎͨ¹ý´úÂëÀ´ÐÞ¸ÄÊý¾ÝÁ¬½ÓÖеÄXMLÎļþ·¾¶
¡¡¡¡´ò¿ªVisual Studio 2008£¬ÒÔ“InfoPath 2007±íµ¥Ä£°å”ΪÏîÄ¿Ä£°åн¨Ò»¸öÏîÄ¿¡£
¡¡¡¡ÏîÄ¿´´½¨Íêºó£¬¾Í»á¿´µ½Ò»¸ö¿Õ¿ÕÈçÒ²µÄmainifest.xsfÎļþ£¬Õâ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ