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

ͨ¹ýXStreamÇáËÉʵÏÖJavaBeansÓëXMLµÄÏ໥ת»»


XStreamʹÓÃ
XStreamÊÇÒ»¸öJava¶ÔÏóºÍXMLÏ໥ת»»µÄ¹¤¾ß£¬ºÜºÃºÜÇ¿´ó¡£ÌṩÁËËùÓеĻù´¡ÀàÐÍ¡¢Êý×é¡¢¼¯ºÏµÈÀàÐÍÖ±½Óת»»µÄÖ§³Ö¡£Òò´ËXML³£ÓÃÓÚÊý¾Ý½»»»¡¢¶ÔÏóÐòÁл¯£¨ÕâÖÖÐòÁл¯ºÍJava¶ÔÏóµÄÐòÁл¯¼¼ÊõÓÐ×ű¾ÖʵÄÇø±ð£©¡£
XStreamÖеĺËÐÄÀà¾ÍÊÇXStreamÀ࣬һ°ãÀ´Ëµ£¬ÊìϤÕâ¸öÀà»ù±¾¾Í¹»ÓÃÁË£¬Èç¹ûÄãÓõĸü¶à£¬¹À¼ÆÊÇÄãÉè¼ÆÓÐÎÊÌ⣬·ñÔò²»ÐèÒª¡£
XStream¶ÔÏóÏ൱Java¶ÔÏóºÍXMLÖ®¼äµÄת»»Æ÷£¬×ª»»¹ý³ÌÊÇË«ÏòµÄ¡£´´½¨XSteam¶ÔÏóµÄ·½Ê½ºÜ¼òµ¥£¬Ö»ÐèÒªnew XStream()¼´¿É¡£
Javaµ½xml£¬ÓÃtoXML()·½·¨¡£
Xmlµ½Java£¬ÓÃfromXML()·½·¨¡£
ÔÚûÓÐÈκÎÉèÖÃĬÈÏÇé¿öÏ£¬javaµ½xmlµÄÓ³É䣬ÊÇjava³ÉÔ±Ãû¶ÔÓ¦xmlµÄÔªËØÃû£¬javaÀàµÄÈ«Ãû¶ÔÓ¦xml¸ùÔªËصÄÃû×Ö¡£¶øʵ¼ÊÖУ¬ÍùÍùÊÇxmlºÍjavaÀ඼ÓÐÁË£¬ÒªÍê³ÉÏ໥ת»»£¬±ØÐë½øÐбðÃûÓ³Éä¡£
±ðÃûÅäÖðüº¬ÈýÖÖÇé¿ö£º
1¡¢Àà±ðÃû£¬ÓÃalias(String name, Class type)¡£
2¡¢Àà³ÉÔ±±ðÃû£¬ÓÃaliasField(String alias, Class definedIn, String fieldName)
3¡¢Àà³ÉÔ±×÷ΪÊôÐÔ±ðÃû£¬Óà aliasAttribute(Class definedIn, String attributeName, String alias)£¬µ¥¶ÀÃüÃûûÓÐÒâÒ壬»¹ÒªÍ¨¹ýuseAttributeFor(Class definedIn, String fieldName) Ó¦Óõ½Ä³¸öÀàÉÏ¡£
±ðÃûµÄÅäÖÃÊǷdz£ÖØÒªµÄ£¬µ«ÊÇÆäÖÐÓÐЩϸ½ÚÎÊÌâºÜÖØÒª£¬ÔÚÀý×ÓÖлáרÃÅ×öÏêϸ˵Ã÷¡£
ÁíÍ⻹Óв»Ì«³£Óõķ½·¨£º
addImplicitCollection(Class ownerType, String fieldName)£¬È¥µô¼¯ºÏÀàÐÍÉú³ÉxmlµÄ¸¸½Úµã¡£
registerConverter(Converter converter) £¬×¢²áÒ»¸öת»»Æ÷¡£
Èç¹ûÄãµÄxmlºÜ´ó£¬»òÕßΪÁË°²È«ÐÔ£¬ÒÔÁ÷µÄ·½Ê½´«Ê䣬ÄÇôXStreamÒ²Ìṩ·á¸»µÄAPI£¬
ʹÓÃÆðÀ´Ò²·Ç³£¼ò±ã¡£Ä¿Ç°»¹Óò»µ½£¬Ôݲ»¿¼ÂÇ¡£
Èç¹ûÕâЩ»ù±¾µÄ²Ù×÷»¹²»ÄÜÂú×ãÄãÓ¦ÓõÄÐèÇó£¬XStreamÌṩ·á¸»µÄÀ©Õ¹µã¡£Äã¿ÉÒÔʵÏÖ×Ô¼ºµÄת»»Æ÷¡£»¹¿ÉÒÔÀûÓÃXStreamÍê³É¸ü¸ºÔðµÄ¹¦ÄÜ£¬±ÈÈçÊä³öÆäËû·Çxml¸ñʽµÄÊý¾Ý£¬»¹¿ÉÒÔÊä³öhtml£¬»¹Ö§³ÖXML DomÀàÐÍÊý¾Ý£¬ÕâЩӦÓÃÆðÀ´ÉÔ΢¸´ÔÓЩ¡£µ±È»ÕâЩ²»ÊÇXStreamÓ¦ÓõÄÖص㣬Ҳ²»ÓÃÀí»á£¬ÕæÕýÐèÒªµÄʱºòÔٲ鿴APIºÍÔ´ÂëÑо¿Ñо¿¡£
XStreamµÄÓŵãºÜ¶à£¬µ«ÊÇÒ²ÓÐһЩСbug£¬±ÈÈçÔÚ¶¨Òå±ðÃûÖеÄÏ»®Ïß“_”ת»»Îªxmlºó»á±ä³É“__”Õâ¸ö·ûºÅ£¬ºÜ±ä̬¡£Òò´Ë£¬¾¡Á¿±ÜÃâÔÚ±ðÃûÖÐʵÓÃÈκηûºÅ£¬È´ÊÇÐèҪϻ®ÏßµÄʱºò£¬¿ÉÒÔ¿¼ÂÇʵÓÃÁ¬½Ó·û“-”£¬Õâ¸öûÓÐÎÊÌâ¡£
ÁíÍ⣬ÎÒÃǵÄJava BeanÖУ¬³£³£ÓÐһЩ³£Á¿£¬ÔÚת»»¹ý³


Ïà¹ØÎĵµ£º

´¿CÓïÑÔXML½âÎöÆ÷

¾«¶Ì¸ßЧµÄXML½âÎöÆ÷,´¿Cµ¥Ò»³ÌÐò,Ó¦ÓÃÓÚÒøÐеĹúË°¿âÐкáÏòÁªÍø½Ó¿ÚϵͳÖÐ,Îȶ¨¿É¿¿,ÔËÐÐËٶȷɿì,·ÇÏàÓ¦µÄJAVA³ÌÐò¿É±È.ÒÔÏÂΪ´ó²¿·ÖÔ´Âë:
/* Copyright (c) 2005 wzs */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <varargs.h>
#i ......

C££¶ÁÈ¡XMLÎļþµÄ¼òµ¥·½·¨

Ò»¡¢XMLÖ»ÓÐÒ»¸öTableµÄÇé¿ö
      £¨1£©userInfo.xml
              <?xml version="1.0" encoding="utf-8" ?>
              <UserInfo ......

Whitespace is not allowed before an XML Processing

ת£ºhttp://hi.baidu.com/oneshotonekill/blog/item/be68b513f7c929d7f6039e1e.html
Whitespace is not allowed before an XML Processing Instruction (< ? ... ?>). HTMLComponent.EclipseÔڱ༭mxmlµÄʱºòÌáʾÕâÑùµÄ´íÎó¡£¼ì²é²Å·¢ÏÖ´úÂëÖÐÔÚ<? ?>֮ǰ´æÔÚ¿Õ¸ñ¡£ ......

JavaÓëXMLÁªºÏ±à³ÌÖ®SAXƪ

ת×Ôhttp://www0.ccidnet.com/tech/guide/2001/10/08/58_3392.html
SAX¸ÅÄî
SAXÊÇSimple API for XMLµÄËõд£¬Ëü²¢²»ÊÇÓÉW3C¹Ù·½ËùÌá³öµÄ±ê×¼£¬¿ÉÒÔ˵ÊÇ“Ãñ¼ä”µÄÊÂʵ±ê×¼¡£Êµ¼ÊÉÏ£¬ËüÊÇÒ»ÖÖÉçÇøÐÔÖʵÄÌÖÂÛ²úÎï¡£ËäÈ»Èç´Ë£¬ÔÚXMLÖжÔSAXµÄÓ¦ÓÃË¿ºÁ²»±ÈDOMÉÙ£¬¼¸ºõËùÓеÄXML½âÎöÆ÷¶¼»áÖ§³ÖËü¡£
ÓëDOM±È½Ï¶øÑÔ ......

ͨ¹ýJOXÇáËÉʵÏÖJavaBeansÓëXMLµÄÏ໥ת»»

 
 
 
ͨ¹ýJOXÇáËÉʵÏÖJavaBeansÓëXMLµÄÏ໥ת»»
 
 
 
JOXʹµÃÔÚXMLÎĵµÓëJava BeansÖ®¼ä½øÐÐÊý¾Ýת»»±äµÃÈÝÒ×.Äã¿ÉÒÔÀûÓÃJOXÀ´½«¶ÔÏóÐòÁл¯µ½XML.
¿ª·¢ÓïÑÔ£º Java
²Ù×÷ϵͳ£º
Èí¼þÖ÷Ò³£º http://www.wutka.com/jox.html
ÎĵµµØÖ·£º http://www.wutka.com/joxdoc.html
ÏÂÔص ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ