org.jvnet.wom.impl.parser
Class WSDLContentHandlerEx

java.lang.Object
  extended by org.jvnet.wom.impl.parser.handler.WSDLContentHandler
      extended by org.jvnet.wom.impl.parser.WSDLContentHandlerEx
All Implemented Interfaces:
WSDLEventSource, org.xml.sax.ContentHandler

public class WSDLContentHandlerEx
extends WSDLContentHandler


Field Summary
 WSDLDefinitionsImpl currentWSDL
          The schema currently being parsed.
 WSDLDocumentImpl document
          Points to the WSDLDocumentImpl that represents the schema document being parsed.
 ParserContext parser
           
 
Constructor Summary
WSDLContentHandlerEx(ParserContext parser)
           
 
Method Summary
 void addErrorChecker(Patch patcher)
           
 void addPatcher(Patch patcher)
           
 org.xml.sax.Locator copyLocator()
          Creates a copy of the current locator object.
 void endPrefixMapping(java.lang.String prefix)
           
 java.lang.String getAnnotationContextElementName()
          Gets the element name that contains the annotation element.
 org.xml.sax.ErrorHandler getErrorHandler()
           
 boolean hasAlreadyBeenRead()
          Called when a new document is being parsed and checks if the document has already been parsed before.
 void importWSDL(java.lang.String ns, java.lang.String wsdlLocation)
          Imports the specified WSDL.
 void onEnterElementConsumed(java.lang.String uri, java.lang.String localName, java.lang.String qname, org.xml.sax.Attributes atts)
          Called by the generated handler code when an enter element event is consumed.
 void onLeaveElementConsumed(java.lang.String uri, java.lang.String localName, java.lang.String qname)
           
 boolean parseBoolean(java.lang.String v)
           
 void parseEntity(org.xml.sax.InputSource source, java.lang.String expectedNamespace, org.xml.sax.Locator importLocation)
          Parses the specified entity.
 void reportError(java.lang.String msg)
           
 void reportError(java.lang.String msg, org.xml.sax.Locator loc)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
 
Methods inherited from class org.jvnet.wom.impl.parser.handler.WSDLContentHandler
characters, consumeAttribute, endDocument, endElement, getAttributeIndex, getCurrentAttributes, getLocator, ignorableWhitespace, processingInstruction, processList, redirectSubtree, replace, resolveNamespacePrefix, sendEnterAttribute, sendEnterElement, sendLeaveAttribute, sendLeaveElement, sendText, setDocumentLocator, setRootHandler, skippedEntity, startDocument, startElement, trace, traceln, unexpectedX
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentWSDL

public WSDLDefinitionsImpl currentWSDL
The schema currently being parsed.


document

public WSDLDocumentImpl document
Points to the WSDLDocumentImpl that represents the schema document being parsed.


parser

public ParserContext parser
Constructor Detail

WSDLContentHandlerEx

public WSDLContentHandlerEx(ParserContext parser)
Method Detail

addPatcher

public void addPatcher(Patch patcher)

addErrorChecker

public void addErrorChecker(Patch patcher)

reportError

public void reportError(java.lang.String msg,
                        org.xml.sax.Locator loc)
                 throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

reportError

public void reportError(java.lang.String msg)
                 throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

importWSDL

public void importWSDL(java.lang.String ns,
                       java.lang.String wsdlLocation)
                throws org.xml.sax.SAXException
Imports the specified WSDL.

Throws:
org.xml.sax.SAXException

hasAlreadyBeenRead

public boolean hasAlreadyBeenRead()
Called when a new document is being parsed and checks if the document has already been parsed before.

Used to avoid recursive inclusion. Note that the same document will be parsed multiple times if they are for different target namespaces.

Document Graph Model

The challenge we are facing here is that you have a graph of documents that reference each other. Each document has an unique URI to identify themselves, and references are done by using those. The graph may contain cycles.

Our goal here is to parse all the documents in the graph, without parsing the same document twice. This method implements this check.

One complication is the chameleon schema; a document can be parsed multiple times if they are under different target namespaces.

Also, note that when you resolve relative URIs in the @schemaLocation, their base URI is *NOT* the URI of the document.

Returns:
true if the document has already been processed and thus needs to be skipped.

parseEntity

public void parseEntity(org.xml.sax.InputSource source,
                        java.lang.String expectedNamespace,
                        org.xml.sax.Locator importLocation)
                 throws org.xml.sax.SAXException
Parses the specified entity.

Parameters:
importLocation - The source location of the import/include statement. Used for reporting errors.
Throws:
org.xml.sax.SAXException

getAnnotationContextElementName

public java.lang.String getAnnotationContextElementName()
Gets the element name that contains the annotation element. This method works correctly only when called by the annotation handler.


copyLocator

public org.xml.sax.Locator copyLocator()
Creates a copy of the current locator object.


getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()

onEnterElementConsumed

public void onEnterElementConsumed(java.lang.String uri,
                                   java.lang.String localName,
                                   java.lang.String qname,
                                   org.xml.sax.Attributes atts)
                            throws org.xml.sax.SAXException
Description copied from class: WSDLContentHandler
Called by the generated handler code when an enter element event is consumed.

Pushes a new attribute set.

Note that attributes are NOT pushed at the startElement method, because the processing of the enterElement event can trigger other attribute events and etc.

This method will be called from one of handler when it truely consumes the enterElement event.

Overrides:
onEnterElementConsumed in class WSDLContentHandler
Throws:
org.xml.sax.SAXException

onLeaveElementConsumed

public void onLeaveElementConsumed(java.lang.String uri,
                                   java.lang.String localName,
                                   java.lang.String qname)
                            throws org.xml.sax.SAXException
Overrides:
onLeaveElementConsumed in class WSDLContentHandler
Throws:
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Overrides:
startPrefixMapping in class WSDLContentHandler
Throws:
org.xml.sax.SAXException

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Overrides:
endPrefixMapping in class WSDLContentHandler
Throws:
org.xml.sax.SAXException

parseBoolean

public boolean parseBoolean(java.lang.String v)


Copyright © 2009 Sun Microsystems, Inc. All Rights Reserved.