Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.pde.internal.ui.model
Class DocumentHandler  view DocumentHandler download DocumentHandler.java

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.eclipse.pde.internal.ui.model.DocumentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public abstract class DocumentHandler
extends org.xml.sax.helpers.DefaultHandler


Field Summary
protected  java.util.Stack fDocumentNodeStack
           
protected  org.eclipse.jface.text.FindReplaceDocumentAdapter fFindReplaceAdapter
           
protected  int fHighestOffset
           
private  org.xml.sax.Locator fLocator
           
 
Constructor Summary
DocumentHandler()
           
 
Method Summary
protected  void appendChildToParent(IDocumentNode parent, IDocumentNode child)
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Receive notification of the end of an element.
 void error(org.xml.sax.SAXParseException e)
          Receive notification of a recoverable parser error.
 void fatalError(org.xml.sax.SAXParseException e)
          Report a fatal XML parsing error.
private  void generateErrorElementHierarchy()
           
private  org.eclipse.jface.text.IRegion getAttributeRegion(java.lang.String name, java.lang.String value, int offset)
           
protected abstract  org.eclipse.jface.text.IDocument getDocument()
           
protected abstract  IDocumentAttribute getDocumentAttribute(java.lang.String name, java.lang.String value, IDocumentNode parent)
           
protected abstract  IDocumentNode getDocumentNode(java.lang.String name, IDocumentNode parent)
           
private  int getElementLength(IDocumentNode node, int line, int column)
           
private  int getStartOffset(java.lang.String elementName)
           
 void setDocumentLocator(org.xml.sax.Locator locator)
          Receive a Locator object for document events.
protected  void setTextNodeOffset(IDocumentNode node)
           
 void startDocument()
          Receive notification of the beginning of the document.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
          Receive notification of the start of an element.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fFindReplaceAdapter

protected org.eclipse.jface.text.FindReplaceDocumentAdapter fFindReplaceAdapter

fDocumentNodeStack

protected java.util.Stack fDocumentNodeStack

fHighestOffset

protected int fHighestOffset

fLocator

private org.xml.sax.Locator fLocator
Constructor Detail

DocumentHandler

public DocumentHandler()
Method Detail

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.helpers.DefaultHandler
Receive notification of the beginning of the document.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as allocating the root node of a tree or creating an output file).


startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.helpers.DefaultHandler
Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).


appendChildToParent

protected void appendChildToParent(IDocumentNode parent,
                                   IDocumentNode child)

getDocumentNode

protected abstract IDocumentNode getDocumentNode(java.lang.String name,
                                                 IDocumentNode parent)

getDocumentAttribute

protected abstract IDocumentAttribute getDocumentAttribute(java.lang.String name,
                                                           java.lang.String value,
                                                           IDocumentNode parent)

getStartOffset

private int getStartOffset(java.lang.String elementName)
                    throws org.eclipse.jface.text.BadLocationException

getElementLength

private int getElementLength(IDocumentNode node,
                             int line,
                             int column)
                      throws org.eclipse.jface.text.BadLocationException

getAttributeRegion

private org.eclipse.jface.text.IRegion getAttributeRegion(java.lang.String name,
                                                          java.lang.String value,
                                                          int offset)
                                                   throws org.eclipse.jface.text.BadLocationException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.helpers.DefaultHandler
Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).


setTextNodeOffset

protected void setTextNodeOffset(IDocumentNode node)
                          throws org.eclipse.jface.text.BadLocationException

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.helpers.DefaultHandler
Report a fatal XML parsing error.

The default implementation throws a SAXParseException. Application writers may override this method in a subclass if they need to take specific actions for each fatal error (such as collecting all of the errors into a single report): in any case, the application must stop all regular processing when this method is invoked, since the document is no longer reliable, and the parser may no longer report parsing events.


generateErrorElementHierarchy

private void generateErrorElementHierarchy()

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.helpers.DefaultHandler
Receive notification of a recoverable parser error.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each error, such as inserting the message in a log file or printing it to the console.


setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Description copied from class: org.xml.sax.helpers.DefaultHandler
Receive a Locator object for document events.

By default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.


getDocument

protected abstract org.eclipse.jface.text.IDocument getDocument()