@@ -0,0 +1,2368 @@
+package org.httprpc.xml;%0A%0Aimport org.w3c.dom.Element;%0Aimport org.w3c.dom.NodeList;%0A%0Aimport java.util.AbstractList;%0Aimport java.util.AbstractMap;%0Aimport java.util.Set;%0A%0A/**%0A * Class that presents the contents of an XML element as a map.%0A */%0Apublic class ElementAdapter extends AbstractMap%3CString, Object%3E %7B%0A    private static class NodeListAdapter extends AbstractList%3CElementAdapter%3E %7B%0A        private NodeList nodeList;%0A%0A        public NodeListAdapter(NodeList nodeList) %7B%0A            this.nodeList = nodeList;%0A        %7D%0A%0A        @Override%0A        public ElementAdapter get(int i) %7B%0A            return new ElementAdapter((Element)nodeList.item(i));%0A        %7D%0A%0A        @Override%0A        public int size() %7B%0A            return nodeList.getLength();%0A        %7D%0A    %7D%0A%0A    private Element element;%0A%0A    private static final String ATTRIBUTE_PREFIX = %22@%22;%0A    private static final String LIST_SUFFIX = %22*%22;%0A%0A    /**%0A     * Constructs a new element adapter.%0A     *%0A     * @param element%0A     * The source element.%0A     */%0A    public ElementAdapter(Element element) %7B%0A        if (element == null) %7B%0A            throw new IllegalArgumentException();%0A        %7D%0A%0A        this.element = element;%0A    %7D%0A%0A    @Override%0A    public Object get(Object key) %7B%0A        String name = key.toString();%0A%0A        Object value;%0A        if (name.startsWith(ATTRIBUTE_PREFIX)) %7B%0A            name = name.substring(ATTRIBUTE_PREFIX.length());%0A%0A            if (element.hasAttribute(name)) %7B%0A                value = element.getAttribute(name);%0A            %7D else %7B%0A                value = null;%0A            %7D%0A        %7D else %7B%0A            if (name.endsWith(LIST_SUFFIX)) %7B%0A                name = name.substring(0, name.length() - LIST_SUFFIX.length());%0A%0A                value = new NodeListAdapter(element.getElementsByTagName(name));%0A            %7D else %7B%0A                NodeList nodeList = element.getElementsByTagName(name);%0A%0A                if (nodeList.getLength() %3E 0) %7B%0A                    value = new ElementAdapter((Element)nodeList.item(0));%0A                %7D else %7B%0A                    value = null;%0A                %7D%0A            %7D%0A        %7D%0A%0A        return value;%0A    %7D%0A%0A    @Override%0A    public Set%3CEntry%3CString, Object%3E%3E entrySet() %7B%0A        throw new UnsupportedOperationException();%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return element.getTextContent();%0A    %7D%0A%7D%0A

Add ElementAdapter.