org.cip4.jdflib.elementwalker
Class AttributeReplacer

java.lang.Object
  extended by org.cip4.jdflib.elementwalker.ElementWalker
      extended by org.cip4.jdflib.elementwalker.BaseElementWalker
          extended by org.cip4.jdflib.elementwalker.AttributeReplacer

public class AttributeReplacer
extends BaseElementWalker

Author:
Dr. Rainer Prosi, Heidelberger Druckmaschinen AG June 9, 2008 replaces all instances of an attribute in all matching elements

Nested Class Summary
 class AttributeReplacer.WalkAttributeReplacer
          the link and ref walker
 class AttributeReplacer.WalkDefault
          the link and ref walker
 
Field Summary
protected  JDFAttributeMap theMap
          fills this into the factory
 
Fields inherited from class org.cip4.jdflib.elementwalker.BaseElementWalker
log
 
Fields inherited from class org.cip4.jdflib.elementwalker.ElementWalker
theFactory
 
Constructor Summary
AttributeReplacer(JDFAttributeMap setMap, String elementExpression)
           
AttributeReplacer(String attributeName, String newValue, String elementExpression)
           
 
Method Summary
protected  BaseWalkerFactory getFactory()
           
 void replace(KElement root)
          erase all unlinked resources that are in n
 void setMap(JDFAttributeMap map)
           
 
Methods inherited from class org.cip4.jdflib.elementwalker.BaseElementWalker
constructWalkers
 
Methods inherited from class org.cip4.jdflib.elementwalker.ElementWalker
toString, walkTree, walkTreeKidsFirst
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

theMap

protected JDFAttributeMap theMap
fills this into the factory

Constructor Detail

AttributeReplacer

public AttributeReplacer(String attributeName,
                         String newValue,
                         String elementExpression)
Parameters:
attributeName - the attribute to replace
newValue - the new value, if null the attribute is removed
elementExpression - the elements to match, if null all match

AttributeReplacer

public AttributeReplacer(JDFAttributeMap setMap,
                         String elementExpression)
Parameters:
setMap - the map of attributes to set
elementExpression - the elements to match, if null all match
Method Detail

replace

public void replace(KElement root)
erase all unlinked resources that are in n

Parameters:
root - the element to clean

getFactory

protected BaseWalkerFactory getFactory()
Overrides:
getFactory in class BaseElementWalker
Returns:
the factory for this worker

setMap

public void setMap(JDFAttributeMap map)
Parameters:
map - the attribute map to set


Copyright © 2013. All Rights Reserved.