com.android.tools.lint.detector.api
Interface Detector.XmlScanner

All Known Implementing Classes:
Detector.XmlDetectorAdapter, LayoutDetector, ResourceXmlDetector
Enclosing class:
Detector

public static interface Detector.XmlScanner

Specialized interface for detectors that scan XML files


Field Summary
static List<String> ALL
          Special marker collection returned by getApplicableElements() or getApplicableAttributes() to indicate that the check should be invoked on all elements or all attributes
 
Method Summary
 Collection<String> getApplicableAttributes()
          Returns the list of attributes that this detector wants to analyze.
 Collection<String> getApplicableElements()
          Returns the list of elements that this detector wants to analyze.
 void visitAttribute(Context context, Attr attribute)
          Visit the given attribute.
 void visitDocument(Context context, Document document)
          Visit the given document.
 void visitElement(Context context, Element element)
          Visit the given element.
 void visitElementAfter(Context context, Element element)
          Visit the given element after its children have been analyzed.
 

Field Detail

ALL

static final List<String> ALL
Special marker collection returned by getApplicableElements() or getApplicableAttributes() to indicate that the check should be invoked on all elements or all attributes

Method Detail

visitDocument

void visitDocument(Context context,
                   Document document)
Visit the given document. The detector is responsible for its own iteration through the document.

Parameters:
context - information about the document being analyzed
document - the document to examine

visitElement

void visitElement(Context context,
                  Element element)
Visit the given element.

Parameters:
context - information about the document being analyzed
element - the element to examine

visitElementAfter

void visitElementAfter(Context context,
                       Element element)
Visit the given element after its children have been analyzed.

Parameters:
context - information about the document being analyzed
element - the element to examine

visitAttribute

void visitAttribute(Context context,
                    Attr attribute)
Visit the given attribute.

Parameters:
context - information about the document being analyzed
attribute - the attribute node to examine

getApplicableElements

Collection<String> getApplicableElements()
Returns the list of elements that this detector wants to analyze. If non null, this detector will be called (specifically, the visitElement(com.android.tools.lint.detector.api.Context, org.w3c.dom.Element) method) for each matching element in the document.

If this method returns null, and getApplicableAttributes() also returns null, then the visitDocument(com.android.tools.lint.detector.api.Context, org.w3c.dom.Document) method will be called instead.

Returns:
a collection of elements, or null, or the special ALL marker to indicate that every single element should be analyzed.

getApplicableAttributes

Collection<String> getApplicableAttributes()
Returns the list of attributes that this detector wants to analyze. If non null, this detector will be called (specifically, the visitAttribute(com.android.tools.lint.detector.api.Context, org.w3c.dom.Attr) method) for each matching attribute in the document.

If this method returns null, and getApplicableElements() also returns null, then the visitDocument(com.android.tools.lint.detector.api.Context, org.w3c.dom.Document) method will be called instead.

Returns:
a collection of attributes, or null, or the special ALL marker to indicate that every single attribute should be analyzed.


Copyright © 2008-2012. All Rights Reserved.