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 class
Bridge 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 TypeMethodDescriptionvoid
close()
int
getAttributeLocalName
(int i) getAttributeName
(int i) getAttributeNamespace
(int i) getAttributePrefix
(int i) getAttributeType
(int i) getAttributeValue
(int i) getAttributeValue
(String uri, String local) int
getName()
int
Return the number of namespaces declared on this element.getNamespacePrefix
(int i) getNamespaceURI
(int i) getText()
char[]
int
getTextCharacters
(int sourceStart, char[] target, int targetStart, int length) int
int
static XMLStreamReader
getXMLStreamReader
(NodeInfo node) Create an XMLStreamReader that reads the contents of a tree rooted at a document or element nodeboolean
hasName()
boolean
hasNext()
boolean
hasText()
boolean
isAttributeSpecified
(int i) boolean
boolean
boolean
boolean
boolean
int
next()
int
nextTag()
void
boolean
-
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:
getAttributeCount
in interfaceXMLStreamReader
-
isAttributeSpecified
public boolean isAttributeSpecified(int i) - Specified by:
isAttributeSpecified
in interfaceXMLStreamReader
-
getAttributeName
- Specified by:
getAttributeName
in interfaceXMLStreamReader
-
getAttributeLocalName
- Specified by:
getAttributeLocalName
in interfaceXMLStreamReader
-
getAttributeNamespace
- Specified by:
getAttributeNamespace
in interfaceXMLStreamReader
-
getAttributePrefix
- Specified by:
getAttributePrefix
in interfaceXMLStreamReader
-
getAttributeType
- Specified by:
getAttributeType
in interfaceXMLStreamReader
-
getAttributeValue
- Specified by:
getAttributeValue
in interfaceXMLStreamReader
-
getAttributeValue
- Specified by:
getAttributeValue
in interfaceXMLStreamReader
-
getEventType
public int getEventType()- Specified by:
getEventType
in interfaceXMLStreamReader
-
getNamespaceCount
public int getNamespaceCount()Return the number of namespaces declared on this element.- Specified by:
getNamespaceCount
in interfaceXMLStreamReader
- Returns:
- the number of in-scope namespaces
-
getText
- Specified by:
getText
in interfaceXMLStreamReader
-
getTextLength
public int getTextLength()- Specified by:
getTextLength
in interfaceXMLStreamReader
-
getTextStart
public int getTextStart()- Specified by:
getTextStart
in interfaceXMLStreamReader
-
getTextCharacters
public char[] getTextCharacters()- Specified by:
getTextCharacters
in interfaceXMLStreamReader
-
getTextCharacters
public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException - Specified by:
getTextCharacters
in interfaceXMLStreamReader
- Throws:
XMLStreamException
-
next
- Specified by:
next
in interfaceXMLStreamReader
- Throws:
XMLStreamException
-
nextTag
- Specified by:
nextTag
in interfaceXMLStreamReader
- Throws:
XMLStreamException
-
close
- Specified by:
close
in interfaceXMLStreamReader
- Throws:
XMLStreamException
-
hasName
public boolean hasName()- Specified by:
hasName
in interfaceXMLStreamReader
-
hasNext
- Specified by:
hasNext
in interfaceXMLStreamReader
- Throws:
XMLStreamException
-
hasText
public boolean hasText()- Specified by:
hasText
in interfaceXMLStreamReader
-
isCharacters
public boolean isCharacters()- Specified by:
isCharacters
in interfaceXMLStreamReader
-
isEndElement
public boolean isEndElement()- Specified by:
isEndElement
in interfaceXMLStreamReader
-
isStandalone
public boolean isStandalone()- Specified by:
isStandalone
in interfaceXMLStreamReader
-
isStartElement
public boolean isStartElement()- Specified by:
isStartElement
in interfaceXMLStreamReader
-
isWhiteSpace
public boolean isWhiteSpace()- Specified by:
isWhiteSpace
in interfaceXMLStreamReader
-
standaloneSet
public boolean standaloneSet()- Specified by:
standaloneSet
in interfaceXMLStreamReader
-
getCharacterEncodingScheme
- Specified by:
getCharacterEncodingScheme
in interfaceXMLStreamReader
-
getElementText
- Specified by:
getElementText
in interfaceXMLStreamReader
- Throws:
XMLStreamException
-
getEncoding
- Specified by:
getEncoding
in interfaceXMLStreamReader
-
getLocalName
- Specified by:
getLocalName
in interfaceXMLStreamReader
-
getNamespaceURI
- Specified by:
getNamespaceURI
in interfaceXMLStreamReader
-
getPIData
- Specified by:
getPIData
in interfaceXMLStreamReader
-
getPITarget
- Specified by:
getPITarget
in interfaceXMLStreamReader
-
getPrefix
- Specified by:
getPrefix
in interfaceXMLStreamReader
-
getVersion
- Specified by:
getVersion
in interfaceXMLStreamReader
-
getNamespacePrefix
- Specified by:
getNamespacePrefix
in interfaceXMLStreamReader
-
getNamespaceURI
- Specified by:
getNamespaceURI
in interfaceXMLStreamReader
-
getNamespaceContext
- Specified by:
getNamespaceContext
in interfaceXMLStreamReader
-
getName
- Specified by:
getName
in interfaceXMLStreamReader
-
getLocation
- Specified by:
getLocation
in interfaceXMLStreamReader
-
getProperty
- Specified by:
getProperty
in interfaceXMLStreamReader
- Throws:
IllegalArgumentException
-
require
- Specified by:
require
in interfaceXMLStreamReader
- Throws:
XMLStreamException
-
getNamespaceURI
- Specified by:
getNamespaceURI
in interfaceXMLStreamReader
-