我有一個輸出,其中我想獲取CMEngine
節點的值,即CMEngine
節點內的所有內容。請幫我用正則表達式,我已經有了一個使用正則表達式的java代碼,所以我只需要正則表達式。由於正則表達式獲取xml節點字符串值
我的XML
<General>
<LanguageID>en_US</LanguageID>
<CMEngine>
<CMServer/> <!-- starting here -->
<DaysToKeepHistory>4</DaysToKeepHistory>
<PreprocessorMaxBuf>5000000</PreprocessorMaxBuf>
<ServiceRefreshInterval>30</ServiceRefreshInterval>
<ReuseMemoryBetweenRequests>true</ReuseMemoryBetweenRequests>
<Trace Enabled="false">
<ActiveCategories>
<Category>ENVIRONMENT</Category>
<Category>EXEC</Category>
<Category>EXTERNALS</Category>
<Category>FILESYSTEM</Category>
<Category>INPUT_DOC</Category>
<Category>INTERFACES</Category>
<Category>NETWORKING</Category>
<Category>OUTPUT_DOC</Category>
<Category>PREPROCESSOR_INPUT</Category>
<Category>REQUEST</Category>
<Category>SYSTEMRESOURCES</Category>
<Category>VIEWIO</Category>
</ActiveCategories>
<SeverityLevel>ERROR</SeverityLevel>
<MessageInfo>
<ProcessAndThreadIds>true</ProcessAndThreadIds>
<TimeStamp>true</TimeStamp>
</MessageInfo>
<TraceFile>
<FileName>CMEngine_log.txt</FileName>
<MaxFileSize>1000000</MaxFileSize>
<RecyclingMethod>Restart</RecyclingMethod>
</TraceFile>
</Trace>
<JVMLocation>C:\Informatica\9.1.0\java\jre\bin\server</JVMLocation>
<JVMInitParamList/> <!-- Ending here -->
</CMEngine>
</General>
不知道你想達到什麼,但看看這是否可以幫助:http://stackoverflow.com/questions/7008466/selecting-xml-raw-text –
如果你通過任何關於SO對此,你應該看到你一般不會使用正則表達式來完成這些任務。相反,讓自己一個正確的XML解析器! –