Package com.saxonica.xqj.pull
Class PullToStax
- java.lang.Object
-
- com.saxonica.xqj.pull.PullToStax
-
- All Implemented Interfaces:
javax.xml.stream.XMLStreamConstants
,javax.xml.stream.XMLStreamReader
public class PullToStax extends java.lang.Object implements javax.xml.stream.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 Classes Modifier and Type Class Description static class
PullToStax.SourceStreamLocation
Bridge a SAX SourceLocator to a javax.xml.stream.Location
-
Constructor Summary
Constructors Constructor Description PullToStax(PullProvider provider)
Create a PullToStax instance, which wraps a Saxon PullProvider as a Stax XMLStreamReader
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
int
getAttributeCount()
java.lang.String
getAttributeLocalName(int i)
javax.xml.namespace.QName
getAttributeName(int i)
java.lang.String
getAttributeNamespace(int i)
java.lang.String
getAttributePrefix(int i)
java.lang.String
getAttributeType(int i)
java.lang.String
getAttributeValue(int i)
java.lang.String
getAttributeValue(java.lang.String uri, java.lang.String local)
java.lang.String
getCharacterEncodingScheme()
java.lang.String
getElementText()
java.lang.String
getEncoding()
int
getEventType()
java.lang.String
getLocalName()
javax.xml.stream.Location
getLocation()
javax.xml.namespace.QName
getName()
javax.xml.namespace.NamespaceContext
getNamespaceContext()
int
getNamespaceCount()
Return the number of namespaces declared on this element.java.lang.String
getNamespacePrefix(int i)
java.lang.String
getNamespaceURI()
java.lang.String
getNamespaceURI(int i)
java.lang.String
getNamespaceURI(java.lang.String s)
java.lang.String
getPIData()
java.lang.String
getPITarget()
java.lang.String
getPrefix()
java.lang.Object
getProperty(java.lang.String s)
java.lang.String
getText()
char[]
getTextCharacters()
int
getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
int
getTextLength()
int
getTextStart()
java.lang.String
getVersion()
static javax.xml.stream.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
isCharacters()
boolean
isEndElement()
boolean
isStandalone()
boolean
isStartElement()
boolean
isWhiteSpace()
int
next()
int
nextTag()
void
require(int event, java.lang.String uri, java.lang.String local)
boolean
standaloneSet()
-
-
-
Constructor Detail
-
PullToStax
public PullToStax(PullProvider provider)
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 Detail
-
getXMLStreamReader
public static javax.xml.stream.XMLStreamReader getXMLStreamReader(NodeInfo node)
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:
java.lang.IllegalArgumentException
- if the node is not a document or element node
-
getAttributeCount
public int getAttributeCount()
- Specified by:
getAttributeCount
in interfacejavax.xml.stream.XMLStreamReader
-
isAttributeSpecified
public boolean isAttributeSpecified(int i)
- Specified by:
isAttributeSpecified
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeName
public javax.xml.namespace.QName getAttributeName(int i)
- Specified by:
getAttributeName
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeLocalName
public java.lang.String getAttributeLocalName(int i)
- Specified by:
getAttributeLocalName
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeNamespace
public java.lang.String getAttributeNamespace(int i)
- Specified by:
getAttributeNamespace
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributePrefix
public java.lang.String getAttributePrefix(int i)
- Specified by:
getAttributePrefix
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeType
public java.lang.String getAttributeType(int i)
- Specified by:
getAttributeType
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeValue
public java.lang.String getAttributeValue(int i)
- Specified by:
getAttributeValue
in interfacejavax.xml.stream.XMLStreamReader
-
getAttributeValue
public java.lang.String getAttributeValue(java.lang.String uri, java.lang.String local)
- Specified by:
getAttributeValue
in interfacejavax.xml.stream.XMLStreamReader
-
getEventType
public int getEventType()
- Specified by:
getEventType
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespaceCount
public int getNamespaceCount()
Return the number of namespaces declared on this element.- Specified by:
getNamespaceCount
in interfacejavax.xml.stream.XMLStreamReader
- Returns:
- the number of in-scope namespaces
-
getText
public java.lang.String getText()
- Specified by:
getText
in interfacejavax.xml.stream.XMLStreamReader
-
getTextLength
public int getTextLength()
- Specified by:
getTextLength
in interfacejavax.xml.stream.XMLStreamReader
-
getTextStart
public int getTextStart()
- Specified by:
getTextStart
in interfacejavax.xml.stream.XMLStreamReader
-
getTextCharacters
public char[] getTextCharacters()
- Specified by:
getTextCharacters
in interfacejavax.xml.stream.XMLStreamReader
-
getTextCharacters
public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws javax.xml.stream.XMLStreamException
- Specified by:
getTextCharacters
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
next
public int next() throws javax.xml.stream.XMLStreamException
- Specified by:
next
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
nextTag
public int nextTag() throws javax.xml.stream.XMLStreamException
- Specified by:
nextTag
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
close
public void close() throws javax.xml.stream.XMLStreamException
- Specified by:
close
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
hasName
public boolean hasName()
- Specified by:
hasName
in interfacejavax.xml.stream.XMLStreamReader
-
hasNext
public boolean hasNext() throws javax.xml.stream.XMLStreamException
- Specified by:
hasNext
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
hasText
public boolean hasText()
- Specified by:
hasText
in interfacejavax.xml.stream.XMLStreamReader
-
isCharacters
public boolean isCharacters()
- Specified by:
isCharacters
in interfacejavax.xml.stream.XMLStreamReader
-
isEndElement
public boolean isEndElement()
- Specified by:
isEndElement
in interfacejavax.xml.stream.XMLStreamReader
-
isStandalone
public boolean isStandalone()
- Specified by:
isStandalone
in interfacejavax.xml.stream.XMLStreamReader
-
isStartElement
public boolean isStartElement()
- Specified by:
isStartElement
in interfacejavax.xml.stream.XMLStreamReader
-
isWhiteSpace
public boolean isWhiteSpace()
- Specified by:
isWhiteSpace
in interfacejavax.xml.stream.XMLStreamReader
-
standaloneSet
public boolean standaloneSet()
- Specified by:
standaloneSet
in interfacejavax.xml.stream.XMLStreamReader
-
getCharacterEncodingScheme
public java.lang.String getCharacterEncodingScheme()
- Specified by:
getCharacterEncodingScheme
in interfacejavax.xml.stream.XMLStreamReader
-
getElementText
public java.lang.String getElementText() throws javax.xml.stream.XMLStreamException
- Specified by:
getElementText
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getEncoding
public java.lang.String getEncoding()
- Specified by:
getEncoding
in interfacejavax.xml.stream.XMLStreamReader
-
getLocalName
public java.lang.String getLocalName()
- Specified by:
getLocalName
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespaceURI
public java.lang.String getNamespaceURI()
- Specified by:
getNamespaceURI
in interfacejavax.xml.stream.XMLStreamReader
-
getPIData
public java.lang.String getPIData()
- Specified by:
getPIData
in interfacejavax.xml.stream.XMLStreamReader
-
getPITarget
public java.lang.String getPITarget()
- Specified by:
getPITarget
in interfacejavax.xml.stream.XMLStreamReader
-
getPrefix
public java.lang.String getPrefix()
- Specified by:
getPrefix
in interfacejavax.xml.stream.XMLStreamReader
-
getVersion
public java.lang.String getVersion()
- Specified by:
getVersion
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespacePrefix
public java.lang.String getNamespacePrefix(int i)
- Specified by:
getNamespacePrefix
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespaceURI
public java.lang.String getNamespaceURI(int i)
- Specified by:
getNamespaceURI
in interfacejavax.xml.stream.XMLStreamReader
-
getNamespaceContext
public javax.xml.namespace.NamespaceContext getNamespaceContext()
- Specified by:
getNamespaceContext
in interfacejavax.xml.stream.XMLStreamReader
-
getName
public javax.xml.namespace.QName getName()
- Specified by:
getName
in interfacejavax.xml.stream.XMLStreamReader
-
getLocation
public javax.xml.stream.Location getLocation()
- Specified by:
getLocation
in interfacejavax.xml.stream.XMLStreamReader
-
getProperty
public java.lang.Object getProperty(java.lang.String s) throws java.lang.IllegalArgumentException
- Specified by:
getProperty
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
java.lang.IllegalArgumentException
-
require
public void require(int event, java.lang.String uri, java.lang.String local) throws javax.xml.stream.XMLStreamException
- Specified by:
require
in interfacejavax.xml.stream.XMLStreamReader
- Throws:
javax.xml.stream.XMLStreamException
-
getNamespaceURI
public java.lang.String getNamespaceURI(java.lang.String s)
- Specified by:
getNamespaceURI
in interfacejavax.xml.stream.XMLStreamReader
-
-