XML ÃüÃû¿Õ¼ä£¨XML Namespaces£©
XML ÃüÃû¿Õ¼ä¿ÉÌṩ±ÜÃâÔªËØÃüÃû³åÍ»µÄ·½·¨¡£
ÃüÃû³åÍ»
ÓÉÓÚ XML ÖеÄÔªËØÃûÊÇÔ¤¶¨ÒåµÄ£¬µ±Á½¸ö²»Í¬µÄÎĵµÊ¹ÓÃÏàͬµÄÔªËØÃûʱ£¬¾Í»á·¢ÉúÃüÃû³åÍ»¡£
Õâ¸ö XML ÎĵµÐ¯´ø×Åij¸ö±í¸ñÖеÄÐÅÏ¢£º
<table>
<tr>
<td>Apples</td>
<td>Bananas</td>
</tr>
</table>
Õâ¸ö XML ÎĵµÐ¯´øÓйØ×À×ÓµÄÐÅÏ¢£¨Ò»¼þ¼Ò¾ß£©£º
<table>
<name>African Coffee Table</name>
<width>80</width>
<length>120</length>
</table>
¼ÙÈçÕâÁ½¸ö XML Îĵµ±»Ò»ÆðʹÓã¬ÓÉÓÚÁ½¸öÎĵµ¶¼°üº¬´øÓв»Í¬ÄÚÈݺͶ¨ÒåµÄ <table> ÔªËØ£¬¾Í»á·¢ÉúÃüÃû³åÍ»¡£
ʹÓÃǰ׺À´±ÜÃâÃüÃû³åÍ»
´ËÎĵµ´øÓÐij¸ö±í¸ñÖеÄÐÅÏ¢£º
<h:table>
<h:tr>
<h:td>Apples</h:td>
<h:td>Bananas</h:td>
</h:tr>
</h:table>
´Ë XML ÎĵµÐ¯´ø×ÅÓйØÒ»¼þ¼Ò¾ßµÄÐÅÏ¢£º
<f:table>
<f:name>African Coffee Table</f:name>
<f:width>80</f:width>
<f:length>120</f:length>
</f:table>
ÏÖÔÚ£¬ÃüÃû³åÍ»²»´æÔÚÁË£¬ÕâÊÇÓÉÓÚÁ½¸öÎĵµ¶¼Ê¹ÓÃÁ˲»Í¬µÄÃû³ÆÀ´ÃüÃûËüÃÇµÄ <table> ÔªËØ (<h:table> ºÍ <f:table>)¡£
ͨ¹ýʹÓÃǰ׺£¬ÎÒÃÇ´´½¨ÁËÁ½ÖÖ²»Í¬ÀàÐ굀 <table> ÔªËØ¡£
ʹÓÃÃüÃû¿Õ¼ä£¨Namespaces£©
Õâ¸ö XML ÎĵµÐ¯´ø×Åij¸ö±í¸ñÖеÄÐÅÏ¢£º
<h:table xmlns:h="http://www.w3.org/TR/html4/">
<h:tr>
<h:td>Apples</h:td>
<h:td>Bananas</h:td>
</h:tr>
</h:table>
´Ë XML ÎĵµÐ¯´ø×ÅÓйØÒ»¼þ¼Ò¾ßµÄÐÅÏ¢£º
<f:table xmlns:f="http://www.w3school.com.cn/furniture">
<f:name>African Coffee Table</f:name>
<f:width>80</f:width>
<f:length>120</f:length>
</f:table>
Óë½ö½öʹÓÃǰ׺²»Í¬£¬ÎÒÃÇΪ <table> ±êÇ©Ìí¼ÓÁËÒ»¸ö xmlns ÊôÐÔ£¬ÕâÑù¾ÍΪǰ׺¸³ÓèÁËÒ»¸öÓëij¸öÃüÃû¿Õ¼äÏà¹ØÁªµÄÏÞ¶¨Ãû³Æ¡£
XML Namespace (xmlns) ÊôÐÔ
XML ÃüÃû¿Õ¼äÊôÐÔ±»·ÅÖÃÓÚij¸öÔªËصĿªÊ¼±êÇ©Ö®ÖУ¬²¢Ê¹ÓÃÒÔϵÄÓï·¨£º
xmlns:namespace-prefix="namespaceURI"
µ±Ò»¸öÃüÃû¿Õ¼ä±»¶¨ÒåÔÚij
Ïà¹ØÎĵµ£º
±¾ÎĹ²Á½¸öÎļþ£ºtranslate.mxml ºÍ mapmarking.xml
1¡¢translate.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="librar ......
ÔںܶàÑÐÌÖ»áºÍÅàѵ°àÉÏÎÒÓöµ½¹ýÐí¶àÈË£¬ËûÃÇ»¹²»Ã÷°×ΪʲôҪʹÓÃXMLÒ²²»ÖªµÀÈçºÎÔÚËûÃǵÄÓ¦ÓÃÖÐʹÓÃXML¡£Ò»Ð©À´×ÔÖîÈçGartner¹«Ë¾µÄ±¨¸æ½¨Òé˵£¬ÉÌÒµ¹«Ë¾²»ÄÜÔÙ×ö¾ÖÍâÈËÁË£¬²»ÄܶÔXMLÖÃÖ®²»Àí¡£Èç¹ûÄ㻹²»Çå³þXMLµ½µ×ÓÐʲôºÃ´¦µÄ»°£¬Äã²¢²»ÊÇΨһµÄÈË¡£
ÎÒ¾ö¶¨°ÑÓëÈËÃǺÍýÌå¹ØÓÚXML»°ÌâµÄ½»Ì¸ÕûÀí³ÉÎÄ£¬ÁгöXMLÔÚÓ¦ÓÃÖ ......
ÔÚJ2MEÌåϵÖУ¬¶ÔxmlµÄ½âÎöÓбȽÏÓÐÃûµÄµÚÈý·½½âÎöAPI£¬·Ö±ðΪKXMLºÍNanoXML£¬ËûÃǶ¼ÌṩÁ˶ԽâÎöxmlµÄÖ§³Ö¡£KXMLÔÚ½âÎöXML¹ý³ÌÖлá¶ÔÎļþÄÚÈÝÒ»²ãÒ»²ã½øÐнâÎö£¬Òò´Ë³ÉΪÔöÁ¿Ê½½âÎöÆ÷£¬±È½ÏÊʺϴóÎļþµÄ½âÎö¡£¶øNanoXMLÊÇÒ»´ÎÐÔ½âÎöÆ÷£¬ÔÚÒ»´Îʱ¼äÀï¾Í°ÑÕû¸öxmlÎĵµ½âÎöÍ꣬Òò´Ë²»ÊʺϴóÎļþµÄ½âÎö£¬»áÔì³ÉÄÚ´æ²»×ãµÄÏÖÏó¡ ......
Ó¦Ò»¸öͬʵÄÒªÇó£¬ÒªÀûÓÃstrtusµÄAction½«Ò»¸öÊý¾Ý¿â±íµÄÊý¾ÝÊä³öΪxml¸ñʽµÄÊý¾Ý£¬·½±ãµ¼ÈëʹÓ᣾Ñо¿Action»¹ÕæÄÜ°ìµ½£¬Êµ¼ÊÉϲ»ÊÇActionµÄ¹¦ÀÍ£¬¶øÊÇJDOMµÄ¹¦ÀÍ£¬²»ËµÄÇô¶àÁË£¬¸ø´ó¼Ò·ÖÏíһϡ£ ÎÒÓÐÒ»¸ö²âÊÔ±í£¬ÓÐÁ½¸ö×ֶΣ¬Ò»¸öÊÇÓû§Ãû£¬Ò»¸öÊÇÃÜÂ룬ÏÖ½«Õ⸠......
½ñÌì´ÓÊý¾Ý¿âÖвéѯ³öxml£¬Í¬Ê±Ìí¼ÓÒ»¸ö¸ù½Úµã
×öÁËÈçϲâÊÔ£º
create table TestXmlQuery(
ID int identity(1,1) not null,
Name varchar(10)
)
go
insert into [TestXmlQuery] (Name) values('²âÊÔ1')
insert into [TestXmlQuery] (Name) values('²âÊÔ2')
insert into [TestXmlQuery] (Name) values('²âÊÔ3')
......