com.android.manifmerger
Class XmlNode

java.lang.Object
  extended by com.android.manifmerger.XmlNode
Direct Known Subclasses:
OrphanXmlElement, XmlAttribute

public abstract class XmlNode
extends java.lang.Object

Common behavior of any xml declaration.


Nested Class Summary
static class XmlNode.NodeKey
          A xml element or attribute key.
static interface XmlNode.NodeName
          Abstraction to an xml name to isolate whether the name has a namespace or not.
 
Field Summary
protected static com.google.common.base.Function<org.w3c.dom.Node,java.lang.String> NODE_TO_NAME
           
 
Constructor Summary
XmlNode()
           
 
Method Summary
static XmlNode.NodeName fromNSName(java.lang.String namespaceUri, java.lang.String prefix, java.lang.String localName)
           
static XmlNode.NodeName fromXmlName(java.lang.String name)
           
 int getColumn()
          Return the column number in the original xml file this element or attribute was declared.
abstract  XmlNode.NodeKey getId()
          Returns an unique id within the manifest file for the element.
 int getLine()
          Return the line number in the original xml file this element or attribute was declared.
abstract  XmlNode.NodeName getName()
          Returns the name of this xml element or attribute.
abstract  com.android.utils.PositionXmlParser.Position getPosition()
          Returns the element's position
abstract  XmlLoader.SourceLocation getSourceLocation()
          Returns the element's document xml source file location.
abstract  org.w3c.dom.Node getXml()
          Returns the element's xml
 java.lang.String printPosition()
          Returns the position of this attribute in the original xml file.
 java.lang.String printPosition(boolean shortFormat)
           
static XmlNode.NodeName unwrapName(org.w3c.dom.Node node)
          Factory method to create an instance of XmlNode.NodeName for an existing xml node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_TO_NAME

protected static final com.google.common.base.Function<org.w3c.dom.Node,java.lang.String> NODE_TO_NAME
Constructor Detail

XmlNode

public XmlNode()
Method Detail

getId

public abstract XmlNode.NodeKey getId()
Returns an unique id within the manifest file for the element.


getPosition

public abstract com.android.utils.PositionXmlParser.Position getPosition()
Returns the element's position


getSourceLocation

@NonNull
public abstract XmlLoader.SourceLocation getSourceLocation()
Returns the element's document xml source file location.


getXml

@NonNull
public abstract org.w3c.dom.Node getXml()
Returns the element's xml


getName

public abstract XmlNode.NodeName getName()
Returns the name of this xml element or attribute.


unwrapName

public static XmlNode.NodeName unwrapName(org.w3c.dom.Node node)
Factory method to create an instance of XmlNode.NodeName for an existing xml node.

Parameters:
node - the xml definition.
Returns:
an instance of XmlNode.NodeName providing namespace handling.

fromXmlName

public static XmlNode.NodeName fromXmlName(java.lang.String name)

fromNSName

public static XmlNode.NodeName fromNSName(java.lang.String namespaceUri,
                                          java.lang.String prefix,
                                          java.lang.String localName)

getLine

public int getLine()
Return the line number in the original xml file this element or attribute was declared.


getColumn

public int getColumn()
Return the column number in the original xml file this element or attribute was declared.


printPosition

public java.lang.String printPosition()
Returns the position of this attribute in the original xml file. This may return an invalid location as this xml fragment does not exist in any xml file but is the temporary result of the merging process.

Returns:
a human readable position or UNKNOWN_POSITION

printPosition

public java.lang.String printPosition(boolean shortFormat)