com.thaiopensource.relaxng.impl
Class SchemaBuilderImpl
java.lang.Object
com.thaiopensource.relaxng.impl.SchemaBuilderImpl
- All Implemented Interfaces:
- Annotations, CommentList, ElementAnnotationBuilder, SchemaBuilder
public class SchemaBuilderImpl
- extends Object
- implements SchemaBuilder, ElementAnnotationBuilder, CommentList
Method Summary |
void |
addAttribute(String ns,
String localName,
String prefix,
String value,
Location loc)
|
void |
addComment(CommentList comments)
Adds comments following the last initial child element annotation. |
void |
addComment(String value,
Location loc)
|
void |
addElement(ParsedElementAnnotation ea)
|
void |
addLeadingComment(CommentList comments)
|
void |
addText(String value,
Location loc,
CommentList comments)
|
ParsedNameClass |
annotate(ParsedNameClass nc,
Annotations anno)
|
ParsedPattern |
annotate(ParsedPattern p,
Annotations anno)
|
ParsedNameClass |
annotateAfter(ParsedNameClass nc,
ParsedElementAnnotation e)
|
ParsedPattern |
annotateAfter(ParsedPattern p,
ParsedElementAnnotation e)
|
ParsedNameClass |
commentAfter(ParsedNameClass nc,
CommentList comments)
|
ParsedPattern |
commentAfter(ParsedPattern p,
CommentList comments)
|
private void |
error(SAXParseException message)
|
private void |
error(String key,
Locator loc)
|
private void |
error(String key,
String arg,
Locator loc)
|
private void |
error(String key,
String arg1,
String arg2,
Locator loc)
|
private void |
error(String key,
String arg1,
String arg2,
String arg3,
Locator loc)
|
private Pattern |
expandPattern(Pattern pattern)
|
static PatternFuture |
installHandlers(ParseReceiver parser,
XMLReader xr,
ErrorHandler eh,
DatatypeLibraryFactory dlf,
SchemaPatternBuilder pb)
|
Annotations |
makeAnnotations(CommentList comments,
Context context)
|
ParsedNameClass |
makeAnyName(Location loc,
Annotations anno)
|
ParsedNameClass |
makeAnyName(ParsedNameClass except,
Location loc,
Annotations anno)
Caller must enforce constraints on except. |
ParsedPattern |
makeAttribute(ParsedNameClass nc,
ParsedPattern p,
Location loc,
Annotations anno)
|
ParsedNameClass |
makeChoice(ParsedNameClass[] nameClasses,
int nNameClasses,
Location loc,
Annotations anno)
|
ParsedPattern |
makeChoice(ParsedPattern[] patterns,
int nPatterns,
Location loc,
Annotations anno)
|
CommentList |
makeCommentList()
|
DataPatternBuilder |
makeDataPatternBuilder(String datatypeLibrary,
String type,
Location loc)
|
ParsedPattern |
makeElement(ParsedNameClass nc,
ParsedPattern p,
Location loc,
Annotations anno)
|
ParsedElementAnnotation |
makeElementAnnotation()
|
ElementAnnotationBuilder |
makeElementAnnotationBuilder(String ns,
String localName,
String prefix,
Location loc,
CommentList comments,
Context context)
|
ParsedPattern |
makeEmpty(Location loc,
Annotations anno)
|
ParsedNameClass |
makeErrorNameClass()
|
ParsedPattern |
makeErrorPattern()
|
ParsedPattern |
makeExternalRef(String uri,
String ns,
Scope scope,
Location loc,
Annotations anno)
|
Grammar |
makeGrammar(Scope parent)
|
ParsedPattern |
makeGroup(ParsedPattern[] patterns,
int nPatterns,
Location loc,
Annotations anno)
|
ParsedPattern |
makeInterleave(ParsedPattern[] patterns,
int nPatterns,
Location loc,
Annotations anno)
|
ParsedPattern |
makeList(ParsedPattern p,
Location loc,
Annotations anno)
|
Location |
makeLocation(String systemId,
int lineNumber,
int columnNumber)
|
ParsedPattern |
makeMixed(ParsedPattern p,
Location loc,
Annotations anno)
|
ParsedNameClass |
makeName(String ns,
String localName,
String prefix,
Location loc,
Annotations anno)
|
ParsedPattern |
makeNotAllowed(Location loc,
Annotations anno)
|
ParsedNameClass |
makeNsName(String ns,
Location loc,
Annotations anno)
|
ParsedNameClass |
makeNsName(String ns,
ParsedNameClass except,
Location loc,
Annotations anno)
Caller must enforce constraints on except. |
ParsedPattern |
makeOneOrMore(ParsedPattern p,
Location loc,
Annotations anno)
|
ParsedPattern |
makeOptional(ParsedPattern p,
Location loc,
Annotations anno)
|
ParsedPattern |
makeText(Location loc,
Annotations anno)
|
ParsedPattern |
makeValue(String datatypeLibrary,
String type,
String value,
Context context,
String ns,
Location loc,
Annotations anno)
|
ParsedPattern |
makeZeroOrMore(ParsedPattern p,
Location loc,
Annotations anno)
|
private void |
noteError()
|
static Pattern |
parse(Parseable parseable,
ErrorHandler eh,
DatatypeLibraryFactory datatypeLibraryFactory,
SchemaPatternBuilder pb,
boolean isAttributesPattern)
|
private String |
resolveInherit(String ns)
|
(package private) static RuntimeException |
unwrapBuildException(BuildException e)
|
boolean |
usesComments()
|
private ParsedPattern |
wrapAttributesPattern(ParsedPattern pattern)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
parent
private final SchemaBuilderImpl parent
hadError
private boolean hadError
subParser
private final SubParser subParser
pb
private final SchemaPatternBuilder pb
datatypeLibraryFactory
private final DatatypeLibraryFactory datatypeLibraryFactory
inheritNs
private final String inheritNs
eh
private final ErrorHandler eh
openIncludes
private final SchemaBuilderImpl.OpenIncludes openIncludes
attributeNameClassChecker
private final AttributeNameClassChecker attributeNameClassChecker
localizer
static final Localizer localizer
SchemaBuilderImpl
private SchemaBuilderImpl(SubParser subParser,
ErrorHandler eh,
DatatypeLibraryFactory datatypeLibraryFactory,
SchemaPatternBuilder pb)
SchemaBuilderImpl
private SchemaBuilderImpl(String inheritNs,
String uri,
SchemaBuilderImpl parent)
parse
public static Pattern parse(Parseable parseable,
ErrorHandler eh,
DatatypeLibraryFactory datatypeLibraryFactory,
SchemaPatternBuilder pb,
boolean isAttributesPattern)
throws IncorrectSchemaException,
IOException,
SAXException
- Throws:
IncorrectSchemaException
IOException
SAXException
installHandlers
public static PatternFuture installHandlers(ParseReceiver parser,
XMLReader xr,
ErrorHandler eh,
DatatypeLibraryFactory dlf,
SchemaPatternBuilder pb)
throws SAXException
- Throws:
SAXException
unwrapBuildException
static RuntimeException unwrapBuildException(BuildException e)
throws SAXException,
IncorrectSchemaException,
IOException
- Throws:
SAXException
IncorrectSchemaException
IOException
wrapAttributesPattern
private ParsedPattern wrapAttributesPattern(ParsedPattern pattern)
expandPattern
private Pattern expandPattern(Pattern pattern)
throws IllegalSchemaException,
BuildException
- Throws:
IllegalSchemaException
BuildException
makeChoice
public ParsedPattern makeChoice(ParsedPattern[] patterns,
int nPatterns,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeChoice
in interface SchemaBuilder
- Throws:
BuildException
makeInterleave
public ParsedPattern makeInterleave(ParsedPattern[] patterns,
int nPatterns,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeInterleave
in interface SchemaBuilder
- Throws:
BuildException
makeGroup
public ParsedPattern makeGroup(ParsedPattern[] patterns,
int nPatterns,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeGroup
in interface SchemaBuilder
- Throws:
BuildException
makeOneOrMore
public ParsedPattern makeOneOrMore(ParsedPattern p,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeOneOrMore
in interface SchemaBuilder
- Throws:
BuildException
makeZeroOrMore
public ParsedPattern makeZeroOrMore(ParsedPattern p,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeZeroOrMore
in interface SchemaBuilder
- Throws:
BuildException
makeOptional
public ParsedPattern makeOptional(ParsedPattern p,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeOptional
in interface SchemaBuilder
- Throws:
BuildException
makeList
public ParsedPattern makeList(ParsedPattern p,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeList
in interface SchemaBuilder
- Throws:
BuildException
makeMixed
public ParsedPattern makeMixed(ParsedPattern p,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeMixed
in interface SchemaBuilder
- Throws:
BuildException
makeEmpty
public ParsedPattern makeEmpty(Location loc,
Annotations anno)
- Specified by:
makeEmpty
in interface SchemaBuilder
makeNotAllowed
public ParsedPattern makeNotAllowed(Location loc,
Annotations anno)
- Specified by:
makeNotAllowed
in interface SchemaBuilder
makeText
public ParsedPattern makeText(Location loc,
Annotations anno)
- Specified by:
makeText
in interface SchemaBuilder
makeErrorPattern
public ParsedPattern makeErrorPattern()
- Specified by:
makeErrorPattern
in interface SchemaBuilder
makeErrorNameClass
public ParsedNameClass makeErrorNameClass()
- Specified by:
makeErrorNameClass
in interface SchemaBuilder
makeAttribute
public ParsedPattern makeAttribute(ParsedNameClass nc,
ParsedPattern p,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeAttribute
in interface SchemaBuilder
- Throws:
BuildException
makeElement
public ParsedPattern makeElement(ParsedNameClass nc,
ParsedPattern p,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeElement
in interface SchemaBuilder
- Throws:
BuildException
makeDataPatternBuilder
public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary,
String type,
Location loc)
throws BuildException
- Specified by:
makeDataPatternBuilder
in interface SchemaBuilder
- Throws:
BuildException
makeValue
public ParsedPattern makeValue(String datatypeLibrary,
String type,
String value,
Context context,
String ns,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeValue
in interface SchemaBuilder
- Throws:
BuildException
makeGrammar
public Grammar makeGrammar(Scope parent)
- Specified by:
makeGrammar
in interface SchemaBuilder
annotate
public ParsedPattern annotate(ParsedPattern p,
Annotations anno)
throws BuildException
- Specified by:
annotate
in interface SchemaBuilder
- Throws:
BuildException
annotate
public ParsedNameClass annotate(ParsedNameClass nc,
Annotations anno)
throws BuildException
- Specified by:
annotate
in interface SchemaBuilder
- Throws:
BuildException
annotateAfter
public ParsedPattern annotateAfter(ParsedPattern p,
ParsedElementAnnotation e)
throws BuildException
- Specified by:
annotateAfter
in interface SchemaBuilder
- Throws:
BuildException
annotateAfter
public ParsedNameClass annotateAfter(ParsedNameClass nc,
ParsedElementAnnotation e)
throws BuildException
- Specified by:
annotateAfter
in interface SchemaBuilder
- Throws:
BuildException
commentAfter
public ParsedPattern commentAfter(ParsedPattern p,
CommentList comments)
throws BuildException
- Specified by:
commentAfter
in interface SchemaBuilder
- Throws:
BuildException
commentAfter
public ParsedNameClass commentAfter(ParsedNameClass nc,
CommentList comments)
throws BuildException
- Specified by:
commentAfter
in interface SchemaBuilder
- Throws:
BuildException
makeExternalRef
public ParsedPattern makeExternalRef(String uri,
String ns,
Scope scope,
Location loc,
Annotations anno)
throws BuildException
- Specified by:
makeExternalRef
in interface SchemaBuilder
- Throws:
BuildException
makeChoice
public ParsedNameClass makeChoice(ParsedNameClass[] nameClasses,
int nNameClasses,
Location loc,
Annotations anno)
- Specified by:
makeChoice
in interface SchemaBuilder
makeName
public ParsedNameClass makeName(String ns,
String localName,
String prefix,
Location loc,
Annotations anno)
- Specified by:
makeName
in interface SchemaBuilder
makeNsName
public ParsedNameClass makeNsName(String ns,
Location loc,
Annotations anno)
- Specified by:
makeNsName
in interface SchemaBuilder
makeNsName
public ParsedNameClass makeNsName(String ns,
ParsedNameClass except,
Location loc,
Annotations anno)
- Description copied from interface:
SchemaBuilder
- Caller must enforce constraints on except.
- Specified by:
makeNsName
in interface SchemaBuilder
makeAnyName
public ParsedNameClass makeAnyName(Location loc,
Annotations anno)
- Specified by:
makeAnyName
in interface SchemaBuilder
makeAnyName
public ParsedNameClass makeAnyName(ParsedNameClass except,
Location loc,
Annotations anno)
- Description copied from interface:
SchemaBuilder
- Caller must enforce constraints on except.
- Specified by:
makeAnyName
in interface SchemaBuilder
resolveInherit
private final String resolveInherit(String ns)
makeLocation
public Location makeLocation(String systemId,
int lineNumber,
int columnNumber)
- Specified by:
makeLocation
in interface SchemaBuilder
makeAnnotations
public Annotations makeAnnotations(CommentList comments,
Context context)
- Specified by:
makeAnnotations
in interface SchemaBuilder
makeElementAnnotationBuilder
public ElementAnnotationBuilder makeElementAnnotationBuilder(String ns,
String localName,
String prefix,
Location loc,
CommentList comments,
Context context)
- Specified by:
makeElementAnnotationBuilder
in interface SchemaBuilder
makeCommentList
public CommentList makeCommentList()
- Specified by:
makeCommentList
in interface SchemaBuilder
addComment
public void addComment(String value,
Location loc)
throws BuildException
- Specified by:
addComment
in interface CommentList
- Throws:
BuildException
addAttribute
public void addAttribute(String ns,
String localName,
String prefix,
String value,
Location loc)
- Specified by:
addAttribute
in interface Annotations
addElement
public void addElement(ParsedElementAnnotation ea)
- Specified by:
addElement
in interface Annotations
addComment
public void addComment(CommentList comments)
throws BuildException
- Description copied from interface:
Annotations
- Adds comments following the last initial child element annotation.
- Specified by:
addComment
in interface Annotations
- Throws:
BuildException
addLeadingComment
public void addLeadingComment(CommentList comments)
throws BuildException
- Specified by:
addLeadingComment
in interface Annotations
- Throws:
BuildException
addText
public void addText(String value,
Location loc,
CommentList comments)
- Specified by:
addText
in interface ElementAnnotationBuilder
makeElementAnnotation
public ParsedElementAnnotation makeElementAnnotation()
- Specified by:
makeElementAnnotation
in interface ElementAnnotationBuilder
usesComments
public boolean usesComments()
- Specified by:
usesComments
in interface SchemaBuilder
error
private void error(SAXParseException message)
throws BuildException
- Throws:
BuildException
error
private void error(String key,
Locator loc)
throws BuildException
- Throws:
BuildException
error
private void error(String key,
String arg,
Locator loc)
throws BuildException
- Throws:
BuildException
error
private void error(String key,
String arg1,
String arg2,
Locator loc)
throws BuildException
- Throws:
BuildException
error
private void error(String key,
String arg1,
String arg2,
String arg3,
Locator loc)
throws BuildException
- Throws:
BuildException
noteError
private void noteError()