5.1½«Excelת»¯ÎªXMLµ¼ÈëÊý¾Ý¿âÖ®Ò»
½«Excelת»¯ÎªXML¡£ÒÔExcel2003ΪÀý˵Ã÷ÈçºÎ½«Êý¾Ýµ¼ÈëMS SQLÊý¾Ý¿â
˵ÏÈ°³µÄϵͳÅäÖãº
ϵͳ£ºWindows Server 2003 R2 X64
¿ª·¢Èí¼þ£ºMicrosoft VS 2008 Team
Office°æ±¾£ºExcel 2003 Excel2007
Êý¾Ý¿â£ºMS SQL 2008
5.1.1½¨Á¢Excel XML Ó³É䣺Êý¾Ý¸ñʽ¼û±í¡£
ÏÖ´òË㽫¡ºÓû§Ãû³Æ¡»£¬¡º¿Í»§ÁªÏµÈË¡»£¬¡ºÁªÏµµç»°¡»£¬¡º¿Í»§¾Àí¡»£¬¡º¿Í»§¾ÀíÁªÏµµç»°¡»£¬¡ºÒµÎñÀàÐÍ¡»£¬¡ºÇ°¶ËÊýÁ¿¡»£¬¡ºÒµÎñÀà±ð¡»£¬¡ºÇøÓò¡»µ¼ÈëMS SQLÏàÓ¦×Ö¶ÎÖÐ
Öƶ¨XML XSDÎļþ£¬T1schema.xlsÎļþÈçÏ£º
<?xml version="1.0" standalone="yes"?>
<QQTintDataSet xmlns="http://tempuri.org/QQTintDataSet.xsd">
<xs:schema id="QQTintDataSet" targetNamespace="http://tempuri.org/QQTintDataSet.xsd" xmlns:mstns="http://tempuri.org/QQTintDataSet.xsd" xmlns="http://tempuri.org/QQTintDataSet.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="QQTintDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="yyqint">
<xs:complexType>
<xs:sequence>
<xs:element name="id" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" type="xs:int" />
<xs:element name="Customer" minOccurs="0">
<xs:simpleType>
&
Ïà¹ØÎĵµ£º
public int createXMLFile(String filename) {
int returnValue = 0;
Document document = DocumentHelper.createDocument(); //Éú³ÉDocument£¬ÓÃÓÚ¹ÜÀíXMLÎĵµ
Element booksElement = document.addElement("books"); //Ìí¼Ó ......
XMLÎļþʵÀý£º
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Resource auth="Container" maxActive="20" name="sss" password="123"
type="javax.sql.DataSource" />
<Resource auth="Container" ......
Ê×ÏÈ£¬¼ÓÔØTXTʵÀý£º
´úÂ룺
ËäÈ»ÊǺܾɵÄÒ»Ì׽̳̣¬¿ÉÊǺÜʵÓã¬ËùÒÔÎÒ°ÑËü·ÅÔÚÕâ¡£
£¨×¢Ò⣺¿´´úÂëµÄʱºòÁôÒâһϽڵãµÄÓ÷¨£ºmyXML.childNodes[0].childNodes[0].childNodes[0]....xml½ÚµãµÄµØ·½¡££©
Ò»¡¢½¨Á¢XML¶ÔÏó£º
var myXML = new XML();
¶þ¡¢ÒýÓÃXMLÎļþ£º
myXML.load("data.xml");
Èý¡¢ºöÂÔ¿Õ¸ñ£º
my ......
ÏÖÔÚÎÒÃÇÔÝÇÒʹÓÓ¼Çʱ¾”À´´´½¨ÎÒÃǵÄXMLÎļþ°É¡£ÏÈ¿´Ò»¸öXMLÎļþ£º
¡¡¡¡Àý1
¡¡¡¡¡´?xml version="1.0" encoding="gb2312" ?¡µ
¡¡¡¡¡´²Î¿¼×ÊÁÏ¡µ
¡¡¡¡ ¡´Êé¼®¡µ
¡¡¡¡ ¡´Ãû³Æ¡µXMLÈëÞ«½â¡´/Ãû³Æ¡µ
¡¡¡¡ ¡´×÷Õß¡µÕÅÈý¡´/×÷Õß¡ ......
package com.jcauto.action;
import java.util.ArrayList;
import java.util.List;
public class ContentRsp {
private String resultCode;
List<ContentInfo> contentList = new ArrayList<ContentInfo>();
public void addContent(ContentInfo contentInfo) {
contentList.add(contentI ......