DOM4JÉú³ÉXMLÎĵµ
public int createXMLFile(String filename) {
int returnValue = 0;
Document document = DocumentHelper.createDocument(); //Éú³ÉDocument£¬ÓÃÓÚ¹ÜÀíXMLÎĵµ
Element booksElement = document.addElement("books"); //Ìí¼Ó¸ù½Úµã
booksElement.addComment("This is a test for dom4j, holen, 2004.9.11"); //Ìí¼Ó×¢ÊÍ
Element bookElement = booksElement.addElement("book"); //ÔÚ¸ú½ÚµãbooksÏÂÌí¼ÓÒ»¸öbook×Ó½Úµã
bookElement.addAttribute("show", "yes"); //ΪbookElementÌí¼ÓÊôÐÔ£¬²¢Öƶ¨ÊôÐÔµÄÖµ
Element titleElement = bookElement.addElement("title"); //ΪbookElement½ÚµãÌí¼ÓÒ»¸ötitle×Ó½Úµã
titleElement.setText("Dom4j Tutorials"); //Ϊtitle×Ó½ÚµãÉèÖÃÎı¾½ÚµãÄÚÈÝ
try {
XMLWriter writer = new XMLWriter(new FileWriter(new File(filename)));
writer.write(document); //ÆÕͨ¸ñʽ£¬±È½Ï²»ÃÀ¹Û
OutputFormat format =null;
// format=OutputFormat.createPrettyPrint(); //ÃÀ»¯¸ñʽ,¶ÁÈ¡ºóÃÀ»¯ÏÔʾ
// writer = new XMLWriter( System.out, format );
// writer.write( document );
// format = OutputFormat.createCompactFormat(); //Ëõ¼õ¸ñʽ£¬¶ÁÈ¡ºóËõ¼õÏÔʾ
// writer = new XMLWriter( System.out, format );
// writer.write( document );
writer.close();
return
Ïà¹ØÎĵµ£º
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Xml;
using System.IO;
using System.Data;
using System.Dat ......
ºìÉ«×ÖÌåΪÖ÷Òª´úÂë
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 ......
1.½âÊÍ
ÒòΪjspÓõ½ÁËSiteDataÀ࣬¶øSiteData¼Ì³ÐBasePageÀ࣬
ËùÒÔBasePage¹¹Ô캯Êý
BasePage¹¹Ô캯Êý
initializeByCityCodeº¯Êýmain
keyµÄÖµmain.UpImages
vµÄÖµmain.UpImages
2.Ö´ÐÐÍê BasePage.java
ÖеÄinitCommon()ºó£¬
Ìøµ½SiteData.java ÖÐµÄ process();·½·¨£¬
public SiteData(HttpServletR ......
Java codeFormat ft=Format.getRawFormat();
ft.setEncoding("utf-8");
ft.setIndent(" ");//ÉèÖÃËõ½ø
XMLOutputter outputter=new XMLOutputter(ft);//ÉèÖÃXML¸ñʽ
Õâλ˵µÄ²»´í£»
ÔÚieÀïÃæ£¬ËüÄܰÑxml×Ô¶¯½âÎö³ÆÊ÷Ðνṹ£¬ËùÒÔ¿´ÆðÀ´Ã»ÎÊÌ⣬ÔÚ¼Çʱ¾ÀïÃæ£¬¾Í²»ÐÐÁ ......