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

ʲôÊÇxml processing instruction(PI)£¿

from:
http://zhidao.baidu.com/question/67891842.html?si=1
ÏÂÃæµÄÒ»ÐоÍÊÇÔÚµÚ¶þ±¾ÊéµÄ¶¨Òå֮ǰµÄ£º
<?page render multiple authors ?>
ËäÈ»Ëü¿´ÉÏÈ¥ºÜÏñXMLÐòÑÔ£¬µ«Êµ¼ÊÉÏÊÇÒ»ÖÖ³ÆÎª´¦ÀíÖ¸Áprocessing instruction£©µÄ²»Í¬ÀàÐ͵ÄÓï·¨¡£´¦ÀíÖ¸ÁÒÔϼò³ÆPI£©µÄÄ¿µÄÊÇΪÁ˸ø´¦ÀíÒ³ÃæµÄ³ÌÐò£¨ÀýÈçXML½âÎöÆ÷£©Ìṩ¶îÍâµÄÐÅÏ¢¡£PIͨ³£Çé¿öÏÂÊÇûÓй̶¨¸ñʽµÄ£¬Î¨Ò»µÄÒªÇóÊǽôËæµÚÒ»¸öÎʺűØÐëÖÁÉÙÓÐÒ»¸ö×Öĸ¡£ÔÚ´ËÖ®ºó£¬PI¿ÉÒÔ°üº¬³ýÁËСÓںźʹóÓÚºÅÖ®ÍâµÄÈκÎ×Ö·û´®ÐòÁС£
×î³£¼ûµÄPIÊÇÓÃÀ´Ö¸¶¨XMLÎļþµÄÑùʽ±í£º
Õâ¸öPIÒ»°ã»áÖ±½Ó·ÅÔÚXMLÐòÑÔÖ®ºó£¬Í¨³£ÓÉWebä¯ÀÀÆ÷ʹÓã¬À´½«XMLÊý¾ÝÒÔÌØÊâµÄÑùʽÏÔʾ³öÀ´¡£
from:
http://e-learning.zjgsu.edu.cn/jdk5doc_zh_CN/org/w3c/dom/ProcessingInstruction.html
org.w3c.dom
½Ó¿Ú ProcessingInstruction
public interface ProcessingInstructionextends Node
ProcessingInstruction ½Ó¿Ú±íʾ“´¦ÀíÖ¸Á¬¸ÃÖ¸Áî×÷ΪһÖÖÔÚÎĵµµÄÎı¾Öб£³ÖÌØ¶¨ÓÚ´¦ÀíÆ÷µÄÐÅÏ¢µÄ·½·¨ÔÚ XML ÖÐʹÓá£
²»¶Ô´¦ÀíÖ¸ÁîµÄÄÚÈݽøÐÐÈκδʻã¼ì²é£¬Òò´ËÔÚ¸ÃÄÚÈÝÖпÉÄÜÓÐ×Ö·ûÐòÁÐ "?>"£¬°´ÕÕ [XML 1.0] µÄ 2.6 ½Ú£¬¸ÃÐòÁÐÊÇ·Ç·¨µÄ¡£³öÏÖ´Ë×Ö·ûÐòÁÐÒ»¶¨»áÔÚÐòÁл¯ÆÚ¼äÉú³ÉÑÏÖØ´íÎó¡£
from:
http://www.javacommerce.com/displaypage.jsp?name=pi.sql&id=18238
Processing Instructions
Processing Instructions are information for the application. PI's allow documents to contain instructions for applications. They are not really of interest to the XML parser. Instead, the instructions are passed to the application using the parser, because the purpose of processing instructions is to represent special instructions for the application.
Like comments, they are not textually part of the XML document.
All processing instructions, including the XML declaration, begin with <? and end with ?>. Following the initial <?, you will find the name of the processing instruction. The PI begins with the PITarget  used to identify the application to which the instruction is directed.
<?name pidata?>
<?xml version="1.0"? encoding="UTF-8" standalone="yes"?>
Version Declaration is a form of PI.


Ïà¹ØÎĵµ£º

javaÉú³ÉXMLÎļþ×Ô¶¯»»ÐÐÎÊÌâ

Java codeFormat ft=Format.getRawFormat();
ft.setEncoding("utf-8");
ft.setIndent("    ");//ÉèÖÃËõ½ø
       
XMLOutputter outputter=new XMLOutputter(ft);//ÉèÖÃXML¸ñʽ
Õâλ˵µÄ²»´í£»
ÔÚieÀïÃæ£¬ËüÄܰÑxml×Ô¶¯½âÎö³ÆÊ÷Ðνṹ£¬ËùÒÔ¿´ÆðÀ´Ã»ÎÊÌ⣬ÔÚ¼Çʱ¾ÀïÃæ£¬¾Í²»ÐÐÁ ......

Linq to XML customize distinct function

Definition comparer class,
class ItemComparer : IEqualityComparer<XElement>
{
public bool Equals(XElement x, XElement y)
{
return x.Attribute("Name").Value == x.Attribute("Name").Value;
}
public int GetHashCode(XElement obj)
......

DOM4JÉú³ÉXMLÎĵµ


public int createXMLFile(String filename) {
  int returnValue = 0;
  Document document = DocumentHelper.createDocument();    //Éú³ÉDocument£¬ÓÃÓÚ¹ÜÀíXMLÎĵµ
  
  Element booksElement = document.addElement("books");    //Ìí¼Ó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ