XML diff and merge

目录

简介

Base abstract class for all the comparsion classes in the extension.

类摘要

XMLDiff\Base

class XMLDiff\Base {

/* 方法 */

public __construct ( string $nsname )

abstract public mixed diff ( mixed $from , mixed $to )

abstract public mixed merge ( mixed $src , mixed $diff )

}

XMLDiff\Base::__construct

Constructor

说明

public XMLDiff\Base::__construct ( string $nsname )

Base constructor for all the worker classes in the xmldiff extension.

参数

nsname
Custom namespace name for the diff document. The default namespace is http://www.locus.cz/diffmark and that's enough to avoid namespace conflicts. Use this parameter if you want to change it for some reason.

返回值

XMLDiff\Base::diff

Produce diff of two XML documents

说明

abstract public mixed XMLDiff\Base::diff ( mixed $from , mixed $to )

Abstract diff method to be implemented by inheriting classes.

The basic purpose of this method is to produce diff of the two documents. The param order matters and will produce different output.

参数

from
Source XML document.

to
Target XML document.

返回值

Implementation dependent.

XMLDiff\Base::merge

Produce new XML document based on diff

说明

abstract public mixed XMLDiff\Base::merge ( mixed $src , mixed $diff )

Abstract merge method to be implemented by inheriting classes.

Basically the method purpose is to produce a new XML document based on the diff information.

参数

src
Source XML document.

diff
Document produced by the diff method.

返回值

Implementation dependent.

简介

类摘要

XMLDiff\DOM

class XMLDiff\DOM extends XMLDiff\Base {

/* 方法 */

public DOMDocument diff ( DOMDocument $from , DOMDocument $to )

public DOMDocument merge ( DOMDocument $src , DOMDocument $diff )

/* 继承的方法 */

public XMLDiff\Base::__construct ( string $nsname )

abstract public mixed XMLDiff\Base::diff ( mixed $from , mixed $to )

abstract public mixed XMLDiff\Base::merge ( mixed $src , mixed $diff )

}

XMLDiff\DOM::diff

Diff two DOMDocument objects

说明

public DOMDocument XMLDiff\DOM::diff ( DOMDocument $from , DOMDocument $to )

Diff two DOMDocument instances and produce the new one containing the diff information.

参数

from
Source DOMDocument object.

to
Target DOMDocument object.

返回值

DOMDocument with the diff information or NULL.

XMLDiff\DOM::merge

Produce merged DOMDocument

说明

public DOMDocument XMLDiff\DOM::merge ( DOMDocument $src , DOMDocument $diff )

Create new DOMDocument based on the diff.

参数

src
Source DOMDocument object.

diff
DOMDocument object containing the diff information.

返回值

Merged DOMDocument or NULL.

简介

类摘要

XMLDiff\Memory

class XMLDiff\Memory extends XMLDiff\Base {

/* 方法 */

public string diff ( string $from , string $to )

public string merge ( string $src , string $diff )

/* 继承的方法 */

public XMLDiff\Base::__construct ( string $nsname )

abstract public mixed XMLDiff\Base::diff ( mixed $from , mixed $to )

abstract public mixed XMLDiff\Base::merge ( mixed $src , mixed $diff )

}

XMLDiff\Memory::diff

Diff two XML documents

说明

public string XMLDiff\Memory::diff ( string $from , string $to )

Diff two strings containing XML documents and produce the diff information.

参数

from
Source XML document.

to
Target XML document.

返回值

String with the XML document containing the diff information or NULL.

XMLDiff\Memory::merge

Produce merged XML document

说明

public string XMLDiff\Memory::merge ( string $src , string $diff )

Create new XML document based on diffs and source document.

参数

src
Source XML document.

diff
XML document containing diff information.

返回值

String with the new XML document or NULL.

简介

类摘要

XMLDiff\File

class XMLDiff\File extends XMLDiff\Base {

/* 方法 */

public string diff ( string $from , string $to )

public string merge ( string $src , string $diff )

/* 继承的方法 */

public XMLDiff\Base::__construct ( string $nsname )

abstract public mixed XMLDiff\Base::diff ( mixed $from , mixed $to )

abstract public mixed XMLDiff\Base::merge ( mixed $src , mixed $diff )

}

XMLDiff\File::diff

Diff two XML files

说明

public string XMLDiff\File::diff ( string $from , string $to )

Diff two local XML files and produce string with the diff information.

参数

from
Path to the source document.

to
Path to the target document.

返回值

String with the XML document containing the diff information or NULL.

XMLDiff\File::merge

Produce merged XML document

说明

public string XMLDiff\File::merge ( string $src , string $diff )

Create new XML document based on diffs and source document.

参数

src
Path to the source XML document.

diff
Path to the XML document with the diff information.

返回值

String with the new XML document or NULL.