Package com.android.manifmerger
Class XmlLoader
java.lang.Object
com.android.manifmerger.XmlLoader
Responsible for loading XML files.
-
Method Summary
Modifier and TypeMethodDescriptionstatic XmlDocumentload(KeyResolver<String> selectors, PlaceholderHandler.KeyBasedValueResolver<com.android.manifmerger.ManifestSystemProperty> systemPropertyResolver, com.android.ide.common.blame.SourceFile sourceFile, String xml, XmlDocument.Type type, String namespace, com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes> model) Loads a xml document from itsStringrepresentation without doing xml validation and return aXmlDocumentstatic XmlDocumentload(KeyResolver<String> selectors, PlaceholderHandler.KeyBasedValueResolver<com.android.manifmerger.ManifestSystemProperty> systemPropertyResolver, String displayName, File xmlFile, InputStream inputStream, XmlDocument.Type type, String namespace, com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes> model, boolean rewriteNamespaces) Loads an xml file without doing xml validation and return aXmlDocumentstatic XmlDocumentload(Document domDocument, KeyResolver<String> selectors, PlaceholderHandler.KeyBasedValueResolver<com.android.manifmerger.ManifestSystemProperty> systemPropertyResolver, String displayName, File xmlFile, XmlDocument.Type type, String namespace, com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes> model, boolean rewriteNamespaces) Build an unvalidatedXmlDocumentobject from given DOM Document Also see overloadload(KeyResolver, KeyBasedValueResolver, String, File, InputStream, XmlDocument.Type, String, DocumentModel, boolean)for more details.
-
Method Details
-
load
@NonNull public static XmlDocument load(@NonNull KeyResolver<String> selectors, @NonNull PlaceholderHandler.KeyBasedValueResolver<com.android.manifmerger.ManifestSystemProperty> systemPropertyResolver, @NonNull String displayName, @NonNull File xmlFile, @NonNull InputStream inputStream, @NonNull XmlDocument.Type type, @Nullable String namespace, @NonNull com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes> model, boolean rewriteNamespaces) throws IOException, SAXException, ParserConfigurationException Loads an xml file without doing xml validation and return aXmlDocument- Parameters:
displayName- the xml file display name.xmlFile- the xml file.namespace- the namespace, used to create or shorten fully qualified class names. If null, the manifest's package name is used as the namespace instead.- Returns:
- the initialized
XmlDocument - Throws:
IOExceptionSAXExceptionParserConfigurationException
-
load
@NonNull public static XmlDocument load(@NonNull Document domDocument, @NonNull KeyResolver<String> selectors, @NonNull PlaceholderHandler.KeyBasedValueResolver<com.android.manifmerger.ManifestSystemProperty> systemPropertyResolver, @NonNull String displayName, @NonNull File xmlFile, @NonNull XmlDocument.Type type, @Nullable String namespace, @NonNull com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes> model, boolean rewriteNamespaces) throws IOException, SAXException, ParserConfigurationException Build an unvalidatedXmlDocumentobject from given DOM Document Also see overloadload(KeyResolver, KeyBasedValueResolver, String, File, InputStream, XmlDocument.Type, String, DocumentModel, boolean)for more details.- Parameters:
domDocument- Manifest Document object.- Throws:
IOExceptionSAXExceptionParserConfigurationException
-
load
@NonNull public static XmlDocument load(@NonNull KeyResolver<String> selectors, @NonNull PlaceholderHandler.KeyBasedValueResolver<com.android.manifmerger.ManifestSystemProperty> systemPropertyResolver, @NonNull com.android.ide.common.blame.SourceFile sourceFile, @NonNull String xml, @NonNull XmlDocument.Type type, @Nullable String namespace, @NonNull com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes> model) throws IOException, SAXException, ParserConfigurationException Loads a xml document from itsStringrepresentation without doing xml validation and return aXmlDocument- Parameters:
sourceFile- the source location to use for logging and record collection.xml- the persisted xml.namespace- the namespace, used to create or shorten fully qualified class names. If null, the manifest's package name is used as the namespace instead.- Returns:
- the initialized
XmlDocument - Throws:
IOException- this should never be thrown.SAXException- if the xml is incorrectParserConfigurationException- if the xml engine cannot be configured.
-