org.codehaus.mojo.jaxb2.helpers
Class ChangeNamespacePrefixProcessor

java.lang.Object
  extended by org.codehaus.mojo.jaxb2.helpers.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. The ChangeNamespacePrefixProcessor alters namespace prefixes in 3 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"/>

Author:
Lennart Jörelid

Constructor Summary
ChangeNamespacePrefixProcessor(String oldPrefix, String newPrefix)
          Creates a new ChangeNamespacePrefixProcessor providing the oldPrefix which should be replaced by the newPrefix.
 
Method Summary
 boolean accept(Node aNode)
          Defines if this visitor should process the provided node.
 void process(Node aNode)
          Processes the provided DOM Node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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.


Copyright © 2005-2012 Codehaus. All Rights Reserved.