public class ResourceExtraXmlParser
extends java.lang.Object
Apart from placing files into sub-directories of the resource directory and declaring them in
XML files inside the values
directory, id
resources can also be lazily declared
in other XML files in non-values directories.
For example, inside layout/main_activity.xml
we could have a line such as:
android:id="@+id/activity_main"
This construction is an example of a inline declaration of a resource with the type id
and name activity_main
. Even though it is not declared inside a values
directory,
it still needs to be parsed and processed into a Symbol:
Java type | Resource type | Resource name | ID |
---|---|---|---|
int | id | activity_main | 0 |
It is also worth noting that some resources can be declared with a prefix like aapt:
or android:
. Following aapt's original behaviour, we strip the type names from those
prefixes. This behaviour is deprecated and might be the support for it might end in the near
future.
Constructor and Description |
---|
ResourceExtraXmlParser() |
Modifier and Type | Method and Description |
---|---|
static com.android.builder.symbols.SymbolTable |
parse(org.w3c.dom.Document xmlDocument,
IdProvider idProvider)
Finds all constructions of type <@code '"@+id/name"'> in the given file.
|
@NonNull public static com.android.builder.symbols.SymbolTable parse(@NonNull org.w3c.dom.Document xmlDocument, @NonNull IdProvider idProvider)
xmlDocument
- an xml file to parseidProvider
- the provider for IDs to assign to the resources