finished basic account add
[Bookkeeping.git] / src / com / interrupt / bookkeeping / cc / ReplaceVisitor.java
blob09088891586353d8418b8c3257b247c4afa16d4e
1 package com.interrupt.bookkeeping.cc;
3 import org.apache.log4j.Logger;
5 import com.interrupt.bob.base.Bob;
6 import com.interrupt.bob.base.IBob;
7 import com.interrupt.bob.base.IVisitor;
8 import com.interrupt.bookkeeping.cc.bkell.Bkell;
10 public class ReplaceVisitor implements IVisitor {
12 private Logger logger = Logger.getLogger(ReplaceVisitor.class);
13 public String _id = null;
14 public String _tname = null;
15 public IBob replacor = null;
17 public void visit(IBob bob) {
19 String tname = bob.getTagName();
20 org.xml.sax.Attributes attrs = bob.getAttributes();
21 String id = attrs.getValue("id");
22 //logger.debug("");
23 //logger.debug("ReplaceVisitor / Visiting tname["+ tname +"] / id["+ id +"]");
25 for( int i = 0; i < attrs.getLength(); i++ ) {
26 String qname = attrs.getQName(i);
27 String qvalue = attrs.getValue(qname);
28 //logger.debug("Attribute qname["+ qname +"] / value["+ qvalue +"]");
31 if(_tname != null && _tname.equals(tname)) {
32 if(_id != null && _id.equals(id)) {
34 logger.debug("Replacing...");
35 logger.debug("1. parent ["+bob.getParent()+"] / ["+bob.toXML()+"]");
36 logger.debug("2. parent ["+replacor.getParent()+"] / ["+replacor.toXML()+"]");
38 bob.replace(replacor);