org.eclipse.wst.wsdl.util
Class WSDLParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.eclipse.wst.wsdl.util.WSDLParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler

public class WSDLParser
extends org.xml.sax.helpers.DefaultHandler
implements org.xml.sax.ext.LexicalHandler

The SAX Parser for the WSDL model. This class' main responsibility is to compute line/column information for all elements in the source XML document. This information is stored in a map of each node to its user data.

Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

[ISSUE] Most of this class' implementation is a clone of XSDParser. There are plans to work on closely integrating this class and XSDParser to provide for the most efficient processing of inline schemas.


Constructor Summary
WSDLParser()
          Default constructor.
 
Method Summary
 void characters(char[] characters, int start, int length)
           
 void comment(char[] characters, int start, int length)
           
 void endCDATA()
           
 void endDocument()
           
 void endDTD()
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
           
 void endEntity(java.lang.String name)
           
 void error(org.xml.sax.SAXParseException exception)
           
 void fatalError(org.xml.sax.SAXException exception)
           
 void fatalError(org.xml.sax.SAXParseException exception)
           
 java.util.Collection getDiagnostics()
          Provides a collection with the diagnostics generated during parsing.
 org.w3c.dom.Document getDocument()
          Provides the DOM document created by parsing the WSDL document.
static int getEndColumn(org.w3c.dom.Node node)
          Returns the column at which the given node ends.
static int getEndLine(org.w3c.dom.Node node)
          Returns the line at which the given node ends.
static int getStartColumn(org.w3c.dom.Node node)
          Returns the column at which the given node starts.
static int getStartLine(org.w3c.dom.Node node)
          Returns the line at which the given node starts.
static java.util.Map getUserData(org.w3c.dom.Node node)
          Returns the user data associated with the node.
 void parse(org.xml.sax.InputSource inputSource)
           
 void parse(java.io.InputStream inputStream)
          Parses the XML content read from the given input stream.
 void processingInstruction(java.lang.String target, java.lang.String data)
           
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
           
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void startCDATA()
           
 void startDocument()
           
 void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 void startEntity(java.lang.String name)
           
 void warning(org.xml.sax.SAXParseException exception)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WSDLParser

public WSDLParser()
Default constructor.

Method Detail

getEndColumn

public static int getEndColumn(org.w3c.dom.Node node)
Returns the column at which the given node ends.

Parameters:
node - the node to query.
Returns:
the column at which the given node ends.

getEndLine

public static int getEndLine(org.w3c.dom.Node node)
Returns the line at which the given node ends.

Parameters:
node - the node to query.
Returns:
the line at which the given node ends.

getStartColumn

public static int getStartColumn(org.w3c.dom.Node node)
Returns the column at which the given node starts.

Parameters:
node - the node to query.
Returns:
the column at which the given node starts.

getStartLine

public static int getStartLine(org.w3c.dom.Node node)
Returns the line at which the given node starts.

Parameters:
node - the node to query.
Returns:
the line at which the given node starts.

getUserData

public static java.util.Map getUserData(org.w3c.dom.Node node)
Returns the user data associated with the node. If the node has no user data, a new empty map is created.

Parameters:
node - the node to query.
Returns:
the user data associated with the node.

characters

public void characters(char[] characters,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

comment

public void comment(char[] characters,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
Specified by:
comment in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException

endCDATA

public void endCDATA()
Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler

endDocument

public void endDocument()
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler

endDTD

public void endDTD()
Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endEntity

public void endEntity(java.lang.String name)
Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler

error

public void error(org.xml.sax.SAXParseException exception)
Specified by:
error in interface org.xml.sax.ErrorHandler
Overrides:
error in class org.xml.sax.helpers.DefaultHandler

fatalError

public void fatalError(org.xml.sax.SAXException exception)

fatalError

public void fatalError(org.xml.sax.SAXParseException exception)
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler

getDiagnostics

public java.util.Collection getDiagnostics()
Provides a collection with the diagnostics generated during parsing.

Returns:
a Collection of WSDLDiagnostic objects.

getDocument

public org.w3c.dom.Document getDocument()
Provides the DOM document created by parsing the WSDL document.

Returns:
the resulting DOM document.

parse

public void parse(org.xml.sax.InputSource inputSource)

parse

public void parse(java.io.InputStream inputStream)
Parses the XML content read from the given input stream.

Parameters:
inputStream - the source input stream. Must not be null.

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Overrides:
processingInstruction in class org.xml.sax.helpers.DefaultHandler

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException
Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler

startCDATA

public void startCDATA()
Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler

startDocument

public void startDocument()
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler

startDTD

public void startDTD(java.lang.String name,
                     java.lang.String publicId,
                     java.lang.String systemId)
Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler

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
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

startEntity

public void startEntity(java.lang.String name)
Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler

warning

public void warning(org.xml.sax.SAXParseException exception)
Specified by:
warning in interface org.xml.sax.ErrorHandler
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler