Package net.sf.saxon.om
Class QNameParser
- java.lang.Object
- 
- net.sf.saxon.om.QNameParser
 
- 
 public class QNameParser extends java.lang.ObjectParser to handle QNames in either lexical QName or EQName syntax, including resolving any prefix against a URIResolver. The parser can be instantiated with various options to control the returned error code, the handling of defaults, etc. The QNameParser is immutable; its properties are set using thewithProperty()fluent API style.
- 
- 
Constructor SummaryConstructors Constructor Description QNameParser(NamespaceResolver resolver)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description StructuredQNameparse(java.lang.String lexicalName, java.lang.String defaultNS)Make a structured QName from a lexical QName, using a supplied NamespaceResolver to resolve the prefix.QNameParserwithAcceptEQName(boolean acceptEQName)Say whether URI-qualified names inQ{uri}localformat should be acceptedQNameParserwithErrorOnBadSyntax(java.lang.String code)Say what error code should be thrown when the QName syntax is invalidQNameParserwithErrorOnUnresolvedPrefix(java.lang.String code)Say what error code should be thrown when the prefix is undeclaredQNameParserwithNamespaceResolver(NamespaceResolver resolver)Set the namespace resolver to be usedQNameParserwithUnescaper(XQueryParser.Unescaper unescaper)Supply a callback used to unescape special characters appearing in the URI part of an EQName
 
- 
- 
- 
Constructor Detail- 
QNameParserpublic QNameParser(NamespaceResolver resolver) 
 
- 
 - 
Method Detail- 
withNamespaceResolverpublic QNameParser withNamespaceResolver(NamespaceResolver resolver) Set the namespace resolver to be used- Parameters:
- resolver- the namespace resolver
- Returns:
- a new QNameParser using the specified NamespaceResolver
 
 - 
withAcceptEQNamepublic QNameParser withAcceptEQName(boolean acceptEQName) Say whether URI-qualified names inQ{uri}localformat should be accepted- Parameters:
- acceptEQName- true if extended QName syntax is accepted
- Returns:
- a new QNameParser with the requested properties
 
 - 
withErrorOnBadSyntaxpublic QNameParser withErrorOnBadSyntax(java.lang.String code) Say what error code should be thrown when the QName syntax is invalid- Parameters:
- code- the error code to be thrown
- Returns:
- a new QNameParser with the requested properties
 
 - 
withErrorOnUnresolvedPrefixpublic QNameParser withErrorOnUnresolvedPrefix(java.lang.String code) Say what error code should be thrown when the prefix is undeclared- Parameters:
- code- the error code to be thrown
- Returns:
- a new QNameParser with the requested properties
 
 - 
withUnescaperpublic QNameParser withUnescaper(XQueryParser.Unescaper unescaper) Supply a callback used to unescape special characters appearing in the URI part of an EQName- Parameters:
- unescaper- the callback to be used
- Returns:
- a new QNameParser with the requested properties
 
 - 
parsepublic StructuredQName parse(java.lang.String lexicalName, java.lang.String defaultNS) throws XPathException Make a structured QName from a lexical QName, using a supplied NamespaceResolver to resolve the prefix. The local part of the QName is checked for validity; the prefix is not checked, on the grounds that an invalid prefix will fail to resolve to a URI.- Parameters:
- lexicalName- the QName as a lexical name (prefix:local)
- defaultNS- the default namespace to use if there is no prefix
- Returns:
- the StructuredQName object corresponding to this lexical QName
- Throws:
- XPathException- if the namespace prefix is not in scope or if the value is lexically invalid. Error code FONS0004 is set if the namespace prefix has not been declared; error code FOCA0002 is set if the name is lexically invalid. These may need to be changed on return depending on the caller's requirements.
 
 
- 
 
-