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

¶ÁÈ¡xmlÖ¸¶¨½ÚµãÖµ²¢Éú³ÉcsvÎļþ

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class XmlReader {
/**
* ¶ÁÈ¡xmlÎļþÖ¸¶¨½ÚµãÄÚÈݲ¢µ¼³öµ½csvÎļþÖÐ
* @param path
* Ö¸¶¨Îļþ¼Ð·¾¶
* @param destNode
* Ä¿±ê½Úµã
* @param fileName
* ³öÁ¦csvÎļþÃû
*/
public void readXmlFile(String path, String destNode, String fileName) {
File file = new File(fileName);
FileOutputStream out;
try {
// ½¨Á¢csvÊä³öÎļþÁ÷
out = new FileOutputStream(file);
OutputStreamWriter osw = new OutputStreamWriter(out);
BufferedWriter bw = new BufferedWriter(osw);
// ³õʼ»¯csvÎļþ
initCSV(bw);

// µÃµ½Ö¸¶¨Îļþ¼ÐϵÄËùÓÐxmlÎļþ
List fileList = getXmlFiles(path);
// ´´½¨xmlÎļþ
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = null;
String xmlFileName;
Node root;
NodeList links;
for (int k = 0; k < fileList.size(); k++) {
xmlFileName = fileList.get(k).toString();
doc = builder.parse(xmlFileName);
doc.normalize();
// xmlÎļþ¸ù½Úµã
root = doc.getDocumentElement();
// xmlÎļþÖÐËùÓÐÖ¸¶¨½Úµã
links = doc.getElementsByTagName(destNode);
for (int i = 0; i < links.getLength(); i++) {
Node link = links.item(i);
// Ö¸¶¨½ÚµãµÄËùÓÐ×Ó½Úµã
NodeList childNodes = link.getChildNodes();
StringBuffer sb = new StringBuffer();
// ±éÀú×Ó½Úµã
for (int j = 0; j < childNodes.getLength(); j++) {
Node chi


Ïà¹ØÎĵµ£º

DTD£¬XML SchemaºÍRelax NGµÄ±È½Ï¼°Ï໥ת»¯£¡

±È½Ï£º
1. DTD
a. ×îÔçµÄXML Contraint
b. ÓÉW3C¶¨Òå
C. ·Ç³£¼òµ¥
2. XML Schema
a. ĿǰӦÓÃ×î¹ãµÄXML Contraint
b. ÓÉW3C¶¨Òå
c. ºÜÁé»î£¬µ«·Ç³£¸´ÔÓ
3. Relax NG
a. ÊǸöÒ°º¢×Ó£¬²»ÊÇÓÉW3C¶¨Òå
b. ·Ç³£·Ç³£¼òµ¥Ö±¹Û
c. ¶ÔÓÚÐèҪƵ·±¶¨ÒåContraintµÄEngineer·Ç³£ºÏÊÊ
Ï໥ת»¯£º
1. XML Document -> DTD ......

½â¶ÁPHP DOMDocumentÔÚ½âÎöXMLÎļþÖеÄ×÷ÓÃ

½â¶ÁPHP DOMDocumentÔÚ½âÎöXMLÎļþÖеÄ×÷ÓÃ
http://developer.51cto.com  2009-12-02 10:39  ØýÃû  Áø³Ç²©¿Í  ÎÒÒªÆÀÂÛ(0)
PHP DOMDocumentµÄ¹¦Äܷdz£Ç¿´ó£¬ÎÒÃÇÔÚÕâÆªÎÄÕÂÖн«½éÉÜÈçºÎÕýÈ·µÄÔËÓÃPHP DOMDocumentÀ´½øÐÐXMLÎļþµÄ½âÎö¡£Ï£Íû¶ÔÓÖÐèÒªµÄÅóÓÑÓÐËù°ïÖú¡£
ÔÚʹÓÃPHP¶ÔXMLÎļþ½øÐнâÎöµÄʱ ......

javascript½âÎö·µ»ØµÄxml¸÷ʽµÄ×Ö·û´®

<script>
var flags ;
  if(window.XMLHttpRequest) { 
   XMLHttpReq = new XMLHttpRequest(); //firefoxÏÂÖ´ÐдËÓï¾ä
   }
   else if(window.ActiveXObject) {
    try{
    XMLHttpReq = new Acti ......

C#ÖжÔXML½Úµã½øÐÐÔöɾ¸Ä²é

ºÅ³ÆxmlhelperµÄÒ»¸öÀà
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XMLÎĵµ²Ù×÷¹ÜÀíÆ÷
/// </summary>
public class XMLHelper
{
public X ......

ʹÓÃXMLÔÚSQL ServerÉÏ´´½¨¼ÆËãÁÐ

¡¡ÔÚSQL ServerÊý¾Ý¿âÖУ¬µ±ÄãÏëʹÓÃÒ»¸öÊý¾Ý£¬¶øÕâ¸öÊý¾Ý²»±£´æÔÚ±íÖУ¬¼ÆËãÁкÜÓÐÓá£ÀýÈ磬ÄãÓÐÒ»ÕÅ±í£¬Ëü°üÀ¨ÁÐdollar amounts, wholesale pricesºÍretail prices¡£Äã¿Ï¶¨²»ÏëÔÚÿ´Î²éѯ±íʱÀ´¼ÆËãÄÇÁ½ÁÐÖ®¼äµÄ²îÖµ£¬ÄãÏ£Íû½«ÆäÖµ±£´æÔÚµÚÈýÁÐÖУ¬ÈÃÆä×Ô¶¯¼ÆËãǰÁ½ÁÐÖ®¼äµÄ²îÖµ¡£¶ø´ËÁоÍÊǼÆËãÁС£
¡¡¡¡ÔÚSQL ServerÖ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ