1 package net.sf.saxon.event; 2 import net.sf.saxon.om.NamePool; 3 import net.sf.saxon.trans.XPathException; 4 5 14 15 16 public class NamePoolConverter extends ProxyReceiver { 17 18 NamePool oldPool; 19 NamePool newPool; 20 21 24 25 public NamePoolConverter(NamePool oldPool, NamePool newPool) { 26 this.oldPool = oldPool; 27 this.newPool = newPool; 28 } 29 30 35 36 public void setUnderlyingReceiver(Receiver receiver) { 37 nextReceiver = receiver; 38 } 39 40 43 44 public void startElement(int nameCode, int typeCode, int locationId, int properties) throws XPathException { 45 int nc = newPool.allocate(oldPool.getPrefix(nameCode), oldPool.getURI(nameCode), oldPool.getLocalName(nameCode)); 46 super.startElement(nc, typeCode, locationId, properties); 47 } 48 49 52 53 public void namespace(int namespaceCode, int properties) throws XPathException { 54 int nc = newPool.allocateNamespaceCode(oldPool.getPrefixFromNamespaceCode(namespaceCode), 55 oldPool.getURIFromNamespaceCode(namespaceCode)); 56 super.namespace(nc, properties); 57 } 58 59 62 63 public void attribute(int nameCode, int typeCode, CharSequence value, int locationId, int properties) 64 throws XPathException { 65 int nc = newPool.allocate(oldPool.getPrefix(nameCode), oldPool.getURI(nameCode), oldPool.getLocalName(nameCode)); 66 super.attribute(nc, typeCode, value, locationId, properties); 67 } 68 69 }; 70 71 89 | Popular Tags |