Class XmlNode

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

public abstract class XmlNode extends Object
Common behavior of any xml declaration.
  • Field Details

    • NODE_TO_NAME

      protected static final com.google.common.base.Function<Node,String> NODE_TO_NAME
  • Constructor Details

    • XmlNode

      public XmlNode()
  • Method Details

    • getOriginalId

      @NonNull public XmlNode.NodeKey getOriginalId()
      Returns a constant Nodekey that can be used throughout the lifecycle of the xml element. The getId() can return different values over time as the key of the element can be for instance, changed through placeholder replacement.
    • getId

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

      @NonNull public abstract com.android.ide.common.blame.SourcePosition getPosition()
      Returns the element's position
    • getSourceFile

      @NonNull public abstract com.android.ide.common.blame.SourceFile getSourceFile()
      Returns the element's document xml source file location.
    • getSourceFilePosition

      @NonNull public com.android.ide.common.blame.SourceFilePosition getSourceFilePosition()
      Returns the element's document xml source file location.
    • getXml

      @NonNull public abstract Node getXml()
      Returns the element's xml
    • getName

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

      @NonNull public static XmlNode.NodeName unwrapName(@NonNull 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

      @NonNull public static XmlNode.NodeName fromXmlName(@NonNull String name)
    • fromNSName

      @NonNull public static XmlNode.NodeName fromNSName(@NonNull String namespaceUri, @NonNull String prefix, @NonNull String localName)
    • printPosition

      @NonNull public 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.