|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xalan.xpath.XPathSupportDefault | +--org.apache.xalan.xpath.xml.XMLParserLiaisonDefault
This class is the default XMLParserLiaison for the XSL Processor. It can be used alone, for programmatically built DOMs (I expect this use will be very rare), or it can be derived from, in order to make parser specific implementations.
Field Summary | |
java.lang.String |
m_attrSpecialChars
These are characters that will be escaped in the output. |
java.util.Hashtable |
m_extensionFunctionNamespaces
**For internal use only** Table of extensions that may be called from the expression language via the call(name, ...) function. |
Constructor Summary | |
XMLParserLiaisonDefault()
Construct an instance. |
|
XMLParserLiaisonDefault(ProblemListener problemListener)
Construct an instance. |
Method Summary | |
void |
addExtensionElementNamespace(java.lang.String uri,
ExtensionFunctionHandler extNS)
**For advanced use only** Register an element extension namespace handler. |
void |
addExtensionNamespace(java.lang.String uri,
ExtensionFunctionHandler extNS)
**For advanced use only** Register an extension namespace handler. |
void |
associateXLocatorToNode(org.w3c.dom.Node node,
XLocator xlocator)
**For advanced use only** Associate an XLocator provider to a node. |
void |
checkNode(org.w3c.dom.Node node)
Check node to see if it matches this liaison. |
void |
copyFromOtherLiaison(XMLParserLiaisonDefault from)
Copy attributes from another liaison. |
org.w3c.dom.Document |
createDocument()
Create an empty DOM Document. |
XLocator |
createXLocatorHandler()
**For advanced use only** getXLocatorHandler. |
boolean |
elementAvailable(java.lang.String ns,
java.lang.String funcName)
Execute the element-available() function. |
void |
error(int msg)
Tell the user of an error, and probably throw an exception. |
void |
error(org.w3c.dom.Node sourceNode,
int msg)
Tell the user of an error, and probably throw an exception. |
void |
error(org.w3c.dom.Node sourceNode,
int msg,
java.lang.Object[] args)
Tell the user of an error, and probably throw an exception. |
java.lang.Object |
extFunction(java.lang.String ns,
java.lang.String funcName,
java.util.Vector argVec,
java.lang.Object methodKey)
Handle an extension function. |
java.lang.String |
findURIFromDoc(org.w3c.dom.Document owner)
Given a document, find the URL associated with that document. |
boolean |
functionAvailable(java.lang.String ns,
java.lang.String funcName)
Execute the function-available() function. |
java.lang.String |
getAcceptLanguage()
Get language variant that should be used, passed from servlet HTTP header. |
NodeCallback |
getCallback()
**Experimental** Get the callback that may be called by XPath as nodes are located. |
java.lang.Object |
getCallbackInfo()
Get the object that will be passed to the processLocatedNode method. |
XPathFactory |
getDefaultXPathFactory()
Get a factory to create XPaths. |
org.w3c.dom.Document |
getDocument()
Returns the document just parsed. |
org.w3c.dom.Document |
getDOMFactory()
Get the factory object required to create DOM nodes in the result tree. |
org.w3c.dom.Element |
getElementByID(java.lang.String id,
org.w3c.dom.Document doc)
Given an ID, return the element. |
org.xml.sax.ErrorHandler |
getErrorHandler()
Get the current error handler, if there is one. |
java.lang.String |
getExpandedAttributeName(org.w3c.dom.Attr attr)
Returns the attribute name with the namespace expanded. |
java.lang.String |
getExpandedElementName(org.w3c.dom.Element elem)
Returns the element name with the namespace expanded. |
int |
getIndent()
Get the amount to indent when indent-result="yes". |
java.lang.String |
getLocalNameOfNode(org.w3c.dom.Node n)
Returns the local name of the given node. |
java.lang.String |
getNamespaceForPrefix(java.lang.String prefix,
org.w3c.dom.Element namespaceContext)
Given a prefix and a namespace context, return the expanded namespace. |
java.lang.String |
getNamespaceOfNode(org.w3c.dom.Node n)
Returns the namespace of the given node. |
static java.lang.String |
getNodeData(org.w3c.dom.Node node)
Get the textual contents of the node. |
static void |
getNodeData(org.w3c.dom.Node node,
java.lang.StringBuffer buf)
Get the textual contents of the node. |
org.w3c.dom.NodeList |
getNodeSetByKey(org.w3c.dom.Node doc,
java.lang.String name,
java.lang.String ref,
PrefixResolver nscontext)
Given a valid element key, return the corresponding node list. |
org.w3c.dom.Node |
getParentOfNode(org.w3c.dom.Node node)
I have to write this silly, and expensive function, because the DOM WG decided that attributes don't have parents. |
java.lang.String |
getParserDescription()
Return a string suitible for telling the user what parser is being used. |
ProblemListener |
getProblemListener()
Set the current problem listener. |
boolean |
getProcessNamespaces()
Deprecated. |
org.w3c.dom.Node |
getRoot(org.w3c.dom.Node node)
Get the first unparented node in the ancestor chain. |
boolean |
getShouldExpandEntityRefs()
get whether or not to expand all entity references in the source and style trees. |
java.util.Hashtable |
getSourceDocsTable()
|
java.lang.String |
getSpecialCharacters()
Deprecated. |
boolean |
getThrowFoundIndex()
**For internal use only** ThrowFoundIndex tells if FoundIndex should be thrown if index is found. |
java.lang.String |
getUnparsedEntityURI(java.lang.String name,
org.w3c.dom.Document doc)
The getUnparsedEntityURI function returns the URI of the unparsed entity with the specified name in the same document as the context node (see [3.3 Unparsed Entities]). |
java.net.URL |
getURLFromString(java.lang.String urlString,
java.lang.String base)
Take a user string and try and parse XML, and also return the url. |
boolean |
getUseValidation()
If set to true, validation will be performed, if set to false, validation will not be performed. |
XObject |
getVariable(QName name)
Given a name, locate a variable in the current context, and return the Object. |
XLocator |
getXLocatorFromNode(org.w3c.dom.Node node)
**For advanced use only** Get an XLocator provider keyed by node. |
boolean |
isIgnorableWhitespace(org.w3c.dom.Text node)
Deprecated. |
void |
parse(org.xml.sax.InputSource source)
Parse an XML document. |
void |
parse(java.lang.String systemId)
Parse an XML document from a system identifier (URI). |
boolean |
problem(short where,
short classification,
org.w3c.dom.Node styleNode,
org.w3c.dom.Node sourceNode,
java.lang.String msg,
int lineNo,
int charOffset)
Function that is called when a problem event occurs. |
void |
reset()
Reset for new run. |
void |
setAcceptLanguage(java.lang.String acceptLanguage)
Set language variant that should be used, passed from servlet HTTP header. |
void |
setCallback(NodeCallback callback,
java.lang.Object callbackInfo)
**Experimental** Set a callback that may be called by XPath as nodes are located. |
void |
setDocumentHandler(org.xml.sax.DocumentHandler handler)
Allow an application to register a document event handler. |
void |
setDOMFactory(org.w3c.dom.Document domFactory)
Get the factory object required to create DOM nodes in the result tree. |
void |
setDTDHandler(org.xml.sax.DTDHandler handler)
Allow an application to register a DTD event handler. |
void |
setEntityResolver(org.xml.sax.EntityResolver resolver)
Allow an application to register a custom entity resolver. |
void |
setEnvSupport(XPathEnvSupport envSupport)
**For advanced use only** XPath environment support, which the liaison may aggregate back to in order to implement the XPathEnvSupport interface. |
void |
setErrorHandler(org.xml.sax.ErrorHandler handler)
Allow an application to register an error event handler. |
void |
setIndent(int i)
Set the amount to indent when indent-result="yes". |
void |
setLocale(java.util.Locale locale)
Allow an application to request a locale for errors and warnings. |
void |
setProblemListener(ProblemListener listener)
Set the current problem listener. |
void |
setProcessNamespaces(boolean processNamespaces)
Deprecated. |
void |
setShouldExpandEntityRefs(boolean b)
Set whether or not to expand all entity references in the source and style trees. |
void |
setSpecialCharacters(java.lang.String str)
Deprecated. |
void |
setThrowFoundIndex(boolean b)
**For internal use only** ThrowFoundIndex tells if FoundIndex should be thrown if index is found. |
void |
setUseValidation(boolean b)
If set to true, validation will be performed, if set to false, validation will not be performed. |
boolean |
shouldStripSourceNode(org.w3c.dom.Node textNode)
**For advanced use only** Tells, through the combination of the default-space attribute on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the xml:space attribute, whether or not extra whitespace should be stripped from the node. |
boolean |
supportsSAX()
Returns true if the liaison supports the SAX DocumentHandler interface. |
void |
toMarkup(org.w3c.dom.Document doc,
java.io.OutputStream ostream,
java.lang.String method,
java.lang.String version,
boolean doIndent,
int indent,
java.lang.String encoding,
java.lang.String mediaType,
java.lang.String doctypeSystem,
java.lang.String doctypePublic,
boolean omitXMLDeclaration,
boolean standalone,
java.lang.String[] cdataSectionElems)
Deprecated. |
void |
toMarkup(org.w3c.dom.Document doc,
java.io.Writer writer,
java.lang.String method,
java.lang.String version,
boolean doIndent,
int indent,
java.lang.String encoding,
java.lang.String mediaType,
java.lang.String doctypeSystem,
java.lang.String doctypePublic,
boolean omitXMLDeclaration,
boolean standalone,
java.lang.String[] cdataSectionElems)
Deprecated. |
void |
warn(int msg)
Warn the user of an problem. |
void |
warn(org.w3c.dom.Node sourceNode,
int msg)
Warn the user of an problem. |
void |
warn(org.w3c.dom.Node sourceNode,
int msg,
java.lang.Object[] args)
Warn the user of an problem. |
void |
warning(int msg)
Warn the user of an problem. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public java.lang.String m_attrSpecialChars
public java.util.Hashtable m_extensionFunctionNamespaces
extensions.html.
Constructor Detail |
public XMLParserLiaisonDefault(ProblemListener problemListener)
public XMLParserLiaisonDefault()
Method Detail |
public void setProblemListener(ProblemListener listener)
public ProblemListener getProblemListener()
public void reset()
public void setCallback(NodeCallback callback, java.lang.Object callbackInfo)
callback
- Interface that implements the processLocatedNode method.callbackInfo
- Object that will be passed to the processLocatedNode method.public NodeCallback getCallback()
public java.lang.Object getCallbackInfo()
public org.w3c.dom.Document getDocument()
public void checkNode(org.w3c.dom.Node node) throws org.xml.sax.SAXException
public void copyFromOtherLiaison(XMLParserLiaisonDefault from) throws org.xml.sax.SAXException
public void setLocale(java.util.Locale locale) throws org.xml.sax.SAXException
SAX parsers are not required to provide localisation for errors and warnings; if they cannot support the requested locale, however, they must throw a SAX exception. Applications may not request a locale change in the middle of a parse.
locale
- A Java Locale object.SAXException
,
SAXParseException
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
If the application does not register an entity resolver, the SAX parser will resolve system identifiers and open connections to entities itself (this is the default behaviour implemented in HandlerBase).
Applications may register a new or different entity resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.
resolver
- The object for resolving entities.EntityResolver
,
HandlerBase
public void setDTDHandler(org.xml.sax.DTDHandler handler)
If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored (this is the default behaviour implemented by HandlerBase).
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
handler
- The DTD handler.DTDHandler
,
HandlerBase
public void setDocumentHandler(org.xml.sax.DocumentHandler handler)
If the application does not register a document handler, all document events reported by the SAX parser will be silently ignored (this is the default behaviour implemented by HandlerBase).
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
handler
- The document handler.DocumentHandler
,
HandlerBase
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
If the application does not register an error event handler, all error events reported by the SAX parser will be silently ignored, except for fatalError, which will throw a SAXException (this is the default behaviour implemented by HandlerBase).
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
handler
- The error handler.ErrorHandler
,
SAXException
,
HandlerBase
public void parse(org.xml.sax.InputSource source) throws org.xml.sax.SAXException, java.io.IOException
The application can use this method to instruct the SAX parser to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).
Applications may not invoke this method while a parse is in progress (they should create a new Parser instead for each additional XML document). Once a parse is complete, an application may reuse the same Parser object, possibly with a different input source.
This method needs to be overridden by a derived class.
source
- The input source for the top-level of the
XML document.InputSource
,
parse(java.lang.String)
,
setEntityResolver(org.xml.sax.EntityResolver)
,
setDTDHandler(org.xml.sax.DTDHandler)
,
setDocumentHandler(org.xml.sax.DocumentHandler)
,
setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException
This method is a shortcut for the common case of reading a document from a system identifier. It is the exact equivalent of the following:
parse(new InputSource(systemId));
If the system identifier is a URL, it must be fully resolved by the application before it is passed to the parser.
systemId
- The system identifier (URI).parse(org.xml.sax.InputSource)
public boolean supportsSAX()
public XPathFactory getDefaultXPathFactory()
public void setProcessNamespaces(boolean processNamespaces)
public boolean getProcessNamespaces()
public boolean shouldStripSourceNode(org.w3c.dom.Node textNode) throws org.xml.sax.SAXException
textNode
- A text node from the source tree.public java.lang.String getParserDescription()
public int getIndent()
public void setIndent(int i)
public void setAcceptLanguage(java.lang.String acceptLanguage)
public java.lang.String getAcceptLanguage()
public boolean getShouldExpandEntityRefs()
public void setShouldExpandEntityRefs(boolean b)
public boolean getUseValidation()
public void setUseValidation(boolean b)
public void setSpecialCharacters(java.lang.String str)
public java.lang.String getSpecialCharacters()
public void setEnvSupport(XPathEnvSupport envSupport)
public java.net.URL getURLFromString(java.lang.String urlString, java.lang.String base) throws org.xml.sax.SAXException
public org.w3c.dom.Document createDocument()
public java.lang.String getNamespaceForPrefix(java.lang.String prefix, org.w3c.dom.Element namespaceContext)
public java.lang.String getNamespaceOfNode(org.w3c.dom.Node n)
public java.lang.String getLocalNameOfNode(org.w3c.dom.Node n)
public java.lang.String getExpandedElementName(org.w3c.dom.Element elem)
public java.lang.String getExpandedAttributeName(org.w3c.dom.Attr attr)
public boolean isIgnorableWhitespace(org.w3c.dom.Text node)
public org.w3c.dom.Node getParentOfNode(org.w3c.dom.Node node) throws java.lang.RuntimeException
public org.w3c.dom.Element getElementByID(java.lang.String id, org.w3c.dom.Document doc)
public java.lang.String getUnparsedEntityURI(java.lang.String name, org.w3c.dom.Document doc)
public org.w3c.dom.Node getRoot(org.w3c.dom.Node node)
public void setDOMFactory(org.w3c.dom.Document domFactory)
public org.w3c.dom.Document getDOMFactory()
public static java.lang.String getNodeData(org.w3c.dom.Node node)
public static void getNodeData(org.w3c.dom.Node node, java.lang.StringBuffer buf)
public void toMarkup(org.w3c.dom.Document doc, java.io.Writer writer, java.lang.String method, java.lang.String version, boolean doIndent, int indent, java.lang.String encoding, java.lang.String mediaType, java.lang.String doctypeSystem, java.lang.String doctypePublic, boolean omitXMLDeclaration, boolean standalone, java.lang.String[] cdataSectionElems) throws java.lang.Exception
public void toMarkup(org.w3c.dom.Document doc, java.io.OutputStream ostream, java.lang.String method, java.lang.String version, boolean doIndent, int indent, java.lang.String encoding, java.lang.String mediaType, java.lang.String doctypeSystem, java.lang.String doctypePublic, boolean omitXMLDeclaration, boolean standalone, java.lang.String[] cdataSectionElems) throws java.lang.Exception
public boolean problem(short where, short classification, org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, java.lang.String msg, int lineNo, int charOffset)
where
- Either and XMLPARSER, XSLPROCESSOR, or QUERYENGINE.classification
- Either ERROR or WARNING.styleNode
- The style tree node where the problem
occurred. May be null.sourceNode
- The source tree node where the problem
occurred. May be null.msg
- A string message explaining the problem.lineNo
- The line number where the problem occurred,
if it is known. May be zero.charOffset
- The character offset where the problem,
occurred if it is known. May be zero.public void warning(int msg)
public void warn(int msg)
public void warn(org.w3c.dom.Node sourceNode, int msg)
public void warn(org.w3c.dom.Node sourceNode, int msg, java.lang.Object[] args)
public void error(int msg) throws org.xml.sax.SAXException
public void error(org.w3c.dom.Node sourceNode, int msg) throws org.xml.sax.SAXException
public void error(org.w3c.dom.Node sourceNode, int msg, java.lang.Object[] args) throws org.xml.sax.SAXException
public org.w3c.dom.NodeList getNodeSetByKey(org.w3c.dom.Node doc, java.lang.String name, java.lang.String ref, PrefixResolver nscontext) throws org.xml.sax.SAXException
public XObject getVariable(QName name) throws org.xml.sax.SAXException
public void addExtensionNamespace(java.lang.String uri, ExtensionFunctionHandler extNS)
uri
- the URI for the extension.extNS
- the extension handler.public void addExtensionElementNamespace(java.lang.String uri, ExtensionFunctionHandler extNS)
uri
- the URI for the extension.extNS
- the extension handler.public boolean functionAvailable(java.lang.String ns, java.lang.String funcName)
ns
- the URI of namespace in which the function is neededfuncName
- the function name being testedpublic boolean elementAvailable(java.lang.String ns, java.lang.String funcName)
ns
- the URI of namespace in which the function is neededfuncName
- the function name being testedpublic java.lang.Object extFunction(java.lang.String ns, java.lang.String funcName, java.util.Vector argVec, java.lang.Object methodKey) throws org.xml.sax.SAXException
ns
- the URI of namespace in which the function is neededfuncName
- the function name being calledargVec
- arguments to the function in a vectorpublic java.util.Hashtable getSourceDocsTable()
public java.lang.String findURIFromDoc(org.w3c.dom.Document owner)
owner
- Document that was previously processed by this liaison.public void associateXLocatorToNode(org.w3c.dom.Node node, XLocator xlocator)
public XLocator createXLocatorHandler()
public XLocator getXLocatorFromNode(org.w3c.dom.Node node)
public boolean getThrowFoundIndex()
public void setThrowFoundIndex(boolean b)
public org.xml.sax.ErrorHandler getErrorHandler()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |