Class: Canon::Diff::XmlSerializationFormatter
- Inherits:
-
Object
- Object
- Canon::Diff::XmlSerializationFormatter
- Defined in:
- lib/canon/diff/xml_serialization_formatter.rb
Overview
Detects and classifies XML serialization-level formatting differences.
Serialization-level formatting differences are differences in XML syntax that do not affect the semantic content of the document. These differences arise from different valid ways to serialize the same semantic content.
These differences are ALWAYS non-normative (formatting-only) regardless of match options, because they are purely syntactic variations.
Examples:
-
Self-closing vs explicit closing tags: <tag/> vs <tag></tag>
-
Attribute quote style: attr=“value” vs attr=‘value’ (parser-normalized)
-
Whitespace within tags: <tag a=“1” b=“2”> vs <tag a=“1” b=“2”> (parser-normalized)
Note: Some serialization differences are normalized away by XML parsers (attribute quotes, tag spacing). This class focuses on differences that survive parsing and comparison, such as self-closing vs explicit closing.
Class Method Summary collapse
-
.serialization_formatting?(diff_node) ⇒ Boolean
Detect if a diff node represents an XML serialization formatting difference.
Class Method Details
.serialization_formatting?(diff_node) ⇒ Boolean
Detect if a diff node represents an XML serialization formatting difference.
Serialization formatting differences are ALWAYS non-normative because they represent different valid serializations of the same semantic content.
30 31 32 33 34 35 36 |
# File 'lib/canon/diff/xml_serialization_formatter.rb', line 30 def self.serialization_formatting?(diff_node) # Currently only handles text_content dimension # Future: add detection for other dimensions return false unless diff_node.dimension == :text_content empty_text_content_serialization_diff?(diff_node) end |