xml/propertiesÎļþµÄÏ໥±£´æ×ª»¯
/*
Á·Ï°Ê¹ÓÃjava.util.propertiesÀà°üÀ´²Ù×÷propertes¼°XMLÎļþ,ͨ¹ýstore·½·¨µÄµ÷ÓÿÉʵÏÖxml/propertiesÎļþµÄÏ໥±£´æ×ª»¯
*/
import java.util.*;
import java.io.*;
public class TestPropertes
{
public static void main(String[] args) {
Properties pp = new Properties();
FileInputStream in = null;
FileInputStream xmlin = null;
FileOutputStream out = null;
PrintStream ps=null;
FileOutputStream xmlout =null;
try{
in = new FileInputStream("c:/Test.Properties");
}catch(FileNotFoundException e)
{
System.out.println("propertiesÎļþûÓÐÕÒµ½");
}
try
{
pp.load(in);
}catch(IOException e)
{
System.out.println(e+"µ÷ÓÃload·½·¨Ê±³öÏÖÒì³£");
}
System.out.println(pp.getProperty("log4j.rootLogger"));
System.out.println(pp.getProperty("log4j.appender.A"));
System.out.println(pp.getProperty("log4j.appender.A1.layout"));
try
{
ps = new PrintStream("c:/TestMemo.txt");
out = new FileOutputStream("c:/Test.Properties");
}catch(IOException e1)
{
System.out.println(e1+"PrintStream creat Error");
}
pp.list(ps); //½«propertiesÎļþÓÃlist·½·¨¶ÁÈ¡²¢´æÈëpsÎļþÖÐ
//¸ü¸Ä¼üÖµ
Object o =pp.setProperty("log4j.rootLogger","DEBUG,B"); //¸ü¸Ä¶ÔÓ¦µÄHASHTABLEÖеÄÖµ£¬Êµ¼ÊÉÏÎļþÖеÄֵû±ä»¯
System.out.println(pp.getProperty("log4j.rootLogger"));
pp.list(ps); //½«¼üÖµ¸ü¸ÄºóµÄpropertiesÎļþÓÃlist·½·¨¶ÁÈ¡²¢´æÈëpsÎļþÖÐ.list»á×Ô¶¯ÒÔ×·»ØµÄ·½Ê½´ÓÔÎļþβдÈë
System.out.println(o.getClass());
try
{
&nbs
Ïà¹ØÎĵµ£º
XML (EXtensible Markup Language)
XML is a
cross-platform, software and hardware independent tool for transmitting
information.
Prolog
XML
Declaration
Processing
Instructions
DOCTYPE
Declaration
Elements
Attributes
XML
Comments
CDATA
Sections
Character
and Entity Refere ......
gloox×Ô¼ºÊµÏÖÁËxmlµÄ½âÎöÄ£¿é£¬Ã»ÓÐÓõ½µÚÈý·½µÄ¿â(tinyXML£¬expat )
Ö÷񻃾¼°µÄÎļþ:
tag.h (tag.cpp)
taghandler.h
parser.h (parser.cpp)
1. TagÒ»¸öTag¾ÍÊÇÒ»¸öXMLÔªËØ
ÀýÈç:
a.
<book kind='computer'>
<store id='23'/>
<author>
qiang
</author>
</bo ......
XML£¨Extensible Markup Language£©¼´¿ÉÀ©Õ¹±ê¼ÇÓïÑÔ£¬ËüÓëHTMLÒ»Ñù£¬¶¼ÊÇSGML(Standard Generalized Markup Language,±ê׼ͨÓñê¼ÇÓïÑÔ)¡£XmlÊÇInternet»·¾³ÖÐ¿çÆ½Ì¨µÄ£¬ÒÀÀµÓÚÄÚÈݵļ¼Êõ£¬Êǵ±Ç°´¦Àí½á¹¹»¯ÎĵµÐÅÏ¢µÄÓÐÁ¦¹¤¾ß¡£À©Õ¹±ê¼ÇÓïÑÔXMLÊÇÒ»ÖÖ¼òµ¥µÄÊý¾Ý´æ´¢ÓïÑÔ£¬Ê¹ÓÃһϵÁмòµ¥µÄ±ê¼ÇÃèÊöÊý¾Ý£¬¶øÕâЩ±ê¼Ç¿ÉÒÔÓà ......
ÈçºÎ¼ÓÔØÓÐÍâ¹úºÍÌØÊâ×Ö·ûµÄÎĵµ£¿
¡¡¡¡Îĵµ¿ÉÒÔ°üº¬Íâ¹ú×Ö·û£¬ÀýÈ磺
¡¡¡¡foreign characters (úóí?)
¡¡¡¡ÀýÈç íá µÄÍâ¹ú×Ö·û±ØÐëÔÚÇ°Ãæ¼ÓÉÏ escape ÐòÁС£Íâ¹ú×Ö·û¿ÉÒÔÊÇ UTF-8 ±àÂë»òÓò»Í¬±àÂëÖ¸¶¨£¬ÈçÏÂËùʾ£º
¡¡¡¡foreign characters (íá)
¡¡¡ ......
XMLÏÖÔÚÒѾ³ÉΪһÖÖͨÓõÄÊý¾Ý½»»»¸ñʽ,ËüµÄƽ̨ÎÞ¹ØÐÔ,ÓïÑÔÎÞ¹ØÐÔ,ϵͳÎÞ¹ØÐÔ,¸øÊý¾Ý¼¯³ÉÓë½»»¥´øÀ´Á˼«´óµÄ·½±ã¡£¶ÔÓÚXML±¾ÉíµÄÓ﷨֪ʶÓë¼¼Êõϸ½Ú,ÐèÒªÔĶÁÏà¹ØµÄ¼¼ÊõÎÄÏ×,ÕâÀïÃæ°üÀ¨µÄÄÚÈÝÓÐDOM(Document Object Model),DTD(Document Type Definition),SAX(Simple API for XML),XSD(Xml Schema Definition),XSLT(Exten ......