Package org.kohsuke.rngom.parse.host
Class SchemaBuilderHost
java.lang.Object
org.kohsuke.rngom.parse.host.Base
org.kohsuke.rngom.parse.host.SchemaBuilderHost
- All Implemented Interfaces:
SchemaBuilder
- Direct Known Subclasses:
CheckingSchemaBuilder
- Author:
- Kohsuke Kawaguchi (kk@kohsuke.org)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionannotate
(ParsedPattern _p, Annotations _anno) Called when annotation is found right inside a pattern such as,Called when element annotation is found after a pattern.commentAfter
(ParsedPattern _p, CommentList _comments) Called after all the parsing is done.Returns theNameClassBuilder
, which is used to build name classes for thisSchemaBuilder
.makeAnnotations
(CommentList _comments, Context context) CreatesAnnotations
object to parse annotations on patterns.makeAttribute
(ParsedNameClass _nc, ParsedPattern _p, Location _loc, Annotations _anno) makeChoice
(List patterns, Location _loc, Annotations _anno) makeDataPatternBuilder
(String datatypeLibrary, String type, Location _loc) makeElement
(ParsedNameClass _nc, ParsedPattern _p, Location _loc, Annotations _anno) makeElementAnnotationBuilder
(String ns, String localName, String prefix, Location _loc, CommentList _comments, Context context) makeEmpty
(Location _loc, Annotations _anno) makeExternalRef
(Parseable current, String uri, String ns, Scope _scope, Location _loc, Annotations _anno) makeGrammar
(Scope _parent) makeGroup
(List patterns, Location _loc, Annotations _anno) makeInterleave
(List patterns, Location _loc, Annotations _anno) makeList
(ParsedPattern _p, Location _loc, Annotations _anno) makeLocation
(String systemId, int lineNumber, int columnNumber) makeMixed
(ParsedPattern _p, Location _loc, Annotations _anno) makeNotAllowed
(Location _loc, Annotations _anno) makeOneOrMore
(ParsedPattern _p, Location _loc, Annotations _anno) makeOptional
(ParsedPattern _p, Location _loc, Annotations _anno) makeText
(Location _loc, Annotations _anno) makeValue
(String datatypeLibrary, String type, String value, Context c, String ns, Location _loc, Annotations _anno) makeZeroOrMore
(ParsedPattern _p, Location _loc, Annotations _anno) boolean
If thisSchemaBuilder
is interested in actually parsing comments, this method returns true.
-
Constructor Details
-
SchemaBuilderHost
-
-
Method Details
-
annotate
Description copied from interface:SchemaBuilder
Called when annotation is found right inside a pattern such as,<element name="foo"> <!-- this becomes 'P' --> <foreign:annotation /> <!-- this becomes 'A' --> ... </element>
- Specified by:
annotate
in interfaceSchemaBuilder
- Throws:
BuildException
-
annotateAfter
public ParsedPattern annotateAfter(ParsedPattern _p, ParsedElementAnnotation _e) throws BuildException Description copied from interface:SchemaBuilder
Called when element annotation is found after a pattern. such as,<element name="foo"> <empty /> <!-- this becomes 'P' --> <foreign:annotation /> <!-- this becomes 'E' --> </element>
- Specified by:
annotateAfter
in interfaceSchemaBuilder
- Throws:
BuildException
-
commentAfter
- Specified by:
commentAfter
in interfaceSchemaBuilder
- Throws:
BuildException
-
expandPattern
Description copied from interface:SchemaBuilder
Called after all the parsing is done.This hook typically allows as
SchemaBuilder
to expand notAllowed (if it's following the simplification as in the spec.)- Specified by:
expandPattern
in interfaceSchemaBuilder
- Throws:
BuildException
IllegalSchemaException
-
getNameClassBuilder
Description copied from interface:SchemaBuilder
Returns theNameClassBuilder
, which is used to build name classes for thisSchemaBuilder
. TheNameClass
es that are built will then be fed into thisSchemaBuilder
to further build RELAX NG patterns.- Specified by:
getNameClassBuilder
in interfaceSchemaBuilder
- Returns:
- always return a non-null valid object. This method can (and probably should) always return the same object.
- Throws:
BuildException
-
makeAnnotations
Description copied from interface:SchemaBuilder
CreatesAnnotations
object to parse annotations on patterns.- Specified by:
makeAnnotations
in interfaceSchemaBuilder
- Returns:
- must be non-null.
-
makeAttribute
public ParsedPattern makeAttribute(ParsedNameClass _nc, ParsedPattern _p, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeAttribute
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeChoice
public ParsedPattern makeChoice(List patterns, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeChoice
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeCommentList
- Specified by:
makeCommentList
in interfaceSchemaBuilder
-
makeDataPatternBuilder
public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, Location _loc) throws BuildException - Specified by:
makeDataPatternBuilder
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeElement
public ParsedPattern makeElement(ParsedNameClass _nc, ParsedPattern _p, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeElement
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeElementAnnotationBuilder
public ElementAnnotationBuilder makeElementAnnotationBuilder(String ns, String localName, String prefix, Location _loc, CommentList _comments, Context context) - Specified by:
makeElementAnnotationBuilder
in interfaceSchemaBuilder
-
makeEmpty
- Specified by:
makeEmpty
in interfaceSchemaBuilder
-
makeErrorPattern
- Specified by:
makeErrorPattern
in interfaceSchemaBuilder
-
makeExternalRef
public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope _scope, Location _loc, Annotations _anno) throws BuildException, IllegalSchemaException - Specified by:
makeExternalRef
in interfaceSchemaBuilder
- Parameters:
current
- Current grammar that we are parsing. This is what contains externalRef._scope
- The parent scope. null if there's no parent scope. SeeSchemaBuilder.makeGrammar(Scope)
for more details about when this parameter can be null.- Throws:
BuildException
IllegalSchemaException
-
makeGrammar
- Specified by:
makeGrammar
in interfaceSchemaBuilder
- Parameters:
_parent
- The parent scope. null if there's no parent scope. For example, if the complete document looks like the following:
Then when the outer-most<grammar> <start><element name="root"><empty/></element></start> </grammar>
Grammar
is created, it will receive thenull
parent.
-
makeGroup
public ParsedPattern makeGroup(List patterns, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeGroup
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeInterleave
public ParsedPattern makeInterleave(List patterns, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeInterleave
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeList
public ParsedPattern makeList(ParsedPattern _p, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeList
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeLocation
- Specified by:
makeLocation
in interfaceSchemaBuilder
-
makeMixed
public ParsedPattern makeMixed(ParsedPattern _p, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeMixed
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeNotAllowed
- Specified by:
makeNotAllowed
in interfaceSchemaBuilder
-
makeOneOrMore
public ParsedPattern makeOneOrMore(ParsedPattern _p, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeOneOrMore
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeZeroOrMore
public ParsedPattern makeZeroOrMore(ParsedPattern _p, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeZeroOrMore
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeOptional
public ParsedPattern makeOptional(ParsedPattern _p, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeOptional
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeText
- Specified by:
makeText
in interfaceSchemaBuilder
-
makeValue
public ParsedPattern makeValue(String datatypeLibrary, String type, String value, Context c, String ns, Location _loc, Annotations _anno) throws BuildException - Specified by:
makeValue
in interfaceSchemaBuilder
- Throws:
BuildException
-
usesComments
public boolean usesComments()Description copied from interface:SchemaBuilder
If thisSchemaBuilder
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.
- Specified by:
usesComments
in interfaceSchemaBuilder
-