public class SchemaBuilderImpl extends Object implements SchemaBuilder, ElementAnnotationBuilder, CommentList
Constructor and Description |
---|
SchemaBuilderImpl(ErrorHandler eh) |
SchemaBuilderImpl(ErrorHandler eh,
DatatypeLibraryFactory datatypeLibraryFactory,
SchemaPatternBuilder pb) |
public SchemaBuilderImpl(ErrorHandler eh)
eh
- Error handler to receive errors while building the schema.public SchemaBuilderImpl(ErrorHandler eh, DatatypeLibraryFactory datatypeLibraryFactory, SchemaPatternBuilder pb)
eh
- Error handler to receive errors while building the schema.datatypeLibraryFactory
- This is consulted to locate datatype
libraries.pb
- Used to build patterns.public ParsedPattern expandPattern(ParsedPattern _pattern) throws BuildException, IllegalSchemaException
SchemaBuilder
This hook typically allows as SchemaBuilder
to expand
notAllowed (if it's following the simplification as in the spec.)
expandPattern
in interface SchemaBuilder
BuildException
IllegalSchemaException
public NameClassBuilder getNameClassBuilder()
SchemaBuilder
NameClassBuilder
, which is used to build name
classes for this SchemaBuilder
. The
NameClass
es that are built will then be
fed into this SchemaBuilder
to further build RELAX NG patterns.getNameClassBuilder
in interface SchemaBuilder
public ParsedPattern makeChoice(List patterns, Location loc, Annotations anno) throws BuildException
makeChoice
in interface SchemaBuilder
BuildException
public ParsedPattern makeInterleave(List patterns, Location loc, Annotations anno) throws BuildException
makeInterleave
in interface SchemaBuilder
BuildException
public ParsedPattern makeGroup(List patterns, Location loc, Annotations anno) throws BuildException
makeGroup
in interface SchemaBuilder
BuildException
public ParsedPattern makeOneOrMore(ParsedPattern p, Location loc, Annotations anno) throws BuildException
makeOneOrMore
in interface SchemaBuilder
BuildException
public ParsedPattern makeZeroOrMore(ParsedPattern p, Location loc, Annotations anno) throws BuildException
makeZeroOrMore
in interface SchemaBuilder
BuildException
public ParsedPattern makeOptional(ParsedPattern p, Location loc, Annotations anno) throws BuildException
makeOptional
in interface SchemaBuilder
BuildException
public ParsedPattern makeList(ParsedPattern p, Location loc, Annotations anno) throws BuildException
makeList
in interface SchemaBuilder
BuildException
public ParsedPattern makeMixed(ParsedPattern p, Location loc, Annotations anno) throws BuildException
makeMixed
in interface SchemaBuilder
BuildException
public ParsedPattern makeEmpty(Location loc, Annotations anno)
makeEmpty
in interface SchemaBuilder
public ParsedPattern makeNotAllowed(Location loc, Annotations anno)
makeNotAllowed
in interface SchemaBuilder
public ParsedPattern makeText(Location loc, Annotations anno)
makeText
in interface SchemaBuilder
public ParsedPattern makeErrorPattern()
makeErrorPattern
in interface SchemaBuilder
public ParsedPattern makeAttribute(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno) throws BuildException
makeAttribute
in interface SchemaBuilder
BuildException
public ParsedPattern makeElement(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno) throws BuildException
makeElement
in interface SchemaBuilder
BuildException
public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, Location loc) throws BuildException
makeDataPatternBuilder
in interface SchemaBuilder
BuildException
public ParsedPattern makeValue(String datatypeLibrary, String type, String value, Context context, String ns, Location loc, Annotations anno) throws BuildException
makeValue
in interface SchemaBuilder
BuildException
public Grammar makeGrammar(Scope parent)
makeGrammar
in interface SchemaBuilder
parent
- The parent scope. null if there's no parent scope.
For example, if the complete document looks like the following:
<grammar>
<start><element name="root"><empty/></element></start>
</grammar>
Then when the outer-most Grammar
is created, it will
receive the null
parent.public ParsedPattern annotate(ParsedPattern p, Annotations anno) throws BuildException
SchemaBuilder
<element name="foo"> <!-- this becomes 'P' -->
<foreign:annotation /> <!-- this becomes 'A' -->
...
</element>
annotate
in interface SchemaBuilder
BuildException
public ParsedPattern annotateAfter(ParsedPattern p, ParsedElementAnnotation e) throws BuildException
SchemaBuilder
<element name="foo">
<empty /> <!-- this becomes 'P' -->
<foreign:annotation /> <!-- this becomes 'E' -->
</element>
annotateAfter
in interface SchemaBuilder
BuildException
public ParsedPattern commentAfter(ParsedPattern p, CommentList comments) throws BuildException
commentAfter
in interface SchemaBuilder
BuildException
public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope, Location loc, Annotations anno) throws BuildException
makeExternalRef
in interface SchemaBuilder
current
- Current grammar that we are parsing. This is what contains
externalRef.scope
- The parent scope. null if there's no parent scope.
See SchemaBuilder.makeGrammar(Scope)
for more details about
when this parameter can be null.BuildException
public Location makeLocation(String systemId, int lineNumber, int columnNumber)
makeLocation
in interface SchemaBuilder
public Annotations makeAnnotations(CommentList comments, Context context)
SchemaBuilder
Annotations
object to parse annotations on patterns.makeAnnotations
in interface SchemaBuilder
public ElementAnnotationBuilder makeElementAnnotationBuilder(String ns, String localName, String prefix, Location loc, CommentList comments, Context context)
makeElementAnnotationBuilder
in interface SchemaBuilder
public CommentList makeCommentList()
makeCommentList
in interface SchemaBuilder
public void addComment(String value, Location loc) throws BuildException
addComment
in interface CommentList
BuildException
public void addAttribute(String ns, String localName, String prefix, String value, Location loc)
Annotations
addAttribute
in interface Annotations
public void addElement(ParsedElementAnnotation ea)
Annotations
addElement
in interface Annotations
public void addComment(CommentList comments) throws BuildException
Annotations
addComment
in interface Annotations
BuildException
public void addLeadingComment(CommentList comments) throws BuildException
addLeadingComment
in interface Annotations
BuildException
public ParsedElementAnnotation makeElementAnnotation()
ElementAnnotationBuilder
makeElementAnnotation
in interface ElementAnnotationBuilder
public void addText(String value, Location loc, CommentList comments) throws BuildException
ElementAnnotationBuilder
addText
in interface ElementAnnotationBuilder
BuildException
public boolean usesComments()
SchemaBuilder
SchemaBuilder
is interested in actually parsing
comments, this method returns true.
Returning false allows the schema parser to speed up the processing by skiping comment-related handlings.
usesComments
in interface SchemaBuilder
Copyright © 2021 JBoss by Red Hat. All rights reserved.