Topic: 请问这种XML该怎么读? |
Print this page |
1.请问这种XML该怎么读? | Copy to clipboard |
Posted by: focus Posted on: 2006-07-27 13:53 <?xml version="1.0" encoding="UTF-8"?> <Domain ConfigurationVersion="8.1.4.0" Name="default"> <Server JDBCLogFileName="myserver\logs\jdbc.log" JDBCLoggingEnabled="true" ListenAddress="" ListenPort="8001" Name="myserver" NativeIOEnabled="true" ReliableDeliveryPolicy="RMDefaultPolicy" ServerVersion="8.1.5.0" StdoutSeverityLevel="64" TransactionLogFilePrefix="./logs/"> <SSL Enabled="false" HostnameVerificationIgnored="false" IdentityAndTrustLocations="KeyStores" Name="myserver"/> <Log FileName=".\myserver\logs\myserver.log" Name="myserver"/> <WebServer LogFileName="myserver\logs\access.log" Name="myserver"/> </Server> <JMSFileStore Directory="rmfilestore" Name="FileStore"/> <WSReliableDeliveryPolicy DefaultRetryCount="10" DefaultTimeToLive="60000" Name="RMDefaultPolicy" Store="FileStore"/> <Application Name="LWDefault" Path="\SWECTool\develop\webapps" StagingMode="nostage" TwoPhase="true"> <WebAppComponent Name="LWDefault" Targets="myserver" URI="LWDefault"/> </Application> <Security Name="default" PasswordPolicy="wl_default_password_policy" Realm="wl_default_realm" RealmSetup="true"/> <EmbeddedLDAP CredentialEncrypted="{3DES}4YM+lPoXq4JjISwNiVMG0NWEYv1x8UisyHBjFGLKXTE=" Name="default"/> <SecurityConfiguration CredentialEncrypted="{3DES}nk17dpuVuTRweGdcTe0L3RV5vEe2OhrcvMlKP6A0WJhN24dEnm89DcWiFsx5s365+4ZS4jqOyJLErlLV1hET27eu7gjMGqK4" Name="default" RealmBootStrapVersion="1"/> <Realm FileRealm="wl_default_file_realm" Name="wl_default_realm"/> <FileRealm Name="wl_default_file_realm"/> <PasswordPolicy Name="wl_default_password_policy"/> <JMSServer Name="WSStoreForwardInternalJMSServermyserver" Store="FileStore" Targets="myserver"> <JMSQueue CreationTime="1113459071143" JNDIName="jms.internal.queue.WSStoreForwardQueue" JNDINameReplicated="false" Name="WSInternaljms.internal.queue.WSStoreForwardQueuemyserver"/> <JMSQueue CreationTime="1113459071373" JNDIName="jms.internal.queue.WSDupsEliminationHistoryQueue" JNDINameReplicated="false" Name="WSInternaljms.internal.queue.WSDupsEliminationHistoryQueuemyserver"/> </JMSServer> <JDBCConnectionPool ConnLeakProfilingEnabled="true" DriverName="oracle.jdbc.OracleDriver" Name="omeConnectionPool" PasswordEncrypted="{3DES}SwcY3BM2OD0=" Properties="user=smile" RemoveInfectedConnectionsEnabled="false" StatementCacheSize="0" Targets="myserver" TestConnectionsOnCreate="true" TestConnectionsOnReserve="true" TestTableName="SQL SELECT 1 FROM DUAL" URL="jdbc:oracle:thin192.168.0.165:1521:jxsf"/> <Application Name="OmeDataSelect" Path="\SWECTool\bea\user_projects\domains\default\myserver\upload" StagingMode="nostage" TwoPhase="true"> <EJBComponent Name="OmeDataSelect" Targets="myserver" URI="OmeDataSelect.jar"/> </Application> <Log FileName=".\logs\default.log" Name="default"/> <Application Name="SmilePrint" Path="\SWECTool\develop\rakurakuweb" StagingMode="nostage" TwoPhase="true"> <WebAppComponent Name="SmilePrint" Targets="myserver" URI="SmilePrint"/> </Application> </Domain> 我只需要读取第45行的 URL="jdbc:oracle:thin192.168.0.165:1521:jxsf" 就OK了,但是在网上查到的文章读取的XML的格式都比这个简单. 没有发现有读我这种XML的文章. 誰能给出代码?谢谢了! |
2.Re:请问这种XML该怎么读? [Re: focus] | Copy to clipboard |
Posted by: zcjl Posted on: 2006-07-27 15:07 使用xpath,"/Domain/JDBCConnectionPool" 使用dom4j的示例如下(假设前面的xml路径为d:/test.xml): SAXReader reader = new SAXReader(); |
3.Re:请问这种XML该怎么读? [Re: focus] | Copy to clipboard |
Posted by: focus Posted on: 2006-07-27 20:28 出现了这个问题该怎么解决啊? java.lang.NoClassDefFoundError: org/jaxen/JaxenException at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230) at org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:207) at org.dom4j.tree.AbstractNode.selectSingleNode(AbstractNode.java:183) at jp.co.smile.common.Department.main(Department.java:128) Exception in thread "main" |
4.Re:请问这种XML该怎么读? [Re: focus] | Copy to clipboard |
Posted by: focus Posted on: 2006-07-27 21:40 谢谢大虾提示! 已搞定。 需要下载三个包: 1.dom4j-1.6.1.jar 2.jaxen-full.jar 3.saxpath.jar 然后添加到工程中去。 我的代码:
成功输出:jdbc:oracle:thin:@192.168.0.165:1521:jxsf 谢谢,呵呵。 { one point for follow-up -- why } |
5.Re:请问这种XML该怎么读? [Re: focus] | Copy to clipboard |
Posted by: zcjl Posted on: 2006-07-28 09:54 gx问题得到解决 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |