net.sf.saxon.type
Class RegexTranslator
java.lang.Object
net.sf.saxon.type.RegexTranslator
- public class RegexTranslator
- extends Object
This class translates XML Schema regex syntax into JDK 1.4 regex syntax.
Author: James Clark
Method Summary |
static void |
main(String[] args)
|
static String |
translate(String regexp,
boolean xpath)
Translates a regular expression in the syntax of XML Schemas Part 2 into a regular
expression in the syntax of java.util.regex.Pattern . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CATEGORY_NAMES
static final String CATEGORY_NAMES
- See Also:
- Constant Field Values
CATEGORY_RANGES
static final int[][] CATEGORY_RANGES
NMSTRT_INCLUDES
static final String NMSTRT_INCLUDES
- See Also:
- Constant Field Values
NMSTRT_EXCLUDE_RANGES
static final String NMSTRT_EXCLUDE_RANGES
- See Also:
- Constant Field Values
NMSTRT_CATEGORIES
static final String NMSTRT_CATEGORIES
- See Also:
- Constant Field Values
NMCHAR_INCLUDES
static final String NMCHAR_INCLUDES
- See Also:
- Constant Field Values
NMCHAR_EXCLUDE_RANGES
static final String NMCHAR_EXCLUDE_RANGES
- See Also:
- Constant Field Values
NMCHAR_CATEGORIES
static final String NMCHAR_CATEGORIES
- See Also:
- Constant Field Values
NONE
static final int NONE
- See Also:
- Constant Field Values
SOME
static final int SOME
- See Also:
- Constant Field Values
ALL
static final int ALL
- See Also:
- Constant Field Values
SURROGATES1_CLASS
static final String SURROGATES1_CLASS
- See Also:
- Constant Field Values
SURROGATES2_CLASS
static final String SURROGATES2_CLASS
- See Also:
- Constant Field Values
NOT_ALLOWED_CLASS
static final String NOT_ALLOWED_CLASS
- See Also:
- Constant Field Values
translate
public static String translate(String regexp,
boolean xpath)
throws RegexTranslator.RegexSyntaxException
- Translates a regular expression in the syntax of XML Schemas Part 2 into a regular
expression in the syntax of
java.util.regex.Pattern
. The translation
assumes that the string to be matched against the regex uses surrogate pairs correctly.
If the string comes from XML content, a conforming XML parser will automatically
check this; if the string comes from elsewhere, it may be necessary to check
surrogate usage before matching.
- Parameters:
regexp
- a String containing a regular expression in the syntax of XML Schemas Part 2xpath
- a boolean indicating whether the XPath 2.0 F+O extensions to the schema
regex syntax are permitted
- Returns:
- a String containing a regular expression in the syntax of java.util.regex.Pattern
- Throws:
RegexTranslator.RegexSyntaxException
- if regexp
is not a regular expression in the
syntax of XML Schemas Part 2- See Also:
Pattern
,
XML Schema Part 2
main
public static void main(String[] args)
throws RegexTranslator.RegexSyntaxException
- Throws:
RegexTranslator.RegexSyntaxException