com.android.tools.lint.client.api
Interface IDomParser


public interface IDomParser

A wrapper for 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.


Method Summary
 void dispose(Context context)
          Dispose any data structures held for the given context.
 Position getEndPosition(Context context, Node node)
          Returns the ending position of the given DOM node.
 Location getLocation(Context context, Node node)
          Returns a Location for the given DOM node
 Position getStartPosition(Context context, Node node)
          Returns the starting position of the given DOM node (which may not be just an element but can for example also be an Attr node).
 Document parse(Context context)
          Parse the file pointed to by the given context and return as a Document
 

Method Detail

parse

Document parse(Context context)
Parse the file pointed to by the given context and return as a Document

Parameters:
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)
Returns:
the parsed DOM document, or null if parsing fails

getStartPosition

Position getStartPosition(Context context,
                          Node node)
Returns the starting position of the given DOM node (which may not be just an element but can for example also be an Attr node). The node will *always* be from the same DOM document that was returned by this parser.

Parameters:
context - information about the file being parsed
node - the node to look up a starting position for
Returns:
the position of the beginning of the node

getEndPosition

Position getEndPosition(Context context,
                        Node node)
Returns the ending position of the given DOM node.

Parameters:
context - information about the file being parsed
node - the node to look up a ending position for
Returns:
the position of the end of the node

getLocation

Location getLocation(Context context,
                     Node node)
Returns a Location for the given DOM node

Parameters:
context - information about the file being parsed
node - the node to create a location for
Returns:
a location for the given node

dispose

void dispose(Context context)
Dispose any data structures held for the given context.

Parameters:
context - information about the file previously parsed


Copyright © 2008-2012. All Rights Reserved.