|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.android.tools.lint.client.api.XmlParser
@Beta public abstract class XmlParser
A wrapper for an XML parser. This allows tools integrating lint to map directly to builtin services, such as already-parsed data structures in XML editors.
NOTE: This is not a public or final API; if you rely on this be prepared to adjust your code for the next tools release.
Constructor Summary | |
---|---|
XmlParser()
|
Method Summary | |
---|---|
abstract Location.Handle |
createLocationHandle(XmlContext context,
org.w3c.dom.Node node)
Creates a light-weight handle to a location for the given node. |
void |
dispose(XmlContext context,
org.w3c.dom.Document document)
Dispose any data structures held for the given context. |
abstract Location |
getLocation(XmlContext context,
org.w3c.dom.Node node)
Returns a Location for the given DOM node |
abstract Location |
getLocation(XmlContext context,
org.w3c.dom.Node node,
int start,
int end)
Returns a Location for the given DOM node. |
abstract Location |
getNameLocation(XmlContext context,
org.w3c.dom.Node node)
Returns a Location for the given DOM node |
abstract int |
getNodeEndOffset(XmlContext context,
org.w3c.dom.Node node)
Returns the end offset of the given node, or -1 if not known |
abstract int |
getNodeStartOffset(XmlContext context,
org.w3c.dom.Node node)
Returns the start offset of the given node, or -1 if not known |
abstract Location |
getValueLocation(XmlContext context,
org.w3c.dom.Attr node)
Returns a Location for the given DOM node |
abstract org.w3c.dom.Document |
parseXml(XmlContext context)
Parse the file pointed to by the given context and return as a Document |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlParser()
Method Detail |
---|
@Nullable public abstract org.w3c.dom.Document parseXml(@NonNull XmlContext context)
context
- the context pointing to the file to be parsed, typically
via Context.getContents()
but the file handle (
Context.file
can also be used to map to an existing
editor buffer in the surrounding tool, etc)
@NonNull public abstract Location getLocation(@NonNull XmlContext context, @NonNull org.w3c.dom.Node node)
Location
for the given DOM node
context
- information about the file being parsednode
- the node to create a location for
@NonNull public abstract Location getLocation(@NonNull XmlContext context, @NonNull org.w3c.dom.Node node, int start, int end)
Location
for the given DOM node. Like
getLocation(XmlContext, Node)
, but allows a position range that
is a subset of the node range.
context
- information about the file being parsednode
- the node to create a location forstart
- the starting position within the node, inclusiveend
- the ending position within the node, exclusive
@NonNull public abstract Location getNameLocation(@NonNull XmlContext context, @NonNull org.w3c.dom.Node node)
Location
for the given DOM node
context
- information about the file being parsednode
- the node to create a location for
@NonNull public abstract Location getValueLocation(@NonNull XmlContext context, @NonNull org.w3c.dom.Attr node)
Location
for the given DOM node
context
- information about the file being parsednode
- the node to create a location for
@NonNull public abstract Location.Handle createLocationHandle(@NonNull XmlContext context, @NonNull org.w3c.dom.Node node)
Location.Handle.resolve()
.
context
- the context providing the nodenode
- the node (element or attribute) to create a location handle
for
public void dispose(@NonNull XmlContext context, @NonNull org.w3c.dom.Document document)
context
- information about the file previously parseddocument
- the document that was parsed and is now being disposedpublic abstract int getNodeStartOffset(@NonNull XmlContext context, @NonNull org.w3c.dom.Node node)
context
- the context providing the nodenode
- the node (element or attribute) to create a location handle
for
public abstract int getNodeEndOffset(@NonNull XmlContext context, @NonNull org.w3c.dom.Node node)
context
- the context providing the nodenode
- the node (element or attribute) to create a location handle
for
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |