Class SchemaLocationNodeValueMerge

All Implemented Interfaces:
Comparable<Object>, MergeHandler

public class SchemaLocationNodeValueMerge extends SpaceDelimitedNodeValueMerge

Designed to specifically handle the merge of schemaLocation references. This takes any of the Spring XSD references for particular Spring versions and replaces them with XSDs without a version reference. This allows the final XSD reference to refer to the latest version of Spring, and reduces the need for modules to be updated with every Spring update.

This will also prevents multiple XSD references that cause parse exceptions when the final XML file is presented to Spring

Author:
Phillip Verheyden (phillipuniverse)
  • Constructor Details

    • SchemaLocationNodeValueMerge

      public SchemaLocationNodeValueMerge()
  • Method Details

    • getMergedNodeValues

      protected Set<String> getMergedNodeValues(Node node1, Node node2)
      Overrides:
      getMergedNodeValues in class NodeValueMerge
    • getSanitizedValue

      protected String getSanitizedValue(String attributeValue)

      Sanitizes the given attribute value by stripping out the version number for the Spring XSDs.

      For example, given http://www.springframework.org/schema/beans/spring-beans-4.1.xsd this will return http://www.springframework.org/schema/beans/spring-beans.xsd

      Parameters:
      attributeValue - the value of an xsi:schemaLocation attribute
      Returns:
      the given string with all of the Spring XSD version numbers stripped out.