Package com.saxonica.xqj.pull
Class PullToStax
java.lang.Object
com.saxonica.xqj.pull.PullToStax
- All Implemented Interfaces:
XMLStreamConstants,XMLStreamReader
This class bridges PullProvider events to XMLStreamReader (Stax) events. That is, it acts
as an XMLStreamReader, fetching the underlying data from a PullProvider.
A PullProvider may provide access to any XDM sequence, whereas an XMLStreamReader always reads a document. The conversion of a sequence to a document follows the rules for "normalizing" a sequence in the Serialization specification: for example, atomic values are converted into text nodes, with adjacent atomic values being space-separated.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBridge a SAX SourceLocator to a javax.xml.stream.Location -
Field Summary
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT -
Constructor Summary
ConstructorsConstructorDescriptionPullToStax(PullProvider provider) Create a PullToStax instance, which wraps a Saxon PullProvider as a Stax XMLStreamReader -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intgetAttributeLocalName(int i) getAttributeName(int i) getAttributeNamespace(int i) getAttributePrefix(int i) getAttributeType(int i) getAttributeValue(int i) getAttributeValue(String uri, String local) intgetName()intReturn the number of namespaces declared on this element.getNamespacePrefix(int i) getNamespaceURI(int i) getText()char[]intgetTextCharacters(int sourceStart, char[] target, int targetStart, int length) intintstatic XMLStreamReadergetXMLStreamReader(NodeInfo node) Create an XMLStreamReader that reads the contents of a tree rooted at a document or element nodebooleanhasName()booleanhasNext()booleanhasText()booleanisAttributeSpecified(int i) booleanbooleanbooleanbooleanbooleanintnext()intnextTag()voidboolean
-
Constructor Details
-
PullToStax
Create a PullToStax instance, which wraps a Saxon PullProvider as a Stax XMLStreamReader- Parameters:
provider- the Saxon PullProvider from which the events will be read
-
-
Method Details
-
getXMLStreamReader
Create an XMLStreamReader that reads the contents of a tree rooted at a document or element node- Parameters:
node- the node to be read. This must be a document or element node- Throws:
IllegalArgumentException- if the node is not a document or element node
-
getAttributeCount
public int getAttributeCount()- Specified by:
getAttributeCountin interfaceXMLStreamReader
-
isAttributeSpecified
public boolean isAttributeSpecified(int i) - Specified by:
isAttributeSpecifiedin interfaceXMLStreamReader
-
getAttributeName
- Specified by:
getAttributeNamein interfaceXMLStreamReader
-
getAttributeLocalName
- Specified by:
getAttributeLocalNamein interfaceXMLStreamReader
-
getAttributeNamespace
- Specified by:
getAttributeNamespacein interfaceXMLStreamReader
-
getAttributePrefix
- Specified by:
getAttributePrefixin interfaceXMLStreamReader
-
getAttributeType
- Specified by:
getAttributeTypein interfaceXMLStreamReader
-
getAttributeValue
- Specified by:
getAttributeValuein interfaceXMLStreamReader
-
getAttributeValue
- Specified by:
getAttributeValuein interfaceXMLStreamReader
-
getEventType
public int getEventType()- Specified by:
getEventTypein interfaceXMLStreamReader
-
getNamespaceCount
public int getNamespaceCount()Return the number of namespaces declared on this element.- Specified by:
getNamespaceCountin interfaceXMLStreamReader- Returns:
- the number of in-scope namespaces
-
getText
- Specified by:
getTextin interfaceXMLStreamReader
-
getTextLength
public int getTextLength()- Specified by:
getTextLengthin interfaceXMLStreamReader
-
getTextStart
public int getTextStart()- Specified by:
getTextStartin interfaceXMLStreamReader
-
getTextCharacters
public char[] getTextCharacters()- Specified by:
getTextCharactersin interfaceXMLStreamReader
-
getTextCharacters
public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException - Specified by:
getTextCharactersin interfaceXMLStreamReader- Throws:
XMLStreamException
-
next
- Specified by:
nextin interfaceXMLStreamReader- Throws:
XMLStreamException
-
nextTag
- Specified by:
nextTagin interfaceXMLStreamReader- Throws:
XMLStreamException
-
close
- Specified by:
closein interfaceXMLStreamReader- Throws:
XMLStreamException
-
hasName
public boolean hasName()- Specified by:
hasNamein interfaceXMLStreamReader
-
hasNext
- Specified by:
hasNextin interfaceXMLStreamReader- Throws:
XMLStreamException
-
hasText
public boolean hasText()- Specified by:
hasTextin interfaceXMLStreamReader
-
isCharacters
public boolean isCharacters()- Specified by:
isCharactersin interfaceXMLStreamReader
-
isEndElement
public boolean isEndElement()- Specified by:
isEndElementin interfaceXMLStreamReader
-
isStandalone
public boolean isStandalone()- Specified by:
isStandalonein interfaceXMLStreamReader
-
isStartElement
public boolean isStartElement()- Specified by:
isStartElementin interfaceXMLStreamReader
-
isWhiteSpace
public boolean isWhiteSpace()- Specified by:
isWhiteSpacein interfaceXMLStreamReader
-
standaloneSet
public boolean standaloneSet()- Specified by:
standaloneSetin interfaceXMLStreamReader
-
getCharacterEncodingScheme
- Specified by:
getCharacterEncodingSchemein interfaceXMLStreamReader
-
getElementText
- Specified by:
getElementTextin interfaceXMLStreamReader- Throws:
XMLStreamException
-
getEncoding
- Specified by:
getEncodingin interfaceXMLStreamReader
-
getLocalName
- Specified by:
getLocalNamein interfaceXMLStreamReader
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceXMLStreamReader
-
getPIData
- Specified by:
getPIDatain interfaceXMLStreamReader
-
getPITarget
- Specified by:
getPITargetin interfaceXMLStreamReader
-
getPrefix
- Specified by:
getPrefixin interfaceXMLStreamReader
-
getVersion
- Specified by:
getVersionin interfaceXMLStreamReader
-
getNamespacePrefix
- Specified by:
getNamespacePrefixin interfaceXMLStreamReader
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceXMLStreamReader
-
getNamespaceContext
- Specified by:
getNamespaceContextin interfaceXMLStreamReader
-
getName
- Specified by:
getNamein interfaceXMLStreamReader
-
getLocation
- Specified by:
getLocationin interfaceXMLStreamReader
-
getProperty
- Specified by:
getPropertyin interfaceXMLStreamReader- Throws:
IllegalArgumentException
-
require
- Specified by:
requirein interfaceXMLStreamReader- Throws:
XMLStreamException
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceXMLStreamReader
-