01: /*
02: * Copyright (C) 2006 Joe Walnes.
03: * Copyright (C) 2006, 2007 XStream Committers.
04: * All rights reserved.
05: *
06: * The software in this package is published under the terms of the BSD
07: * style license a copy of which has been included with this distribution in
08: * the LICENSE.txt file.
09: *
10: * Created on 04. June 2006 by Mauro Talevi
11: */
12: package com.thoughtworks.xstream.io.xml;
13:
14: import com.thoughtworks.xstream.io.HierarchicalStreamReader;
15:
16: /**
17: * Abstract base implementation of HierarchicalStreamReader that provides common functionality
18: * to all XML-based readers.
19: *
20: * @author Mauro Talevi
21: * @since 1.2
22: */
23: public abstract class AbstractXmlReader implements
24: HierarchicalStreamReader, XmlFriendlyReader {
25:
26: private XmlFriendlyReplacer replacer;
27:
28: protected AbstractXmlReader() {
29: this (new XmlFriendlyReplacer());
30: }
31:
32: protected AbstractXmlReader(XmlFriendlyReplacer replacer) {
33: this .replacer = replacer;
34: }
35:
36: /**
37: * Unescapes XML-friendly name (node or attribute)
38: *
39: * @param name the escaped XML-friendly name
40: * @return An unescaped name with original characters
41: */
42: public String unescapeXmlName(String name) {
43: return replacer.unescapeName(name);
44: }
45:
46: }
|