Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : xml

xml½âÎö


ÔÚjavaÓ¦Óÿª·¢ÖÐÎÒÃǺÍxml´ò½»µÀµÃ»ú»á̫ƽ·²ÁË£¬Ò»°ãÇé¿öÏÂÎÒ¿´»áÓÃJDOM»òÊÇDOM4jÀ´½âÎöÎÒÃǵÃXMLÎļþ£¬ÏÂÃæÊÇÒ»¸öDom4j½âÎöxmlÎļþµÃÀý×Ó£¬ÆäÖаüÀ¨Á˶ÔxmlÎļþµÃÈ¡Öµ¡¢¸³Öµ¡¢ÌáÈ¡½Úµã¡¢½ÚµãµÃ±éÀúµÈ¡£
SAXReader reader =
new
SAXReader();   
Document doc = reader.read(...);   
List childNodes = doc.selectNodes("//Config/Child/ChildNode"
);   
for
(Object obj:childNodes) {   
Node childNode = (Node)obj;   
  
String name = childNode.valueOf("@name"
);   
String text = childNode.getText();   
}   
  
  
  
Ò».Document¶ÔÏóÏà¹Ø  
  
1
.¶ÁÈ¡XMLÎļþ,»ñµÃdocument¶ÔÏó.  
              SAXReader reader = new
SAXReader();  
            &nb ......

¹ØÓÚRDFÓëXMLµÄÇø±ð

      ¸Õ¿ªÊ¼Ñ§Ï°ÓïÒåÍøµÄ֪ʶ£¬¸ù¾ÝÓïÒåÍø²ã´ÎÍƽø£¬¿´ÍêXML½ô½Ó×ÅRDF£¬ºöÈ»ÓиöÒÉÎÊ£ºÎªÊ²Ã´ÎÒÃÇÒ»¶¨ÒªÓÃRDF¶ø·Ç½ö½öʹÓÃÒѾ­ºÜ³ÉÊìµÄXMLÄØ£¿Ã²ËÆXML±ÈRDFÉÙÁËÒ»¸öÍÆÀíµÄϵͳ£¬¿ÉÒÔ¾ÍÍÆÀí¶øÑÔ£¬RDFÒ²¾ø²»ÊÇ×îºÃµÄ£¬ÏÔÈ»OWLµÄÍÆÀíÒª±ÈRDFÇ¿ºÜ¶à°¡£¬ÄÇôΪʲô»¹ÐèÒªÕâ¸ö²ã´ÎÄØ£¿
     ÔÚÍøÉÏÑ°ÁËN¾Ã£¬ÖÕÓڵõ½×Ô¼º±È½ÏÂúÒâµÄ´ð°¸£¬ÄóöÀ´¸ú´ó¼Ò¹²ÏíÏ¡£
     Ê×ÏÈ£¬XMLÓëRDFµÄÇø±ð£º
     1£®RDFģʽºÍXMLģʽÊDz»Í¬µÄXMLÊý¾ÝģʽÊÇÒ»¸öÎı¾¿ÉÀ©Õ¹ÓïÑÔ£¬Ïà±È֮ϣ¬RDFÓÐÒ»¸ö·Ç³£¼òµ¥µÄģʽ£¬¼´¶þÔª¹Øϵģʽ¡£µ±È»£¬ÈκεÄRDFÉùÃ÷ÐÎʽ¶¼¿ÉÒÔÓÃXMLÀ´±íʾ£¬µ«XMLÊDZ»É趨Ϊ¹Ì¶¨µÄ¡¢Ê÷×´µÄÎı¾£¬ÔÚÃèÊöÊý¾ÝÔªÉÏȱ·¦Ò»¶¨µÄÁé»îÐÔ¡£RDFģʽȴÊÇÓÐ×ã¹»µÄÁé»îÀ´ÃèÊöÕâÖÖÖ÷¹ÛµÄ¡¢·Ö²¼Ê½µÄ¡¢Óò»Í¬ÐÎʽÀ´±í´ïµÄÔªÊý¾Ý¡£
    2£®RDFºÍXMLËùʹÓõÄ×ÊÔ´²»Í¬
XMLÖÐËù̸µ½µÄ½Úµã£¬ÊÇXMLÎĵµÖеĽڵ㣬ÓÈÆäÊÇÔÚÎĵµ½á¹¹ÖÐÌض¨Ö®´¦¡£ÔÚRDFÖУ¬½Úµã²»ÔÚÊǽڵ㱾ÉíÁË£¬¶øÊÇÈκÎÆäËû¿ÉÓÃURIS±êʶµÄ×ÊÔ´£¬Òò´ËRDFÊÇÒ»ÖÖÔªÊý¾ÝÓïÑÔ¡£
    3£®XML SchemaºÍRDFµÄÓïÒ ......

missing } in XML expression

±¾´ÎÓöµ½µÄÎÊÌâÊÇ£ºÔÚÉÏ´«Îļþʱ£¬·µ»ØµÄjsonÊý¾Ý±»¼ÓÉÏÁË<pre></pre>±êÇ©¡££¨ÔÚÆÕͨµÄ±íµ¥Ìá½»²¢²»»á¼ÓÉÏ<pre>±êÇ©£©
ÀûÓÃfirebug²é¿´´íÎóÐÅϢΪ£º
missing } in XML expression  (<pre>{success:true, msg:'³É¹¦'}</pre>)
¶Ô´ËÎÊÌâ½â¾öÈçÏ£º
¶Ôresponse¶ÔÏóÉèÖ÷µ»ØÀàÐÍ£ºresp.setContentType("text/html");
ÕâÑù¾ÍÄÜÕýÈ·ÏÔʾjsonÊý¾ÝÁË ......

¸ñʽ»¯XMLÊä³ö

ËäÈ»XMLÉè¼ÆµÄ³õÖÔÊÇΪÁË·½±ã»úÆ÷Ö®¼äµÄ½»»¥£¨interoperability£©£¬¶øÐèÒªÂú×ã»úÆ÷¿ÉÔĶÁ£¨machine readable£©µÄÌØÐÔ¡£È»¶ø£¬ÓÉÓÚ³ÌÐòԱΪÁË·½±ã¿ª·¢£¬¼ÈÈ»XMLÊÇͨ¹ýÎı¾±íʾµÄ£¬²»ÈçÔÙÇ¿»¯Ò»Ð©£¬×öµ½ÈËÀà¿ÉÔĶÁ£¨human readable£©°É¡£XML¾¿¾¹ÊÇÄÄÖÖ¿ÉÔĶÁµÄÌÖÂÛÒѾ­ÊÇÀÏÉú³£Ì¸ÁË£¬ÕâÀï²»»áÉîÈë̽ÌÖ£¬Ö»ÊǽèÖúÕâ¸ö»ú»á½éÉÜһЩ·½±ãµÄ¸ñʽ»¯XMLµÄ·½·¨£¬Óë´ó¼Ò¹²Ïí¡£
½èÖúMSXMLµÄSAX½Ó¿Ú
SAXËäÈ»²»ÊÇW3CµÄ¹æ·¶£¬È»¶øXMLÉçÇøÈÔÈ»·¢Ñï¹â´óÁËÕâÖÖÁ÷ÍÆË͵ıà³ÌÄ£ÐÍ£¬²¢ÇÒ¹ãΪÁ÷´«¡£MSXMLÒ²Ö§³ÖSAX£¨ÕâÀïÌØÖ¸SAX2£©½Ó¿Ú£¬¶øÇÒSAX Writer»¹Ö§³ÖindentÊôÐÔ£¬ÏÔÈ»£¬¿ÉÒÔͨ¹ýSAX Reader¶ÁÈ¡²¢Ë͵½SAX Writer½øÐиñʽ»¯Êä³öµÄÄ¿µÄ¡£Ô´´úÂëÈçÏ£º
var oArgs = WScript.Arguments;
if (oArgs.length != 1)
{
WScript.Echo("Usage: cscript saxpretty.js [input xml]");
WScript.Quit();
}
input = oArgs(0);
var reader = new ActiveXObject("Msxml2.SAXXMLReader.6.0");
var writer = new ActiveXObject("Msxml2.MXXMLWriter.6.0");
try
{
writer.encoding = "utf-8";
writer.omitXMLDeclaration = false;
writer.standalone = true;
writer.indent = true ......

¿ìÒݱ¨±íµ¼³ö³ÉXMLÎļþ


¿ìÒݱ¨±íÓÐ×ÅÇ¿´óµÄÊä³ö¹¦ÄÜ£¬¿ÉÒÔÖ±½Ó°Ñweb±¨±íµ¼³öΪExcel¡¢Word¡¢Pdf¡¢TxtµÈÎļþÐÎʽ¡£µ«ÊÇһЩweb±¨±íÓû§Ï£Íû¿ÉÒÔ½«±¨±íµ¼³öµ½XMLÎļþÖÐÒÔ±ã¶ÔÊý¾Ý½øÐзÖÎöÓë½âÎö£¬ÕâÑù¾ÍÐèÒªÎÒÃÇÓÃһЩÌØÊâµÄ·½·¨È¥ÊµÏÖÁË¡£
ʵÏÖ˼·
£ºµ¼³öXML¹¦ÄܵĿÉÒÔͨ¹ý½«¼ÆËãºÃµÄIReport¶ÔÏ󴫵ݸø¿ìÒÝÌṩµÄcom.runqian.report4.view.xml.XMLReportÀàϵÄexport()·½·¨À´ÊµÏÖµ¼³ö¡£
 
ÏÂÃæ¸ù¾Ý˼·À´×öÒ»¸öÀý×Ó£¬ÊµÏÖ²½ÖèÈçÏ£º
Ê×ÏÈ´ò¿ªÈκÎÒ»ÕÅÒѾ­ÖÆ×÷ºÃµÄ¿ìÒݱ¨±í¡£
ÏÈ¿´Ï¸ñ¨±íÒ³ÃæÕ¹ÏÖµÄЧ¹û£¬ÈçÏÂͼ£º
È»ºóÖ»ÐèÔÚÕ¹ÏÖ±¨±íµÄjspÖмÓÈëÏÂÃæ´úÂ룺
Context ctx = new Context();//¹¹½¨±¨±íÒýÇæ¼ÆËã»·¾³
String path = “C:/api/reportFiles/demo.raq”; //¸ÃÎļþÃû¿ÉÒÔΪ¾ø¶Ô·¾¶£¬Ò²¿ÉÒÔÏà¶Ôµ±Ç°³ÌÐòÆô¶¯Â·¾¶
ReportDefine rd = (ReportDefine) ReportUtils.read(path);//¶ÁÈ¡±¨±í
Engine engine = new Engine(rd, ctx); //¹¹Ô챨±íÒýÇæ
IReport report = engine.calc();//ÔËË㱨±í
XMLReport xml = new XMLReport();//´´½¨µ¼³öXMLÀàµÄʵÀý
xml.export(report);//½«¼ÆËãºÃµÄ±¨±í´«µÝ¸øxmlÀàµÄexport·½·¨ÖÐ
xml.saveTo(”C:/demo.xml”);//xmlÎÄ ......

jdom¶ÔxmlÎļþµÄ¶Áд²Ù×÷

jdom¶ÔxmlÎļþµÄ¶Áд²Ù×÷
1.         ¶ÁÈ¡XMLÎļþJavaÔ´´úÂ룺
1)        xmlÎļþ£º
<?xml version="1.0" encoding="gb2312"?>
<messages>
    <message id="1">
       <title>Èí¼þ¹¤³Ìʦ</title>
       <content>
        <name>solidwang</name>
        <age>23</age>
       </content>
       <email>wzzcctv@126.com</email>
    </message>
    <message id="2">
       <title>µ¼ÓÎ</title>
       <content>
        <name>eillenwang</name>
        <age>20</age>
  &nbs ......
×ܼǼÊý:815; ×ÜÒ³Êý:136; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [121] [122] [123] [124] 125 [126] [127] [128] [129] [130]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ