@Override public String get(Object key) { key = adjustForNamespaceIfNeeded(key); return super.get(key); }
@Override public void putAll(Map<? extends String, ? extends String> m) { for (Object o : m.entrySet()) if (o instanceof Map.Entry) { Map.Entry<String, String> e = (Map.Entry) o; put(e.getKey(), e.getValue()); } }
/** * @param node a node * @param parent the GPathResult prior to the application of the expression creating this GPathResult * @param namespacePrefix the namespace prefix if any * @param namespaceTagHints the known tag to namespace mappings */ public NodeChild(final Node node, final GPathResult parent, final String namespacePrefix, final Map<String, String> namespaceTagHints) { super(parent, node.name(), namespacePrefix, namespaceTagHints); this.node = node; ((NamespaceAwareHashMap)this.node.attributes()).setNamespaceTagHints(namespaceTagHints); }
public void startElement(final String namespaceURI, final String localName, final String qName, final Attributes atts) throws SAXException { addCdata(); final Map<String, String> attributes = new NamespaceAwareHashMap(); final Map<String, String> attributeNamespaces = new HashMap<String, String>(); for (int i = atts.getLength() - 1; i != -1; i--) { if (atts.getURI(i).length() == 0) { attributes.put(atts.getQName(i), atts.getValue(i)); } else { String key = new QName(atts.getURI(i), atts.getLocalName(i)).toString(); attributes.put(key, atts.getValue(i)); attributeNamespaces.put(key, atts.getURI(i)); } } final Node newElement; if (namespaceURI.length() == 0) { newElement = new Node(currentNode, qName, attributes, attributeNamespaces, namespaceURI); } else { newElement = new Node(currentNode, localName, attributes, attributeNamespaces, namespaceURI); } if (currentNode != null) { currentNode.addChild(newElement); } stack.push(currentNode); currentNode = newElement; }
public void startElement(final String namespaceURI, final String localName, final String qName, final Attributes atts) throws SAXException { addCdata(); final Map<String, String> attributes = new NamespaceAwareHashMap(); final Map<String, String> attributeNamespaces = new HashMap<String, String>(); for (int i = atts.getLength() - 1; i != -1; i--) { if (atts.getURI(i).length() == 0) { attributes.put(atts.getQName(i), atts.getValue(i)); } else { String key = new QName(atts.getURI(i), atts.getLocalName(i)).toString(); attributes.put(key, atts.getValue(i)); attributeNamespaces.put(key, atts.getURI(i)); } } final Node newElement; if (namespaceURI.length() == 0) { newElement = new Node(currentNode, qName, attributes, attributeNamespaces, namespaceURI); } else { newElement = new Node(currentNode, localName, attributes, attributeNamespaces, namespaceURI); } if (currentNode != null) { currentNode.addChild(newElement); } stack.push(currentNode); currentNode = newElement; }
@Override public String remove(Object key) { key = adjustForNamespaceIfNeeded(key).toString(); return super.remove(key); }
/** * @param node a node * @param parent the GPathResult prior to the application of the expression creating this GPathResult * @param namespacePrefix the namespace prefix if any * @param namespaceTagHints the known tag to namespace mappings */ public NodeChild(final Node node, final GPathResult parent, final String namespacePrefix, final Map<String, String> namespaceTagHints) { super(parent, node.name(), namespacePrefix, namespaceTagHints); this.node = node; ((NamespaceAwareHashMap)this.node.attributes()).setNamespaceTagHints(namespaceTagHints); }
@Override public void putAll(Map<? extends String, ? extends String> m) { for (Object o : m.entrySet()) if (o instanceof Map.Entry) { Map.Entry<String, String> e = (Map.Entry) o; put(e.getKey(), e.getValue()); } }
@Override public boolean containsKey(Object key) { key = adjustForNamespaceIfNeeded(key).toString(); return super.containsKey(key); }
@Override public String put(String key, String value) { key = adjustForNamespaceIfNeeded(key).toString(); return super.put(key, value); }
@Override public String get(Object key) { key = adjustForNamespaceIfNeeded(key); return super.get(key); }
@Override public String remove(Object key) { key = adjustForNamespaceIfNeeded(key).toString(); return super.remove(key); }
@Override public String put(String key, String value) { key = adjustForNamespaceIfNeeded(key).toString(); return super.put(key, value); }
@Override public boolean containsKey(Object key) { key = adjustForNamespaceIfNeeded(key).toString(); return super.containsKey(key); }