Dom4jΪXMLÎļþÒª½áµãÌí¼ÓxmlnsÊôÐÔ
ÎÊÌâ:
¸ù¾Ýgoogle¹æ¶¨£¬ÔÚ¸ø×Ô¶¯¸øÍøÕ¾Éú³Ésitemap.xmlµÄʱºò£¬ ¸ø¸ù½áµã¼ÓÈçÏÂÊôÐÔʱ£¬Óöµ½ÁËÂé·³
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
Óúܶ෽·¨£¬ÏñaddAttribute, addNamespce¶¼²»ÐÐ
½â¾ö·½·¨£º
Document document = DocumentHelper.createDocument();
Element root = document.addElement("urlset", "http://www.sitemaps.org/schemas/sitemap/0.9");
ÕâÑù»á×Ô¶¯Éú³ÉxmlnsÊôÐÔ
Éú³É½á¹û:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://***</loc>
<priority>0.5</priority>
<lastmod>2010-02-24</lastmod>
<changefreq>weekly</changefreq>
</url>
....
</urlset>
Ïà¹ØÎĵµ£º
ÔÎÄ:ʹÓà MSXML ·ÖÎöÆ÷´¦Àí XML Îĵµ
#include <atlbase.h>
#include <iostream>
using namespace std;
//<?xml version="1.0"?>
//<xmldata>
//<xmlnode />
//<xmltext>Hello, World!</xmltext>
//</xmldata>
void main ......
import java.io.StringWriter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xerces.dom.DOMImplementationImpl;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.Serializer;
import org.apache.xml. ......
XMLÊÇÒ»ÏîÈÈÃŵļ¼Êõ¡£ËüÖ®ËùÒÔÄܹ»ÒýÆðÈËÃǵÄÐËȤ£¬Ò»¸öÖ÷ÒªµÄÔÒòÔÚÓÚËüÊ®·ÖµÄ¼òµ¥£¬ÈËÃÇ¿ÉÒÔºÜÈÝÒ×µØÀí½âºÍʹÓÃËü¡£Ã¿Ò»¸ö³ÌÐòÔ±¶¼ÄÜÇáÒ׵ؿ´¶®Ò»¸öXMLÎļþ£¬Àí½âËü°üº¬µÄÄÚÈÝ¡£
.NETÖаüº¬Á˺ܶàÖ§³ÖXMLµÄÀ࣬ÕâЩÀàʹµÃ³ÌÐòԱʹÓÃXML±à³Ì¾ÍÈçͬÀí½âXMLÎļþÒ»Ñù¼òµ¥¡£ÔÚÕâÆªÎÄÕÂÖУ¬ÎÒ½«¸ø³öÕâÑùµÄÒ»¸öÀàµÄʹÓÃʾÀý£¬Õ ......
ÒÑÖªÓÐÒ»¸öXMLÎļþ£¨bookstore.xml£©ÈçÏ£º
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price& ......