public class XmlDocument
extends java.lang.Object
XmlElement element and provides services to persist the document
to an external format. Also provides abilities to be merged with other
XmlDocument as well as access to the line numbers for all
document's xml elements and attributes.| Modifier and Type | Class and Description |
|---|---|
static class |
XmlDocument.Type
The document type.
|
| Constructor and Description |
|---|
XmlDocument(com.android.ide.common.blame.SourceFile sourceLocation,
KeyResolver<java.lang.String> selectors,
PlaceholderHandler.KeyBasedValueResolver<ManifestSystemProperty> systemPropertyResolver,
org.w3c.dom.Element element,
XmlDocument.Type type,
com.google.common.base.Optional<java.lang.String> mainManifestPackageName) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearNodeNamespaces()
Removes the android namespace from all nodes.
|
com.google.common.base.Optional<java.lang.String> |
compareTo(XmlDocument other)
Compares this document to another
XmlDocument ignoring all
attributes belonging to the SdkConstants.TOOLS_URI namespace. |
com.google.common.base.Optional<XmlElement> |
getByTypeAndKey(com.android.manifmerger.ManifestModel.NodeTypes type,
java.lang.String keyValue) |
XmlDocument.Type |
getFileType() |
com.google.common.base.Optional<XmlAttribute> |
getPackage() |
java.lang.String |
getPackageName()
Package name for this android manifest which will be used to resolve
partial path.
|
java.lang.String |
getPackageNameForAttributeExpansion()
Returns the package name to use to expand the attributes values with the document's package
name
|
XmlElement |
getRootNode() |
KeyResolver<java.lang.String> |
getSelectors()
Returns a
KeyResolver capable of resolving all selectors
types |
com.android.ide.common.blame.SourceFile |
getSourceFile()
Returns the
SourceFile associated with this XML document. |
java.lang.String |
getSplitName()
Returns the split name if this manifest file has one.
|
PlaceholderHandler.KeyBasedValueResolver<ManifestSystemProperty> |
getSystemPropertyResolver()
Returns the
PlaceholderHandler.KeyBasedValueResolver capable
of resolving all injected ManifestSystemProperty |
org.w3c.dom.Document |
getXml() |
com.google.common.base.Optional<XmlDocument> |
merge(XmlDocument lowerPriorityDocument,
com.android.manifmerger.MergingReport.Builder mergingReportBuilder)
merge this higher priority document with a higher priority document.
|
com.google.common.base.Optional<XmlDocument> |
merge(XmlDocument lowerPriorityDocument,
com.android.manifmerger.MergingReport.Builder mergingReportBuilder,
boolean addImplicitPermissions)
merge this higher priority document with a higher priority document.
|
java.lang.String |
prettyPrint()
Returns a pretty string representation of this document.
|
XmlDocument |
reparse()
Forces a re-parsing of the document
|
public XmlDocument(@NonNull
com.android.ide.common.blame.SourceFile sourceLocation,
@NonNull
KeyResolver<java.lang.String> selectors,
@NonNull
PlaceholderHandler.KeyBasedValueResolver<ManifestSystemProperty> systemPropertyResolver,
@NonNull
org.w3c.dom.Element element,
@NonNull
XmlDocument.Type type,
@NonNull
com.google.common.base.Optional<java.lang.String> mainManifestPackageName)
@NonNull public XmlDocument.Type getFileType()
@NonNull public java.lang.String prettyPrint()
@NonNull public com.google.common.base.Optional<XmlDocument> merge(@NonNull XmlDocument lowerPriorityDocument, @NonNull com.android.manifmerger.MergingReport.Builder mergingReportBuilder)
lowerPriorityDocument - the lower priority document to merge in.mergingReportBuilder - the merging report to record errors and actions.XmlDocument or
Optional.absent() if there were errors during the merging activities.@NonNull public com.google.common.base.Optional<XmlDocument> merge(@NonNull XmlDocument lowerPriorityDocument, @NonNull com.android.manifmerger.MergingReport.Builder mergingReportBuilder, boolean addImplicitPermissions)
lowerPriorityDocument - the lower priority document to merge in.mergingReportBuilder - the merging report to record errors and actions.addImplicitPermissions - whether to perform implicit permission addition.XmlDocument or
Optional.absent() if there were errors during the merging activities.@NonNull public XmlDocument reparse()
XmlDocument with up to date information.@NonNull public KeyResolver<java.lang.String> getSelectors()
KeyResolver capable of resolving all selectors
types@NonNull public PlaceholderHandler.KeyBasedValueResolver<ManifestSystemProperty> getSystemPropertyResolver()
PlaceholderHandler.KeyBasedValueResolver capable
of resolving all injected ManifestSystemPropertypublic com.google.common.base.Optional<java.lang.String> compareTo(@NonNull
XmlDocument other)
XmlDocument ignoring all
attributes belonging to the SdkConstants.TOOLS_URI namespace.other - the other document to compare against.String describing the differences between the two XML elements or
Optional.absent() if they are equals.@NonNull public com.android.ide.common.blame.SourceFile getSourceFile()
SourceFile associated with this XML document.
NOTE: You should not read the contents of the file directly; if you need to
access the content, use ManifestMerger2.getFileStreamProvider() instead.
public XmlElement getRootNode()
public com.google.common.base.Optional<XmlElement> getByTypeAndKey(com.android.manifmerger.ManifestModel.NodeTypes type, @Nullable java.lang.String keyValue)
public java.lang.String getPackageName()
public java.lang.String getSplitName()
public java.lang.String getPackageNameForAttributeExpansion()
public com.google.common.base.Optional<XmlAttribute> getPackage()
public org.w3c.dom.Document getXml()
public void clearNodeNamespaces()