FileDocCategorySizeDatePackage
MockXmlNode.javaAPI DocAndroid 1.5 API7701Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.editors.mock

MockXmlNode

public class MockXmlNode extends Object implements Node
A mock XML node with only a minimal set of information.

Fields Summary
MockNodeList
mNodeList
private String
mLocalName
private String
mNamespace
private short
mNodeType
private MockXmlNode
mParent
private MockXmlNode
mPreviousSibling
private MockXmlNode
mNextSibling
private String
mAttrValue
private MockNamedNodeMap
mAttributes
private HashMap
mNsMap
map from namespace to prefix.
Constructors Summary
public MockXmlNode(String namespace, String localName, short node_type, MockXmlNode[] children)
Constructs a node from a given children list.

param
namespace The namespace of the node or null if none
param
localName The XML local node name.
param
node_type One of Node.xxx_NODE constants, e.g. Node.ELEMENT_NODE
param
children The children list. Can be null.

    
                                                    
          
              
        mLocalName = localName;
        mNamespace = namespace;
        mNodeType = node_type;
        mNodeList = new MockNodeList(children);
        fixNavigation();
    
public MockXmlNode(String namespace, String localName, String value)
Constructs an attribute node

param
namespace The namespace of the node or null if none
param
localName The XML local node name.
param
value the value of the attribute

        mLocalName = localName;
        mNamespace = namespace;
        mAttrValue = value;
        mNodeType = Node.ATTRIBUTE_NODE;
        mNodeList = new MockNodeList(new MockXmlNode[0]);
        fixNavigation();
    
Methods Summary
public voidaddAttributes(java.lang.String namespaceURI, java.lang.String localName, java.lang.String value)

        if (mAttributes == null) {
            mAttributes = new MockNamedNodeMap();
        }
        
        MockXmlNode node = mAttributes.addAttribute(namespaceURI, localName, value);
        node.mParent = this;
    
public org.w3c.dom.NodeappendChild(org.w3c.dom.Node newChild)

        mNodeList.getArrayList().add((MockXmlNode) newChild);
        return newChild;
    
public org.w3c.dom.NodecloneNode(boolean deep)

        throw new NotImplementedException();
    
public shortcompareDocumentPosition(org.w3c.dom.Node other)

        throw new NotImplementedException();
    
private voidfixNavigation()

        MockXmlNode prev = null;
        for (MockXmlNode n : mNodeList.getArrayList()) {
            n.mParent = this;
            n.mPreviousSibling = prev;
            if (prev != null) {
                prev.mNextSibling = n;
            }
            n.fixNavigation();
            prev = n;
        }
    
public org.w3c.dom.NamedNodeMapgetAttributes()

        return mAttributes;
    
public java.lang.StringgetBaseURI()

        throw new NotImplementedException();
    
public org.w3c.dom.NodeListgetChildNodes()

        return mNodeList;
    
public java.lang.ObjectgetFeature(java.lang.String feature, java.lang.String version)

        throw new NotImplementedException();
    
public org.w3c.dom.NodegetFirstChild()

        if (mNodeList.getLength() > 0) {
            return mNodeList.item(0);
        }
        return null;
    
public org.w3c.dom.NodegetLastChild()

        if (mNodeList.getLength() > 0) {
            return mNodeList.item(mNodeList.getLength() - 1);
        }
        return null;
    
public java.lang.StringgetLocalName()

        return mLocalName;
    
public java.lang.StringgetNamespaceURI()

        return mNamespace;
    
public org.w3c.dom.NodegetNextSibling()

        return mNextSibling;
    
public java.lang.StringgetNodeName()

        return mLocalName;
    
public shortgetNodeType()

        return mNodeType;
    
public java.lang.StringgetNodeValue()

        return mAttrValue;
    
public org.w3c.dom.DocumentgetOwnerDocument()

        throw new NotImplementedException();
    
public org.w3c.dom.NodegetParentNode()

        return mParent;
    
public java.lang.StringgetPrefix()

        return getPrefix(getNamespaceURI());
    
public java.lang.StringgetPrefix(java.lang.String namespace)

        if (mNsMap != null) {
            return mNsMap.get(namespace);
        }
        
        return mParent.getPrefix(namespace);
    
public org.w3c.dom.NodegetPreviousSibling()

        return mPreviousSibling;
    
public java.lang.StringgetTextContent()

        throw new NotImplementedException();
    
public java.lang.ObjectgetUserData(java.lang.String key)

        throw new NotImplementedException();
    
public booleanhasAttributes()

        // TODO Auto-generated method stub
        throw new NotImplementedException();
        //return false;
    
public booleanhasChildNodes()

        return mNodeList.getLength() > 0;
    
public org.w3c.dom.NodeinsertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)

        throw new NotImplementedException();
    
public booleanisDefaultNamespace(java.lang.String namespaceURI)

        throw new NotImplementedException();
    
public booleanisEqualNode(org.w3c.dom.Node arg)

        throw new NotImplementedException();
    
public booleanisSameNode(org.w3c.dom.Node other)

        return this == other;
    
public booleanisSupported(java.lang.String feature, java.lang.String version)

        throw new NotImplementedException();
    
public java.lang.StringlookupNamespaceURI(java.lang.String prefix)

        throw new NotImplementedException();
    
public java.lang.StringlookupPrefix(java.lang.String namespaceURI)

        throw new NotImplementedException();
    
public voidnormalize()

        throw new NotImplementedException();
    
public org.w3c.dom.NoderemoveChild(org.w3c.dom.Node oldChild)

        throw new NotImplementedException();
    
public org.w3c.dom.NodereplaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)

        throw new NotImplementedException();
    
public voidsetNodeValue(java.lang.String nodeValue)

        throw new NotImplementedException();
    
public voidsetPrefix(java.lang.String prefix)

        throw new NotImplementedException();
    
public voidsetPrefix(java.lang.String namespace, java.lang.String prefix)

        if (mNsMap == null) {
            mNsMap = new HashMap<String, String>();
        }

        mNsMap.put(namespace, prefix);
    
public voidsetTextContent(java.lang.String textContent)

        throw new NotImplementedException();
    
public java.lang.ObjectsetUserData(java.lang.String key, java.lang.Object data, org.w3c.dom.UserDataHandler handler)

        throw new NotImplementedException();