如何阅读&在android中更新xml文件?

时间:2012-09-26 12:09:42

标签: android xml xml-parsing xmlpullparser

这可能是一个基本问题,但我是xml解析的新手,这就是我需要一些帮助的原因。所以问题是:我只想从android中的res文件夹中读取一个xml文件,并更新该文件中某些标签的值;那怎么办呢?请帮帮我。以下是xml文件,我想更新标签“事件过滤器”的值,该标签当前具有值“moneyback”。我搜索了很多线程,但我仍然无法解决问题。

 <?xml version="1.0" encoding="UTF-8"?>
 <HawkAgentPolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <config>
  <installedappthreadtime>10</installedappthreadtime>
  <runningprocessthreadtime>10</runningprocessthreadtime>
  <networkconnectionsthreadtime>10</networkconnectionsthreadtime>
</config>
<policy name="DayCapturePolicy" type="capture">
 <starttime>9:00:00 AM</starttime>
 <endtime>9:00:00 PM</endtime>
 <event name="NEW_APP_INSTALLED">
  <eventFilter selectedAppName="Moneyback"/> 
   <eventParam>selectedAppName</eventParam>
  <eventParam>selectedAppVersion</eventParam>
  <eventParam>appPackageName</eventParam>
  <eventParam>appDirPath</eventParam>
</event>
<event name="NEW_PROCESS_STARTED">
  <eventFilter runningAppName="Moneyback" /> 
  <eventParam>runningAppName</eventParam>
  <eventParam>runningAppProcessId</eventParam>
  <eventParam>runningProcessName</eventParam>
</event>
<event name="INBOUND_CONNECTION">    
  <eventFilter netAppName="Moneyback"/> 
  <eventParam>netProtocol</eventParam>
  <eventParam>netRemoteIP</eventParam>
  <eventParam>netRemotePort</eventParam>
  <eventParam>netStatus</eventParam>
  <eventParam>netUID</eventParam>
  <eventParam>netAppName</eventParam>
</event>
<event name="OUTBOUND_CONNECTION">
<eventFilter netAppName="Moneyback"/> 
<eventParam>netProtocol</eventParam>
  <eventParam>netRemoteIP</eventParam>
  <eventParam>netRemotePort</eventParam>
  <eventParam>netStatus</eventParam>
  <eventParam>netUID</eventParam>
  <eventParam>netAppName</eventParam>
 </event>
 </policy>
</HawkAgentPolicy>

0 个答案:

没有答案