xmlµÄ¼òµ¥²Ù×÷
ÔںܶàÇé¿öÏÂ, ÎÒÃÇ»áÓõ½XML,±ÈÈç˵ÅäÖÃÎļþµÈ.C#ÌṩÁËXMLÀà.
ÕâÀïÎÒÖ»ÊǼòµ¥µÄдһÏÂXMLÎļþµÄÉú³É,½âÎö¾Í²»¶à˵ÁË.
µÚÒ»ÖÖ·½·¨
DataBase db = DataBaseFactory.CreateDataBase(DataBaseType.MySql, strMysql);
DbCommand command = db.GetSqlStringCommand(strSql);
DataTable dt = db.ExecuteDataSet(command).Tables[0];
//string strFileName = Application.StartupPath + "\\" + "test.xml";
DirectoryInfo file = new DirectoryInfo(strPath);
if (!file.Exists)
{
file.Create();
}
string strFileName = strPath + "\\tech.xml";
XmlDocument oXmlDocument = new XmlDocument();
XmlDeclaration xde;
xde = oXmlDocument.CreateXmlDeclaration("1.0", null, null);
xde.Encoding = "gb2312";
xde.Standalone = "yes";
oXmlDocument.AppendChild(xde);
XmlElement xe = oXmlDocument.CreateElement("Root");
//XmlNode root = oX
Ïà¹ØÎĵµ£º
ת£ºhttp://hi.baidu.com/oneshotonekill/blog/item/be68b513f7c929d7f6039e1e.html
Whitespace is not allowed before an XML Processing Instruction (< ? ... ?>). HTMLComponent.EclipseÔÚ±à¼mxmlµÄʱºòÌáʾÕâÑùµÄ´íÎó¡£¼ì²é²Å·¢ÏÖ´úÂëÖÐÔÚ<? ?>֮ǰ´æÔÚ¿Õ¸ñ¡£ ......
ͨ¹ýJOXÇáËÉʵÏÖJavaBeansÓëXMLµÄÏ໥ת»»
JOXʹµÃÔÚXMLÎĵµÓëJava BeansÖ®¼ä½øÐÐÊý¾Ýת»»±äµÃÈÝÒ×.Äã¿ÉÒÔÀûÓÃJOXÀ´½«¶ÔÏóÐòÁл¯µ½XML.
¿ª·¢ÓïÑÔ£º Java
²Ù×÷ϵͳ£º
Èí¼þÖ÷Ò³£º http://www.wutka.com/jox.html
ÎĵµµØÖ·£º http://www.wutka.com/joxdoc.html
ÏÂÔص ......
µ¼Èëjdom1.1°æ
http://www.jdom.org/dist/binary/
import java.io.FileReader;
import org.jdom.Document;
import org.jdom.input.SAXBuilder;
public class XMLValidate {
public void validate(String xml, String schema) {
try {
SAXBuilder builder = new SAXBuilder(true);
//Ö¸¶¨Ô¼Êø·½ ......
ÐèÒªdom4j.jarÎļþ £¬×ÔÐÐÏÂÔØ¡£ test.xml 1: <?xml version="1.0" encoding="gbk"?>
2:
3: <students>
4: <person sex="ÄÐ" age="21">
5: <id>1</id>
6: <name>ÕÂÖÎÅô</name>
7: <homepage&g ......