ÓÃDom4J½âÎö´øÃüÃû¿Õ¼äµÄXMLÎļþ
Dom4JÊÇÒ»¸ö¿ªÔ´µÄÓÅÐãµÄXML½âÎöAPI£¬ÏÖÔÚÔ½À´Ô½¶àµÄÏîÄ¿ÖпªÊ¼²ÉÓÃÕâÖÖ½âÎö·½Ê½£¬ÆäÖаüº¬ÁËÖøÃûµÄHibernate¡£ÕâÀïÎÒÃÇʹÓÃDom4J½âÎöÒ»¸ö´øÃüÃû¿Õ¼äµÄCXFµÄSpringÅäÖÃÎļþ¡£Ïȵ¼Èëdom4j-1.6.1.jar
spring ÅäÖÃÎļþ applicationContext-cxf.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd"
default-autowire="byName" default-lazy-init="true">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<bean id="jaxWsServiceFactoryBean" class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean" scope="prototype">
<property name="wrapped" value="true"/>
<property name="dataBinding" ref="aegisBean"/>
<property name="serviceConfigurations">
<list>
<bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
<bean class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration"/>
<bean class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
</list>
</property>
</bean>
<bean id="aegisBean" class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
<jaxws:endpoint id="WSpersonService" implementor="#personService" address="/PersonService">
<jaxws:serviceFactory>
Ïà¹ØÎĵµ£º
5. ÃüÃû¹æÔò£¨²»ÄÜ°üÀ¨ xml£¬¿Õ¸ñ£¬¼âÀ¨ºÅ£¬µÈÌØÊâ·ûºÅ£¬²»ÄÜÊý×Ö¿ªÍ·£©
6. ¿ÉÒÔ×Ô´øÊôÐÔ¡£ÊôÐÔÖµÓÓ”±êʾ
7. ×¢ÊÍ<!--×¢Ê͵ÄÄÚÈÝ-->
8. Èç¹ûÒªÏÔʾÌØÊâ·ûºÅ¿ÉÓÃ<![CDATA[ ÕâÀïдÌØÊâ·ûºÅ ]]>
´´½¨
var xml:XML=<shuiGuo>
& ......
XmlDocument xmldoc = new XmlDocument();//´´½¨xmlÎĵµ¶ÔÏó
XmlNode root;//¸ù½Úµã
xmldoc.Load(Server.MapPath("address.xml"));//¼ÓÔØxmlÎĵµ
root = xmldoc.DocumentEle ......
1.Èç¹ûÐèÒªÔÚÓ¦ÓóÌÐòÖд¦ÀíxmlÊý¾Ý£¬Ê×ÏÈÒª´´½¨1¸öXmlDocument¶ÔÏó£¬È»ºóͨ¹ýload·½·¨´ÓxmlÊý¾ÝÔ´ÖмÓÔضÔÏó¡£
2.xmlÖеÄÊý¾ÝÖ÷Òª±íÏÖΪԪËغÍÊôÐÔÁ½ÖÖÐÎʽ¡£
3.¶ÁÈ¡ÔªËØ
¶ÁÈ¡ÔªËØ¿Éͨ¹ýij½ÚµãµÄChildNodesÊôÐÔ»ñÈ¡Æä×ӽڵ㼯ºÏ£¬È»ºó¸ù¾Ý½ÚµãµÄNodeTypeÊôÐÔÈ·¶¨´Ë½ÚµãÊÇ·ñÊôÓÚÔªËؽڵ㡣ԪËؽڵãµÄÃû³Æ¿Éͨ¹ýNameÊôÐÔ» ......
C# code
// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("output.xsl");
// Execute the transform and output the results to a file.
xslt.Transform("books.xml", "books.html");
......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white" viewSourceURL="srcview/index.html">
<mx:S ......