¶ÁÈ¡xmlʱ EntityName ʱ³ö´í
public static Hashtable xml_unserialize(string strXml)
{
//¼ÓÉÏÏÂÃæÕâ¾ä¾ÍºÃÁË
strXml = strXml.Replace("&", "&");
Hashtable ht = new Hashtable();
XmlDocument XMLDom = new XmlDocument();
XMLDom.LoadXml(strXml);
XmlNode newXMLNode = XMLDom.SelectSingleNode("root");
int i = 0;
foreach (XmlNode xn in newXMLNode.ChildNodes)
{
ht.Add(i++, xn.InnerText);
}
return ht;
}
> ºÍ < ÕâÀà×Ö·ûÊÇXML ±ê¼Ç×Ö·û£¬ÔÚ XML ÖÐÓÐÌØÊâµÄº¬Òå¡£µ±ÔÚ SQL ²éѯ£¨»ò XPath ²éѯ£©ÖÐÖ¸¶¨ÕâЩ×Ö·ûʱ£¬±ØÐë¶ÔËüÃǽøÐÐÊʵ±µÄ±àÂ루Ҳ³ÆÎªÊµÌå±àÂ룩¡£Ï±íÁгöÁËÕâÐ©ÌØÊâ×Ö·û²¢ÃèÊöÁËËüÃǵĺ¬Òå¡£Óйظü¶àÐÅÏ¢£¬Çë²Î¼û XML 1.0 ¹æ·¶ ÖÐµÄ XML 1.0 ¹æ·¶¡£
ÌØÊâ×Ö·û ÌØÊ⺬Òå ʵÌå±àÂë
> ¿ªÊ¼±ê¼Ç >
< ½áÊø±ê¼Ç <
" ÒýºÅ "
' ƲºÅ '
& "&"·û &
XML ½ÚµãÖв»Äܰüº¬ÕâÐ©ÌØÊâ×Ö·û£¬“&”£¬“<”£¬“>”£¬²»È»½âÎöʱ´ËXML»á±¨´í£¬Ê¹ÓÃʱÐèÒª¶ÔËüת»»ÏÂwww.kobsky.cn СÑÛÊÀ½çãÚ$¡qyßTL
Ïà¹ØÎĵµ£º
--XQuery »ùÓÚÏÖÓÐµÄ XPath ²éѯÓïÑÔ£¬²¢Ö§³Ö¸üºÃµÄµü´ú¡¢¸üºÃµÄÅÅÐò½á¹ûÒÔ¼°¹¹Ôì±ØÐèµÄ XML µÄ¹¦ÄÜ¡£
--1.ÉùÃ÷Ò»¸ö xml ÀàÐ͵ıäÁ¿£¬È»ºóʹÓà xml Êý¾ÝÀàÐ굀 query() ·½·¨À´²éѯ´Ë±äÁ¿
DECLARE @x xml
SET @x = '<ROOT><a>111</a></ROOT>'
SELECT @x.query('/ROOT/a')
--²éÕÒÊôÐÔaid=20µÄa½ ......
C#ÐòÁл¯xml
¹Ø¼ü²½Ö裺
XmlSerializer xSerializer = new XmlSerializer(typeof(MyObj));
StringWriter sWriter = new StringWriter(CultureInfo.InvariantCulture);
XmlTextWriter xTextWriter = new XmlTextWriter(sWriter);
......
<!-- xml¸ñʽ
<foo xmlns="test">
<bar attr='a'></bar>
<bar attr='b'></bar>
<bar attr='c'></bar>
</foo>
-->
<?php
$dom = new DOMDocument();
if (!$dom->load('attr.xml'))
{
echo "load books.xml failed!<br>";
re ......
½øÈëMyEclipse6.XÏÂ
Ð޸ģºeclipse.ini Îļþ
-Duser.language=en
¸Ä³É
-Duser.language=zh
µ¯³öÌáʾ£ºCtrl+"/"
dtd ÃüÃû¿Õ¼äµÄÌáʾÐÅÏ¢
window-->Preference-->xml-->XML Catalog-->add
Location :sql-map-2.dtd
key type :pubic ID
key:-//ibatis.apache.org//DTD SQL Map 2.0//EN (XMLÎļþÃüÃû¿Õ¼ ......
ºÅ³ÆxmlhelperµÄÒ»¸öÀà
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XMLÎĵµ²Ù×÷¹ÜÀíÆ÷
/// </summary>
public class XMLHelper
{
public X ......