【问题标题】:ANT - replace xml declarationANT - 替换 xml 声明
【发布时间】:2012-06-20 12:04:03
【问题描述】:

我有一个 XML 文档,它由附加到它的几个其他 XML 文档组成。因此,文档中有几个 XML 声明会阻止我的 XSLT 正确解析它。我正在尝试使用 ant replacereplaceregexp 任务从文档中删除声明,但它们对文件没有任何作用。这是我目前所拥有的。

<replaceregexp file="${cppUnit.file}" >
    <regexp pattern="&lt;?xml * ?&gt;" />
    <substitution expression="" />
</replaceregexp>

【问题讨论】:

    标签: xml ant replace xml-declaration


    【解决方案1】:

    试试这个:

    <replaceregexp file="${cppUnit.file}" match="&lt;\?xml.*\?&gt;"
         replace="" byline="true"/>
    

    【讨论】:

    • 太好了,谢谢。我是蚂蚁新手,所以我不知道如何避开那些问号。
    【解决方案2】:

    好的。这行得通。

    <regexp pattern="..?xml version=.1.0. encoding='ISO-8859-1' standalone='yes' ?..." />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多