Methods Summary |
---|
private org.w3c.dom.Node | getAttribute(int i)
if (mParsingState != START_TAG) {
throw new IndexOutOfBoundsException();
}
// get the current uiNode
UiElementNode uiNode = getCurrentNode();
// get its xml node
Node xmlNode = uiNode.getXmlNode();
if (xmlNode != null) {
return xmlNode.getAttributes().item(i);
}
return null;
|
public int | getAttributeCount()
UiElementNode node = getCurrentNode();
if (node != null) {
return node.getUiAttributes().size();
}
return 0;
|
public java.lang.String | getAttributeName(int i)
Node attribute = getAttribute(i);
if (attribute != null) {
return attribute.getLocalName();
}
return null;
|
public java.lang.String | getAttributeNamespace(int i)
Node attribute = getAttribute(i);
if (attribute != null) {
return attribute.getNamespaceURI();
}
return ""; //$NON-NLS-1$
|
public java.lang.String | getAttributePrefix(int i)
Node attribute = getAttribute(i);
if (attribute != null) {
return attribute.getPrefix();
}
return null;
|
public java.lang.String | getAttributeValue(int i)
Node attribute = getAttribute(i);
if (attribute != null) {
return attribute.getNodeValue();
}
return null;
|
public java.lang.String | getAttributeValue(java.lang.String namespace, java.lang.String localName)
// get the current uiNode
UiElementNode uiNode = getCurrentNode();
// get its xml node
Node xmlNode = uiNode.getXmlNode();
if (xmlNode != null) {
Node attribute = xmlNode.getAttributes().getNamedItemNS(namespace, localName);
if (attribute != null) {
return attribute.getNodeValue();
}
}
return null;
|
private com.android.ide.eclipse.editors.uimodel.UiElementNode | getCurrentNode()
if (mNodeStack.size() > 0) {
return mNodeStack.get(mNodeStack.size()-1);
}
return null;
|
public int | getDepth()
return mNodeStack.size();
|
public java.lang.String | getName()
if (mParsingState == START_TAG || mParsingState == END_TAG) {
return getCurrentNode().getDescriptor().getXmlLocalName();
}
return null;
|
public java.lang.String | getNamespace()
if (mParsingState == START_TAG || mParsingState == END_TAG) {
return getCurrentNode().getDescriptor().getNamespace();
}
return null;
|
public java.lang.String | getPositionDescription()
return "XML DOM element depth:" + mNodeStack.size();
|
public java.lang.String | getPrefix()
if (mParsingState == START_TAG || mParsingState == END_TAG) {
// FIXME will NEVER work
if (getCurrentNode().getDescriptor().getXmlLocalName().startsWith("android:")) { //$NON-NLS-1$
return "android"; //$NON-NLS-1$
}
}
return null;
|
public java.lang.Object | getViewKey(){@inheritDoc}
This implementation returns the underlying DOM node.
return getCurrentNode();
|
public boolean | isEmptyElementTag()
if (mParsingState == START_TAG) {
return getCurrentNode().getUiChildren().size() == 0;
}
throw new XmlPullParserException("Call to isEmptyElementTag while not in START_TAG",
this, null);
|
public void | onNextFromEndTag()
// look for a sibling. if no sibling, go back to the parent
UiElementNode node = getCurrentNode();
node = node.getUiNextSibling();
if (node != null) {
// to go to the sibling, we need to remove the current node,
pop();
// and add its sibling.
push(node);
mParsingState = START_TAG;
} else {
// move back to the parent
pop();
// we have only one element left (mRoot), then we're done with the document.
if (mNodeStack.size() == 1) {
mParsingState = END_DOCUMENT;
} else {
mParsingState = END_TAG;
}
}
|
public void | onNextFromStartDocument()
onNextFromStartTag();
|
public void | onNextFromStartTag()
// get the current node, and look for text or children (children first)
UiElementNode node = getCurrentNode();
List<UiElementNode> children = node.getUiChildren();
if (children.size() > 0) {
// move to the new child, and don't change the state.
push(children.get(0));
// in case the current state is CURRENT_DOC, we set the proper state.
mParsingState = START_TAG;
} else {
if (mParsingState == START_DOCUMENT) {
// this handles the case where there's no node.
mParsingState = END_DOCUMENT;
} else {
mParsingState = END_TAG;
}
}
|
private com.android.ide.eclipse.editors.uimodel.UiElementNode | pop()
return mNodeStack.remove(mNodeStack.size()-1);
|
private void | push(com.android.ide.eclipse.editors.uimodel.UiElementNode node)
mNodeStack.add(node);
|