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

PropertySet½Ì³Ì 2.Memory¡¢map¡¢XML·½Ê½

¡¡¡¡inkfishÔ­´´£¬ÇëÎðÉÌÒµÐÔÖÊתÔØ£¬×ªÔØÇë×¢Ã÷À´Ô´£¨http://blog.csdn.net/inkfish
£©¡£
¡¡¡¡PropertySet£¨À´Ô´£ºhttp://blog.csdn.net/inkfish£©
ÊÇÓÉopensymphony×éÖ¯¿ª·¢µÄµÄÒ»¸ö¿ªÔ´ÏîÄ¿£¬µ«ÊÇÄǸöÏîÄ¿ÎĵµÉÙ£¬³¤Ê±¼äûÓиüУ¬¹Ù·½Îĵµ´íÎóÆæ¶à£¬ËùÒÔÏÖÔÚÔÚÏîÄ¿ÖÐʹÓò¢²»¹ã·º¡£µ«Õâ²¢²»·Á°­PropertySet³ÉΪһ¸öÓÅÐãµÄkey-value³Ö¾Ã»¯Ä£¿é£¬µ±Ç°£¬PropertySet¿ÉÒÔ˵ÒѾ­¹»Óá£ÕâÀïÎÒÕûÀíÊéдÁËPropertySetµÄÎĵµ¡££¨À´Ô´£ºhttp://blog.csdn.net/inkfish£©
¡¡¡¡PropertySet×îÈÝÒ×ʹÓúÍÉÏÊÖµÄÊÇmemory·½Ê½£¬×î³£ÓõÄÊÇxml¡¢JDBC£¬ÁíÍâHibernate¡¢EJBÊǽϳ£Óõķ½Ê½¡£ÕâÀïÑ¡Ôñ½éÉÜmemory¡¢map¡¢XML·½Ê½¡££¨À´Ô´£ºhttp://blog.csdn.net/inkfish£©
1.Demo
PropertySetDemo.java
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.HashMap;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import com.opensymphony.module.propertyset.PropertySet;
import com.opensymphony.module.propertyset.PropertySetManager;
import com.opensymphony.module.propertyset.xml.XMLPropertySet;
public class PropertySetDemo {
public static void main(String[] args) throws Exception {
PropertySetDemo demo = new PropertySetDemo();
demo.mapPsDemo();
demo.memoryPsDemo();
demo.xmlPsDemo();
}
public void memoryPsDemo() {
System.out.println(StringUtils.center("Memory PropertySet Demo", 80, '*'));
//memoryÊÇÅäÖÃÎļþÖж¨ÒåµÄ£º<propertyset name="memory" class="com.opensymphony.module.propertyset.memory.MemoryPropertySet"/>
PropertySet ps = PropertySetManager.getInstance("memory", null);
ps.setBoolean("BooleanPS", true);
ps.setString("name", "Tom");
System.out.println(ps.getBoolean("BooleanPS"));
System.out.println(ps.getString("name"));
System.out.println(StringUtils.repeat("*", 80));
}

public void mapPsDemo() {
System.out.println(StringUtils.center("Map PropertySet Demo", 80, '*'));
@Sup


Ïà¹ØÎĵµ£º

C#СTip£ºXml²Ù×÷¼òÃ÷ÊÖ²á 3

3£©¶ÁÈ¡¡¢²éÕÒ
µ±ÄãÊÖÍ·ÓÐÒ»¸öxmlÎļþºó£¬¿ÉÒÔʹÓÃXmlDocument.Load()·½·¨½«Æä¼ÓÔؽøÀ´ÒԱ㴦Àí£¬ËùÒÔ“¶ÁÈ¡”ûÓÐʲô¿É˵µÄ¡£¶ø“²éÕÒ”²Ù×÷ÍùÍùÉæ¼°XPath£¬ÕâÀïÖ»ÊÇÎÒÈÏΪµÄ±È½Ï³£Óõ½µÄ²éÕÒ²Ù×÷£¬XPathÕâÍæÒâʵÔÚÊǺÜÇ¿´óºÜ±©Á¦¡£
 
»ØÍ·¿´Ê¾ÀýÎĵµxmlsample.xml£¬ÎÒÃÇ¿ÉÄÜÓöµ½ÕâÑùµÄÐèÇó£ ......

C#ÐòÁл¯Óë·´ÐòÁл¯Xml£¬ÀûÓ÷¶ÐÍ×öͨÓû¯´¦Àí

public class yzzSerialize
{
private yzzSerialize()
{ }
private static yzzCache cache = new yzzCache();
public static T GetfromXml<T>(string xmlpath, T t)
{
using (FileStream fs = new FileStream(xmlpath, FileMode.Open, FileAcces ......

dom4j ½âÎö xml Àý×Ó

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
SAXReader reader = new SAXReader();
try {
          Document doc = reader.read("ParserSQL.xml");
   &n ......

c# Ö§³ÖXMLÐòÁл¯µÄ·ºÐÍ Dictionary

/// <summary>
/// Ö§³ÖXMLÐòÁл¯µÄ·ºÐÍ Dictionary
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
[XmlRoot("SerializableDictionary")]
public class SerializableDictionary<TKey, TValue& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ