Package net.sf.saxon.trace
Class ExpressionPresenter
java.lang.Object
net.sf.saxon.trace.ExpressionPresenter
This class handles the display of an abstract expression tree in an XML format
with some slight resemblance to XQueryX
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMake an uncommitted ExpressionPresenter.ExpressionPresenter
(Configuration config) Make an ExpressionPresenter that writes indented output to the standard error output destination of the ConfigurationExpressionPresenter
(Configuration config, StreamResult out) Make an ExpressionPresenter that writes indented output to a specified output streamExpressionPresenter
(Configuration config, StreamResult out, boolean checksum) Make an ExpressionPresenter that writes indented output to a specified output stream, with optional checksumExpressionPresenter
(Configuration config, Receiver receiver) Make an ExpressionPresenter for a given Configuration using a user-supplied Receiver to accept the outputExpressionPresenter
(Configuration config, Logger out) Make an ExpressionPresenter that writes indented output to a specified output streamExpressionPresenter
(Builder builder) Make an ExpressionPresenter that writes to a specified tree builder -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the outputstatic Receiver
defaultDestination
(Configuration config, Logger out) Make a receiver, using default output properties, with serialized output going to a specified OutputStreamvoid
emitAttribute
(String name, String value) Output an attribute nodevoid
emitAttribute
(String name, StructuredQName value) Output a QName-valued attribute nodevoid
int
End an element in the expression treevoid
End a child element in the outputGet the Saxon configurationGet the name poolstatic String
getNamespacesAsString
(NamespaceMap sc, boolean includeXmlNamespace) From a NamespaceMap, produce the SEF concise representation, for example "xs=~ xsl=~ example=file://example.com/"Get the optionsGet the type hierarchy cachevoid
init
(Configuration config, StreamResult out, boolean checksum) Make an ExpressionPresenter that writes indented output to a specified output stream, with checksummingvoid
init
(Configuration config, Receiver out, boolean checksum) Make an ExpressionPresenter that writes indented output to a specified output stream, with checksummingstatic String
Static method to escape a string using Javascript escaping conventionsstatic SerializationProperties
makeDefaultProperties
(Configuration config) Make a Properties object containing defaulted serialization attributes for the expression treevoid
namespace
(String prefix, NamespaceUri uri) Output a namespace declaration.void
setChildRole
(String role) Set the role of the next element to be outputvoid
setDefaultNamespace
(NamespaceUri namespace) Set the default namespace, used for subsequent calls on startElement.void
Set the optionsvoid
setRelocatable
(boolean relocatable) Say whether the package can be deployed to a different location, with a different base URIint
startElement
(String name) Start an elementint
startElement
(String name, Expression expr) Start an element representing an expression in the expression treevoid
startSubsidiaryElement
(String name) Start a child element in the output
-
Constructor Details
-
ExpressionPresenter
public ExpressionPresenter()Make an uncommitted ExpressionPresenter. This must be followed by a call on init() -
ExpressionPresenter
Make an ExpressionPresenter that writes indented output to the standard error output destination of the Configuration- Parameters:
config
- the Saxon configuration
-
ExpressionPresenter
Make an ExpressionPresenter that writes indented output to a specified output stream- Parameters:
config
- the Saxon configurationout
- the output destination
-
ExpressionPresenter
Make an ExpressionPresenter that writes to a specified tree builder- Parameters:
builder
- the tree builder
-
ExpressionPresenter
Make an ExpressionPresenter that writes indented output to a specified output stream, with optional checksum- Parameters:
config
- the Saxon configurationout
- the output destinationchecksum
- true if a checksum is to be written at the end of the file
-
ExpressionPresenter
Make an ExpressionPresenter that writes indented output to a specified output stream- Parameters:
config
- the Saxon configurationout
- the output stream
-
ExpressionPresenter
Make an ExpressionPresenter for a given Configuration using a user-supplied Receiver to accept the output- Parameters:
config
- the Configurationreceiver
- the user-supplied Receiver
-
-
Method Details
-
init
Make an ExpressionPresenter that writes indented output to a specified output stream, with checksumming- Parameters:
config
- the Saxon configurationout
- the output destinationchecksum
- true if a checksum is to be written at the end of the file
-
init
Make an ExpressionPresenter that writes indented output to a specified output stream, with checksumming- Parameters:
config
- the Saxon configurationout
- the output destinationchecksum
- true if a checksum is to be written at the end of the file
-
setDefaultNamespace
Set the default namespace, used for subsequent calls on startElement. Must be consistent throughout the whole document- Parameters:
namespace
- the default namespace
-
setOptions
Set the options- Parameters:
options
- the options
-
getOptions
Get the options- Returns:
- the options, or null if none have been set
-
setRelocatable
public void setRelocatable(boolean relocatable) Say whether the package can be deployed to a different location, with a different base URI- Parameters:
relocatable
- if true then static-base-uri() represents the deployed location of the package, rather than its compile time location
-
defaultDestination
Make a receiver, using default output properties, with serialized output going to a specified OutputStream- Parameters:
config
- the Configurationout
- the OutputStream- Returns:
- a Receiver that directs serialized output to this output stream
- Throws:
XPathException
- if a serializer cannot be created
-
makeDefaultProperties
Make a Properties object containing defaulted serialization attributes for the expression tree- Parameters:
config
- the Configuration- Returns:
- a default set of properties
-
startElement
Start an element representing an expression in the expression tree- Parameters:
name
- the name of the elementexpr
- the expression represented- Returns:
- the depth of the tree before this element: for diagnostics, this can be compared with the value returned by endElement
-
emitRetainedStaticContext
-
getNamespacesAsString
public static String getNamespacesAsString(NamespaceMap sc, boolean includeXmlNamespace) throws XPathException From a NamespaceMap, produce the SEF concise representation, for example "xs=~ xsl=~ example=file://example.com/"- Parameters:
sc
- the namespace mapincludeXmlNamespace
- for compatibility with SaxonJS 2+, indicate that any explicit binding for the XML namespace should be included in the list- Returns:
- the concise string representation of the namespace map
- Throws:
XPathException
- if the namespace map contains unsuitable namespaces, for example namespace URIs containing whitespace.
-
startElement
Start an element- Parameters:
name
- the name of the element- Returns:
- the depth of the tree before this element: for diagnostics, this can be compared with the value returned by endElement
-
setChildRole
Set the role of the next element to be output- Parameters:
role
- the value of the role output to be used
-
emitAttribute
Output an attribute node- Parameters:
name
- the name of the attributevalue
- the value of the attribute
-
emitAttribute
Output a QName-valued attribute node- Parameters:
name
- the name of the attributevalue
- the value of the attribute
-
namespace
Output a namespace declaration. All namespaces should be declared at the top level.- Parameters:
prefix
- the namespace prefixuri
- the namespace URI
-
endElement
public int endElement()End an element in the expression tree- Returns:
- the depth of the tree after ending this element. For diagnostics, this can be compared with the value returned by startElement()
-
startSubsidiaryElement
Start a child element in the output- Parameters:
name
- the name of the child element
-
endSubsidiaryElement
public void endSubsidiaryElement()End a child element in the output -
close
public void close()Close the output -
getConfiguration
Get the Saxon configuration- Returns:
- the Saxon configuration
-
getNamePool
Get the name pool- Returns:
- the name pool
-
getTypeHierarchy
Get the type hierarchy cache- Returns:
- the type hierarchy cache
-
jsEscape
Static method to escape a string using Javascript escaping conventions- Parameters:
in
- the string to be escaped- Returns:
- the escaped string
-