跳转到主要内容

XUpdate Processor

项目描述

简介

在XML文档上应用xupdate diff。

测试

要运行测试

python -m unittest discover src

或使用zc.buildoutzope.testrunner

buildout
./bin/test

使用方法

就像这样

>>> from xupdate_processor import applyXUpdate
>>> from lxml import etree
>>> xml_doc_string = """<?xml version="1.0"?>
<erp5>
  <object portal_type="Test">
    <title>A</title>
  </object>
  <object portal_type="Test">
    <title>A</title>
  </object>
  <object portal_type="Test">
    <title>A</title>
  </object>
</erp5>
"""
>>> xml_xu_string = """<?xml version="1.0"?>
<xupdate:modifications xmlns:xupdate="http://www.xmldb.org/xupdate" version="1.0">
  <xupdate:update select="/erp5/object[2]/title">B</xupdate:update>
  <xupdate:update select="/erp5/object[3]/title">C</xupdate:update>
</xupdate:modifications>
"""
>>> result_tree = applyXUpdate(xml_xu_string=xml_xu_string, xml_doc_string=xml_doc_string)
>>> print etree.tostring(result_tree, pretty_print=True)
<erp5>
  <object portal_type="Test">
    <title>A</title>
  </object>
  <object portal_type="Test">
    <title>B</title>
  </object>
  <object portal_type="Test">
    <title>C</title>
  </object>
</erp5>

历史

0.5 (2022-09-14)

  • 支持python3和python2.7,通过删除对PyXML的依赖来实现。

0.4 (2010-01-21)

  • [修复] 子元素可能被错误地追加

    [nicolas Delaby]

0.3 2010-01-19

  • 更新setup.py

0.2 (2010-01-19)

  • 重构egg结构目录

    [nicolas Delaby]

  • 使用unittest模块代替DOCTEST

    [nicolas Delaby]

  • 添加PyXML依赖以支持具有xml.sax.handler.feature_namespace_prefixes功能的sax解析器。

    [nicolas Delaby]

  • 删除zope.interface依赖

  • [修复] 子元素可能被错误地追加

0.1 (2009-12-12)

  • 初始实现

    [nicolas Delaby]

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码分发

xupdate-processor-0.5.tar.gz (10.8 kB 查看哈希值)

上传时间 源代码

由以下支持