Module | Test::Unit::XML |
In: |
lib/test/unit/xml/xml_assertions.rb
lib/test/unit/xml/nodeiterator.rb lib/test/unit/xml/conditionals.rb lib/test/unit/xml/xmlequalfilter.rb |
This method checks whether two well-formed XML documents are equal. Two XML documents are considered equal if:
Nodes are tested for equality as follows:
XML Declarations: | XML declarations are equal if they have the same version, encoding, and stand-alone pseudo-attributes. |
Doctype: | Doctypes are equal if they fulfill all of the following conditions:
|
Internal General Entity Declaration: | Internal General entity declarations are equal if they have the same name, and the same value. |
External General Entity Declaration: | External general entity declarations are equal if they have the same name, and if the identifiers are of the same type (PUBLIC or SYSTEM) and have the same value. Note that if the identifiers are URLs, a comparison may fail even though both URLS point to the same resource, for example if one URL is relative and the other is absolute. |
Notation Declaration: | Notation declarations are equal if they have the same name, and if the identifiers are of the same type (PUBLIC or SYSTEM) and have the same value. |
Elements: | Elements are considered equal if they have the same generic identifier (tag name), belong to the same namespace, and have the same attributes. Note that the namespace prefixes of two elements may be different as long as they belong to the same namespace. |
Attributes: | Attributes are equal if they belong to the same namespace, have the same name, and the same value. |
Namespace Declarations: | Namespace declarations (attributes named
xmlns:prefix) are ignored. There are several reasons for
this:
|
Processing Instructions: | Processing instructions are considered equal if the string values of their targets and contents are equal. |
Text: | Text nodes are equal if their values are equal. However, empty text nodes, and text nodes containing only whitespace are ignored. |
CDATA: | CDATA nodes are equal if their text content is equal. Whitespace is not normalized. |
Comments: | Comments are equal if they have the same content. |
The expected_doc and actual_doc arguments to this method may be of the following types:
This method compares two XML documents and returns true if they are not equal, false otherwise. This is the inverse of assert_xml_equal.