.NET XML ´®Ðл¯½²×ù
1,dz´®Ðл¯£ºÖ»´®Ðл¯ÀàµÄ¹«¹²×ֶκÍÊôÐÔ
¹«¹²ÊôÐÔ±ØÐëÊǿɶÁÇÒ¿ÉдµÄ
ʹÓÃÃüÃû¿Õ¼ä£ºusing System.Xml.Serialization;
ÒÔBookÀàΪÀý£º
´®Ðл¯Ä£°å£º
public void SerializeIt(string filename)
{
XmlSerializer serializer = new XmlSerializer(typeof(Book));
StreamWriter writer = new StreamWriter(filename);
Book myBook = new Book();
serializer.Serialize(writer, myBook);
writer.Close();
}
·´´®Ðл¯Ä£°å£º
public void DeserializeIt(string filename)
{
XmlSerializer serializer = new XmlSerializer(typeof(Book));
FileStream fs = new FileStream(filename, FileMode.Open);
Book myBook = (Book)serializer.Deserialize(fs);
fs.Close();
}
*ʹÓÃXmlSerializerµÄÀà±ØÐëÓÐÒ»¸ö²»´ø²ÎÊýµÄĬÈϹ¹Ô캯Êý——ÔÚ·´´®Ðл¯ÖÐʹÓÃ
*ÐòÁл¯ArrayListÀàÐÍ×Ö¶ÎXµÄÌØÊâ´¦Àí£º
Ïà¹ØÎĵµ£º
private ClassLoader xmlLoader = Thread.currentThread().getContextClassLoader();
private void parseXML(String resource){
resource = StringUtils.substring(resource,resource.indexOf(":")+1,resource.length());
InputStream inputStream = xmlLoader.getResourceAsStream(resou ......
Java codeFormat ft=Format.getRawFormat();
ft.setEncoding("utf-8");
ft.setIndent(" ");//ÉèÖÃËõ½ø
XMLOutputter outputter=new XMLOutputter(ft);//ÉèÖÃXML¸ñʽ
Õâλ˵µÄ²»´í£»
ÔÚieÀïÃ棬ËüÄÜ°Ñxml×Ô¶¯½âÎö³ÆÊ÷Ðνṹ£¬ËùÒÔ¿´ÆðÀ´Ã»ÎÊÌ⣬ÔÚ¼Çʱ¾ÀïÃ棬¾Í²»ÐÐÁ ......
ÔÚ½øÐÐMISϵͳ¿ª·¢¹ý³ÌÖÐ,´ÓÅäÖÃÎļþÖжÁÈ¡ÅäÖÃÐÅÏ¢ÊÇÿһ¸öϵͳ±ØÐë¾ß±¸µÄ¹¦ÄÜ,ÀýÈç,ÎÒÃÇÒªÅäÖöÁÈ¡Êý¾Ý¿âÅäÖÃÐÅÏ¢,°üÀ¨Çý¶¯³ÌÐòÃû¡¢Á¬½Ó×Ö·û´®£¬Óû§Ãû£¬¿ÚÁîµÈÐÅÏ¢£¬ÓÉÓÚÕâЩÐÅÏ¢»áËæ×ÅÓû§µÄ²»Í¬¶ø·¢Éú¸Ä±ä£¬ËùÒÔ²»ÄÜÖ±½Ó°Ñ²ÎÊýдÔÚ³ÌÐòÖУ¬½«ÆäдÈëÅäÖÃÎļþ£¬È»ºóÔÚÓ¦ÓóÌÐòÖжÁÈ¡ÅäÖÃÐÅÏ¢²¢¼ÓÒÔʹÓã¬ÊÇÒ»¸ö³É ......
IsolatedStorageFile£º°üº¬ÎļþºÍÊý¾ÝµÄ¶ÀÁ¢´æ´¢Çø
datasetÊý¾Ý´æ´¢µ½±¾µØxmlÎĵµ£¬´úÂë´¦ÀíÈçÏÂ
public static void WriteDataToXML(DataSet dataset, string dataname)
{
try
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForAssembly(); / ......
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" ......