xmlÎļþ½á¹¹
Ò»¸öXMLÎļþͨ³£°üº¬ÎļþÍ·ºÍÎļþÌåÁ½´ó²¿·Ö
1. ÎļþÍ·
XMLÎļþÍ·ÓÉXMLÉùÃ÷ÓëDTDÎļþÀàÐÍÉùÃ÷×é³É¡£ÆäÖÐDTDÎļþÀàÐÍÉùÃ÷ÊÇ¿ÉÒÔȱÉٵģ¬¹ØÓÚDTDÉùÃ÷½«ÔÚºóÐøµÄÄÚÈÝÖнéÉÜ£¬¶øXMLÉùÃ÷ÊDZØÐëÒªÓеģ¬ÒÔʹÎļþ·ûºÏXMLµÄ±ê×¼¹æ¸ñ¡£
ÔÚÇ°ÃæµÄFlowers.xmlÎļþÖеĵÚÒ»ÐдúÂ뼴ΪXMLÉùÃ÷£º
<?xml °æ±¾ÐÅÏ¢ £¨±àÂëÐÅÏ¢£© Îĵµ¶ÀÁ¢ÐÔÐÅÏ¢ ?>
°æ±¾ÐÅÏ¢ÓÃÓÚ˵Ã÷xmlÓïÑÔÊÇÓõİ汾£¬°æ±¾Îª1.0»òÕß1.1 £ºversion="1.0"
±àÂëÐÅÏ¢ÓÃÓÚ˵Ã÷xmlµÄ±àÂëÓïÑÔ£¬Èç¹ûΪÖÐÎÄÔò±íʾΪ£ºencoding="gb2312"
Îĵµ¶ÀÁ¢ÐÔÐÅÏ¢ÓÃÓÚ˵Ã÷xmlÎļþÊÇ·ñ¿ÉÒÔ¶ÀÁ¢¶ø²»ÒÀÀµÆäËüÎĵµ£ºstandalone="yes"±íʾ¶ÀÁ¢ÏÔʾ
<?xml version="1.0" encoding="gb2312"?>
ÆäÖУº
“<?”´ú±íÒ»ÌõÖ¸ÁîµÄ¿ªÊ¼£¬“?>”´ú±íÒ»ÌõÖ¸ÁîµÄ½áÊø£»
“xml”´ú±í´ËÎļþÊÇXMLÎļþ£»
“ version="1.0" ”´ú±í´ËÎļþÓõÄÊÇXML1.0±ê×¼£»
“ encoding="gb2312" ” ´ú±í´ËÎļþËùÓõÄ×Ö·û¼¯£¬Ä¬ÈÏֵΪUnicode£¬Èç¹û¸ÃÎļþÖÐÒªÓõ½ÖÐÎÄ£¬¾Í±ØÐ뽫´ËÖµÉ趨Ϊgb2312¡£
×¢Ò⣺XMLÉùÃ÷±ØÐë³öÏÖÔÚÎĵµµÄµÚÒ»ÐС£
ÎĵµÀàÐÍÉùÃ÷£º
1¡£ÔÚÆäËûÎļþÖÐÉùÃ÷ÎĵµÀàÐÍ
<!DOCTYPE MYDOC SYSTEM "mydoc.dtd">
2¡£ÔÚxmlÎĵµÖÐÖ±½Ó¶¨ÒåÎĵµÀàÐÍ
<!DOCTYPE BIDS [ <!ELEMENT AUCTIONBLOCK(ITEMS,BIDS)> ]>
xmlÔ¤¶¨ÒåʵÌ壺
ʵÌåÒýÓ÷½Ê½ ´ú±íµÄÔªËØ
& &
< <
> >
' ,
quot; "
×Ö·ûÊý¾Ý¶Î£º
xmlÖв»Ï£Íûxml´¦ÀíµÄÎÄ×ÖƬ¶Ï»òÕß´úÂ룬½Å±¾Æ¬¶Î¡£
×Ö·ûÊý¾Ý¶Î="<!CDATA["+×Ö·ûÊý¾Ý+"]]>"
×Ö·ûÊý¾Ý¶Î±ØÐë·ÅÔÚ¸ùÔªËØÖУº
ÀýÈ磺
<?xml version="1.0" standalone="yes"?>
<Root>
<head>my test</head>
<![CDATA[<html><body>cdata test !</body></html>]]>
</Root>
ÓÃä¯ÀÀÆ÷´ò¿ª½á¹ûÈçÏ£º
<?xml version="1.0" standalone="yes" ?>
- <Root>
<head>my test</head>
- <![CDATA[
<html><body>cdata test !</body></html> ]]>
</Root>
ÒýÓ÷ÖΪʵÌåÒýÓã¬×Ö·ûÒýÓá£
ʵÌåÒýÓÃÊ×ÏÈÐèÒªÉùÃ÷£¬È»ºó½øÐÐÒýÓ
Ïà¹ØÎĵµ£º
private void CreateNewXmlNode()
{
String strFileName = string.Empty;
strFileName = this.strCurrentPath + "System.xml";
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.Load(strFileName);
......
ºìÉ«×ÖÌåΪÖ÷Òª´úÂë
jspÒ³ÃæÖÐ
<script language="javascript">
function updateDB(operate){
var objDom=new ActiveXObject("msxml.DomDocument");
var objRoot=objDom.createElement("All");
objDom.appendChild(objRoot);
var k=document.ge ......
private ClassLoader xmlLoader = Thread.currentThread().getContextClassLoader();
private void parseXML(String resource){
resource = StringUtils.substring(resource,resource.indexOf(":")+1,resource.length());
InputStream inputStream = xmlLoader.getResourceAsStream(resou ......
/// <summary>
/// DataTable-------------------->XML --String
/// </summary>
public static String ToXmlString(DataTable dt)
{
StringWriter tr = new StringWriter();
try
{
dt.WriteXml(tr); ......