Package org.kohsuke.rngom.digested
Class DSchemaBuilderImpl
- java.lang.Object
-
- org.kohsuke.rngom.digested.DSchemaBuilderImpl
-
- All Implemented Interfaces:
SchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
public class DSchemaBuilderImpl extends Object implements SchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Author:
- Kohsuke Kawaguchi (kk@kohsuke.org)
-
-
Constructor Summary
Constructors Constructor Description DSchemaBuilderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DPattern
annotate(DPattern p, org.kohsuke.rngom.digested.Annotation anno)
Called when annotation is found right inside a pattern such as,DPattern
annotateAfter(DPattern p, org.kohsuke.rngom.digested.ElementWrapper e)
Called when element annotation is found after a pattern.DPattern
commentAfter(DPattern p, org.kohsuke.rngom.digested.CommentListImpl comments)
DPattern
expandPattern(DPattern p)
Called after all the parsing is done.NameClassBuilder
getNameClassBuilder()
Returns theNameClassBuilder
, which is used to build name classes for thisSchemaBuilder
.org.kohsuke.rngom.digested.Annotation
makeAnnotations(org.kohsuke.rngom.digested.CommentListImpl comments, Context context)
CreatesAnnotations
object to parse annotations on patterns.DPattern
makeAttribute(NameClass nc, DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
DPattern
makeChoice(List<DPattern> patterns, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
org.kohsuke.rngom.digested.CommentListImpl
makeCommentList()
DataPatternBuilder
makeDataPatternBuilder(String datatypeLibrary, String type, LocatorImpl loc)
DPattern
makeElement(NameClass nc, DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
ElementAnnotationBuilder
makeElementAnnotationBuilder(String ns, String localName, String prefix, LocatorImpl loc, org.kohsuke.rngom.digested.CommentListImpl comments, Context context)
DPattern
makeEmpty(LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
DPattern
makeErrorPattern()
DPattern
makeExternalRef(Parseable current, String uri, String ns, Scope<DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl> scope, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
Grammar
makeGrammar(Scope parent)
DPattern
makeGroup(List<DPattern> patterns, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
DPattern
makeInterleave(List<DPattern> patterns, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
DPattern
makeList(DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
LocatorImpl
makeLocation(String systemId, int lineNumber, int columnNumber)
DPattern
makeMixed(DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
DPattern
makeNotAllowed(LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
DPattern
makeOneOrMore(DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
DPattern
makeOptional(DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
DPattern
makeText(LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
DPattern
makeValue(String datatypeLibrary, String type, String value, Context c, String ns, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
DPattern
makeZeroOrMore(DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
boolean
usesComments()
If thisSchemaBuilder
is interested in actually parsing comments, this method returns true.
-
-
-
Method Detail
-
getNameClassBuilder
public NameClassBuilder getNameClassBuilder() throws BuildException
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<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Returns:
- always return a non-null valid object. This method can (and probably should) always return the same object.
- Throws:
BuildException
-
makeChoice
public DPattern makeChoice(List<DPattern> patterns, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeChoice
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeInterleave
public DPattern makeInterleave(List<DPattern> patterns, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeInterleave
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeGroup
public DPattern makeGroup(List<DPattern> patterns, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeGroup
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeOneOrMore
public DPattern makeOneOrMore(DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeOneOrMore
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeZeroOrMore
public DPattern makeZeroOrMore(DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeZeroOrMore
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeOptional
public DPattern makeOptional(DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeOptional
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeList
public DPattern makeList(DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeList
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeMixed
public DPattern makeMixed(DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeMixed
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeEmpty
public DPattern makeEmpty(LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
- Specified by:
makeEmpty
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
-
makeNotAllowed
public DPattern makeNotAllowed(LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
- Specified by:
makeNotAllowed
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
-
makeText
public DPattern makeText(LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno)
- Specified by:
makeText
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
-
makeAttribute
public DPattern makeAttribute(NameClass nc, DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeAttribute
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeElement
public DPattern makeElement(NameClass nc, DPattern p, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeElement
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeDataPatternBuilder
public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, LocatorImpl loc) throws BuildException
- Specified by:
makeDataPatternBuilder
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeValue
public DPattern makeValue(String datatypeLibrary, String type, String value, Context c, String ns, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
- Specified by:
makeValue
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeGrammar
public Grammar makeGrammar(Scope parent)
- Specified by:
makeGrammar
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- 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.
-
annotate
public DPattern annotate(DPattern p, org.kohsuke.rngom.digested.Annotation anno) throws BuildException
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<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
annotateAfter
public DPattern annotateAfter(DPattern p, org.kohsuke.rngom.digested.ElementWrapper 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<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
commentAfter
public DPattern commentAfter(DPattern p, org.kohsuke.rngom.digested.CommentListImpl comments) throws BuildException
- Specified by:
commentAfter
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
-
makeExternalRef
public DPattern makeExternalRef(Parseable current, String uri, String ns, Scope<DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl> scope, LocatorImpl loc, org.kohsuke.rngom.digested.Annotation anno) throws BuildException, IllegalSchemaException
- Specified by:
makeExternalRef
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- 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
-
makeLocation
public LocatorImpl makeLocation(String systemId, int lineNumber, int columnNumber)
- Specified by:
makeLocation
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
-
makeAnnotations
public org.kohsuke.rngom.digested.Annotation makeAnnotations(org.kohsuke.rngom.digested.CommentListImpl comments, Context context)
Description copied from interface:SchemaBuilder
CreatesAnnotations
object to parse annotations on patterns.- Specified by:
makeAnnotations
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Returns:
- must be non-null.
-
makeElementAnnotationBuilder
public ElementAnnotationBuilder makeElementAnnotationBuilder(String ns, String localName, String prefix, LocatorImpl loc, org.kohsuke.rngom.digested.CommentListImpl comments, Context context)
- Specified by:
makeElementAnnotationBuilder
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
-
makeCommentList
public org.kohsuke.rngom.digested.CommentListImpl makeCommentList()
- Specified by:
makeCommentList
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
-
makeErrorPattern
public DPattern makeErrorPattern()
- Specified by:
makeErrorPattern
in interfaceSchemaBuilder<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
-
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<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
-
expandPattern
public DPattern expandPattern(DPattern p) throws BuildException, IllegalSchemaException
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<NameClass,DPattern,org.kohsuke.rngom.digested.ElementWrapper,LocatorImpl,org.kohsuke.rngom.digested.Annotation,org.kohsuke.rngom.digested.CommentListImpl>
- Throws:
BuildException
IllegalSchemaException
-
-