java - 分发 XML 文件

标签 java xml

我对 XML 及其功能完全陌生。

我有一个文件 xyz.xml 。 它包含这样的内容:

<system-config>
    <business-model>
      <agent-category key="operator">
         <singular-name>Operator</singular-name>
         <plural-name>Operators</plural-name>
         <attribute>agent-attribute.reference</attribute>
      </agent-category>

接下来我有

  <agent-attribute id="agent-attribute.reference">
     <name>Reference</name>
     < description>A unique identifier for this agent, typically an MSISDN.</description>
     <mandatory>true< /mandatory>
     <editable>false< /editable>
     <deletable>false< /deletable>
     <sensitive>false< /sensitive>
     <system-generated>false< /system-generated>
     <input-method xsi:type="AgentReferenceInputMethod"></input-method>
     <storage-location xsi:type="AgentRefStorage" field="reference"></storage-location>
     </agent-attribute>
 </business-model>

现在我想将代理属性分发到名为 agentAttr.xml 的不同文件。

是否可以这样做(注意 <agent-attribute><system-config><business-model> 下),如果可以的话怎么做?

最佳答案

所以你想提取代理属性部分?。您可以通过简单的 XSLT 转换来做到这一点(例如使用 Xalan )。另一个选择可能是 jsoup ,使用 DOM 或手动解析它。

关于java - 分发 XML 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14435023/

相关文章:

java - 在 groovy/java 中使用 Jira Rest Java 客户端 (JRJC) 更新问题

java - Tomcat 启动但主页无法使用 url http ://localhost:8080 打开

php - 从 YouTube 视频中读取 XML

python - 如何通过一些修改将 xml 转换为字典?

android - 复合 XML 形状

java - 以矩阵格式打印二维数组java

java - Eclipse 菜单管理器 : get ImageDescriptor of Image?

.net - XML xpath Visual Studio

xml - SandcaSTLe 文档 xml 代码示例显示无回车

java - BeanPostProcessor 混淆