java.lang.Object
org.codehaus.mojo.jaxb2.schemageneration.postprocessing.schemaenhancement.ChangeNamespacePrefixProcessor
All Implemented Interfaces:
NodeProcessor

public class ChangeNamespacePrefixProcessor extends Object implements NodeProcessor

NodeProcessor which alters the namespace prefix for all relevant Nodes within an XML document Node. It alters namespace prefixes in the following logical places:

Schema Namespace Definition
xmlns:oldPrefix="http://some/namespace" is altered to xmlns:newPrefix="http://some/namespace"
Elements Namespace Prefix
<oldPrefix:someElement ... > is altered to <newPrefix:someElement ... >
Element Reference
<xs:element ref="oldPrefix:aRequiredElementInTheOldPrefixNamespace"/> is altered to <xs:element ref="newPrefix:aRequiredElementInTheOldPrefixNamespace"/>
Type Attribute
<xs:element type="oldPrefix:something"/> is altered to <xs:element type="newPrefix:something"/>
Type Extension
<xs:extension base="oldPrefix:something"/> is altered to <xs:extension base="newPrefix:something"/>
Since:
1.4
Author:
Lennart Jörelid
  • Constructor Details

    • ChangeNamespacePrefixProcessor

      public ChangeNamespacePrefixProcessor(String oldPrefix, String newPrefix)
      Creates a new ChangeNamespacePrefixProcessor providing the oldPrefix which should be replaced by the newPrefix.
      Parameters:
      oldPrefix - The old/current namespace prefix
      newPrefix - The new/substituted namespace prefix
  • Method Details

    • accept

      public boolean accept(Node aNode)
      Defines if this visitor should process the provided node.
      Specified by:
      accept in interface NodeProcessor
      Parameters:
      aNode - The DOM node to process.
      Returns:
      true if the provided Node should be processed by this NodeProcessor.
    • process

      public void process(Node aNode)
      Processes the provided DOM Node.
      Specified by:
      process in interface NodeProcessor
      Parameters:
      aNode - The DOM Node to process.