Package org.restlet.ext.wadl
Class WadlRepresentation.ContentReader
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.restlet.ext.wadl.WadlRepresentation.ContentReader
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler,org.xml.sax.DTDHandler,org.xml.sax.EntityResolver,org.xml.sax.ErrorHandler,org.xml.sax.ext.LexicalHandler
- Enclosing class:
- WadlRepresentation
private static class WadlRepresentation.ContentReader extends org.xml.sax.helpers.DefaultHandler implements org.xml.sax.ext.LexicalHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWadlRepresentation.ContentReader.MixedContentStatestatic classWadlRepresentation.ContentReader.State
-
Field Summary
Fields Modifier and Type Field Description private ApplicationInfocurrentApplicationThe current parsed "application" tag.private DocumentationInfocurrentDocumentationThe current parsed "documentation" tag.private GrammarsInfocurrentGrammarsThe current parsed "grammars" tag.private IncludeInfocurrentIncludeThe current parsed "include" tag.private LinkInfocurrentLinkThe current parsed "link" tag.private MethodInfocurrentMethodThe current parsed "method" tag.private org.w3c.dom.CDATASectioncurrentMixedContentCDataSectionThe current mixed content CDataSection.private org.w3c.dom.NodecurrentMixedContentNodeThe current mixed content node.private OptionInfocurrentOptionThe current parsed "option" tag.private ParameterInfocurrentParameterThe current parsed "param" tag.private RepresentationInfocurrentRepresentationThe current parsed "representation" tag.private RequestInfocurrentRequestThe current parsed "request" tag.private ResourcesInfocurrentResourcesThe current parsed "resources" tag.private java.util.List<ResourceInfo>currentResourcesListThe list of the current parsed "resource" tags.private ResourceTypeInfocurrentResourceTypeThe current parsed "resource_type" tag.private ResponseInfocurrentResponseThe current parsed "response" tag.private org.w3c.dom.DocumentmixedContentDocumentThe document used to create the mixed content.private java.util.List<WadlRepresentation.ContentReader.MixedContentState>mixedContentStatesThe stack of mixed content parser states.private org.w3c.dom.NodemixedContentTopNodeThe top node of mixed content nodes.private java.util.Map<java.lang.String,java.lang.String>namespacesMap of namespaces used in the WADL document.private java.util.List<WadlRepresentation.ContentReader.State>statesThe stack of parser states.private WadlRepresentationwadlRepresentationThe WadlRepresentation instance that represents the parsed document.
-
Constructor Summary
Constructors Constructor Description ContentReader(WadlRepresentation wadlRepresentation)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)Receive notification of character data.voidcomment(char[] ch, int start, int length)Receive notification of a comment section.voidendCDATA()Receive notification of the end of a CDATA sectionn.voidendDocument()Receive notification of the end of a document.voidendDTD()voidendElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)Receive notification of the end of an element.voidendEntity(java.lang.String name)Receive notification of the end of an entity section.private WadlRepresentation.ContentReader.MixedContentStategetMixedContentState()Returns the current state when processing mixed content sections.ParameterStylegetParameterStyle(java.lang.String parameterStyle)Returns a parameterStyle value according to the given string or null.private WadlRepresentation.ContentReader.StategetState()Returns the current state when processing the WADL document.private WadlRepresentation.ContentReader.MixedContentStatepopMixedContentState()Drops the current state from the stack and returns it.private WadlRepresentation.ContentReader.StatepopState()Drops the current state from the stack and returns it.private voidpushMixedContentState(WadlRepresentation.ContentReader.MixedContentState state)Adds the given state.private voidpushState(WadlRepresentation.ContentReader.State state)Adds the given state.voidstartCDATA()Receive notification of the beginning of a CDATA section.voidstartDocument()Receive notification of the beginning of a document.voidstartDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)Receive notification of the beginning of an element.voidstartEntity(java.lang.String name)Receive notification of the beginning of an entity.voidstartPrefixMapping(java.lang.String arg0, java.lang.String arg1)Receive notification of the beginning of a prefix-URI Namespace mapping.
-
-
-
Field Detail
-
currentApplication
private ApplicationInfo currentApplication
The current parsed "application" tag.
-
currentDocumentation
private DocumentationInfo currentDocumentation
The current parsed "documentation" tag.
-
currentGrammars
private GrammarsInfo currentGrammars
The current parsed "grammars" tag.
-
currentInclude
private IncludeInfo currentInclude
The current parsed "include" tag.
-
currentLink
private LinkInfo currentLink
The current parsed "link" tag.
-
currentMethod
private MethodInfo currentMethod
The current parsed "method" tag.
-
currentMixedContentCDataSection
private org.w3c.dom.CDATASection currentMixedContentCDataSection
The current mixed content CDataSection.
-
currentMixedContentNode
private org.w3c.dom.Node currentMixedContentNode
The current mixed content node.
-
currentOption
private OptionInfo currentOption
The current parsed "option" tag.
-
currentParameter
private ParameterInfo currentParameter
The current parsed "param" tag.
-
currentRepresentation
private RepresentationInfo currentRepresentation
The current parsed "representation" tag.
-
currentRequest
private RequestInfo currentRequest
The current parsed "request" tag.
-
currentResources
private ResourcesInfo currentResources
The current parsed "resources" tag.
-
currentResourcesList
private final java.util.List<ResourceInfo> currentResourcesList
The list of the current parsed "resource" tags.
-
currentResourceType
private ResourceTypeInfo currentResourceType
The current parsed "resource_type" tag.
-
currentResponse
private ResponseInfo currentResponse
The current parsed "response" tag.
-
mixedContentDocument
private org.w3c.dom.Document mixedContentDocument
The document used to create the mixed content.
-
mixedContentStates
private final java.util.List<WadlRepresentation.ContentReader.MixedContentState> mixedContentStates
The stack of mixed content parser states.
-
mixedContentTopNode
private org.w3c.dom.Node mixedContentTopNode
The top node of mixed content nodes.
-
namespaces
private java.util.Map<java.lang.String,java.lang.String> namespaces
Map of namespaces used in the WADL document. The key is the URI of the namespace and the value, the prefix.
-
states
private final java.util.List<WadlRepresentation.ContentReader.State> states
The stack of parser states.
-
wadlRepresentation
private final WadlRepresentation wadlRepresentation
The WadlRepresentation instance that represents the parsed document.
-
-
Constructor Detail
-
ContentReader
public ContentReader(WadlRepresentation wadlRepresentation)
Constructor- Parameters:
wadlRepresentation- The WadlRepresentation instance that represents the parsed document.
-
-
Method Detail
-
characters
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXExceptionReceive notification of character data.- Specified by:
charactersin interfaceorg.xml.sax.ContentHandler- Overrides:
charactersin classorg.xml.sax.helpers.DefaultHandler- Parameters:
ch- The characters from the XML document.start- The start position in the array.length- The number of characters to read from the array.- Throws:
org.xml.sax.SAXException
-
comment
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXExceptionReceive notification of a comment section.- Specified by:
commentin interfaceorg.xml.sax.ext.LexicalHandler- Parameters:
ch- The characters from the XML document.start- The start position in the array.length- The number of characters to read from the array.- Throws:
org.xml.sax.SAXException
-
endCDATA
public void endCDATA() throws org.xml.sax.SAXExceptionReceive notification of the end of a CDATA sectionn.- Specified by:
endCDATAin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
endDocument
public void endDocument() throws org.xml.sax.SAXExceptionReceive notification of the end of a document.- Specified by:
endDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
endDocumentin classorg.xml.sax.helpers.DefaultHandler- Throws:
org.xml.sax.SAXException
-
endDTD
public void endDTD() throws org.xml.sax.SAXException- Specified by:
endDTDin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXExceptionReceive notification of the end of an element.- Specified by:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin classorg.xml.sax.helpers.DefaultHandler- Parameters:
uri- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName- The qualified XML name (with prefix), or the empty string if qualified names are not available.- Throws:
org.xml.sax.SAXException
-
endEntity
public void endEntity(java.lang.String name) throws org.xml.sax.SAXExceptionReceive notification of the end of an entity section.- Specified by:
endEntityin interfaceorg.xml.sax.ext.LexicalHandler- Parameters:
name- The name of the entity.- Throws:
org.xml.sax.SAXException
-
getMixedContentState
private WadlRepresentation.ContentReader.MixedContentState getMixedContentState()
Returns the current state when processing mixed content sections.- Returns:
- The current state when processing mixed content sections.
-
getParameterStyle
public ParameterStyle getParameterStyle(java.lang.String parameterStyle)
Returns a parameterStyle value according to the given string or null.- Parameters:
parameterStyle- The given string.- Returns:
- The parameterStyle value that corresponds to the given style name, or null otherwise.
-
getState
private WadlRepresentation.ContentReader.State getState()
Returns the current state when processing the WADL document.- Returns:
- the current state when processing the WADL document.
-
popMixedContentState
private WadlRepresentation.ContentReader.MixedContentState popMixedContentState()
Drops the current state from the stack and returns it. This state becomes the former current state.- Returns:
- the former current state.
-
popState
private WadlRepresentation.ContentReader.State popState()
Drops the current state from the stack and returns it. This state becomes the former current state.- Returns:
- the former current state.
-
pushMixedContentState
private void pushMixedContentState(WadlRepresentation.ContentReader.MixedContentState state)
Adds the given state.- Parameters:
state- The given state.
-
pushState
private void pushState(WadlRepresentation.ContentReader.State state)
Adds the given state.- Parameters:
state- The given state.
-
startCDATA
public void startCDATA() throws org.xml.sax.SAXExceptionReceive notification of the beginning of a CDATA section.- Specified by:
startCDATAin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
startDocument
public void startDocument() throws org.xml.sax.SAXExceptionReceive notification of the beginning of a document.- Specified by:
startDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
startDocumentin classorg.xml.sax.helpers.DefaultHandler- Throws:
org.xml.sax.SAXException
-
startDTD
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException- Specified by:
startDTDin interfaceorg.xml.sax.ext.LexicalHandler- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXExceptionReceive notification of the beginning of an element.- Specified by:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin classorg.xml.sax.helpers.DefaultHandler- Parameters:
uri- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName- The qualified name (with prefix), or the empty string if qualified names are not available.attrs- The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. The value of this object after startElement returns is undefined.- Throws:
org.xml.sax.SAXException
-
startEntity
public void startEntity(java.lang.String name) throws org.xml.sax.SAXExceptionReceive notification of the beginning of an entity.- Specified by:
startEntityin interfaceorg.xml.sax.ext.LexicalHandler- Parameters:
name- The name of the entity.- Throws:
org.xml.sax.SAXException
-
startPrefixMapping
public void startPrefixMapping(java.lang.String arg0, java.lang.String arg1) throws org.xml.sax.SAXExceptionReceive notification of the beginning of a prefix-URI Namespace mapping.- Specified by:
startPrefixMappingin interfaceorg.xml.sax.ContentHandler- Overrides:
startPrefixMappingin classorg.xml.sax.helpers.DefaultHandler- Parameters:
name- The name of the entity.- Throws:
org.xml.sax.SAXException
-
-