1 package org.robolectric.res; 2 3 import javax.xml.stream.XMLStreamException; 4 import javax.xml.stream.XMLStreamReader; 5 6 public class TextCollectingNodeHandler extends NodeHandler { 7 private final StringBuilder buf; 8 TextCollectingNodeHandler(StringBuilder buf)9 public TextCollectingNodeHandler(StringBuilder buf) { 10 this.buf = buf; 11 } 12 13 @Override onCharacters(XMLStreamReader xml, XmlContext xmlContext)14 public void onCharacters(XMLStreamReader xml, XmlContext xmlContext) throws XMLStreamException { 15 buf.append(xml.getText()); 16 } 17 18 @Override findMatchFor(XMLStreamReader xml)19 NodeHandler findMatchFor(XMLStreamReader xml) { 20 return this; 21 } 22 } 23