org.kohsuke.rngom.ast.builder
Interface SchemaBuilder<N extends ParsedNameClass,P extends ParsedPattern,E extends ParsedElementAnnotation,L extends Location,A extends Annotations<E,L,CL>,CL extends CommentList<L>>

All Known Implementing Classes:
CheckingSchemaBuilder, DSchemaBuilderImpl, SchemaBuilderHost, SchemaBuilderImpl

public interface SchemaBuilder<N extends ParsedNameClass,P extends ParsedPattern,E extends ParsedElementAnnotation,L extends Location,A extends Annotations<E,L,CL>,CL extends CommentList<L>>


Method Summary
 P annotate(P p, A anno)
          Called when annotation is found right inside a pattern such as,
 P annotateAfter(P p, E e)
          Called when element annotation is found after a pattern.
 P commentAfter(P p, CL comments)
           
 P expandPattern(P p)
          Called after all the parsing is done.
 NameClassBuilder<N,E,L,A,CL> getNameClassBuilder()
          Returns the NameClassBuilder, which is used to build name classes for this SchemaBuilder.
 A makeAnnotations(CL comments, Context context)
          Creates Annotations object to parse annotations on patterns.
 P makeAttribute(N nc, P p, L loc, A anno)
           
 P makeChoice(List<P> patterns, L loc, A anno)
           
 CL makeCommentList()
           
 DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, L loc)
           
 P makeElement(N nc, P p, L loc, A anno)
           
 ElementAnnotationBuilder<P,E,L,A,CL> makeElementAnnotationBuilder(String ns, String localName, String prefix, L loc, CL comments, Context context)
           
 P makeEmpty(L loc, A anno)
           
 P makeErrorPattern()
           
 P makeExternalRef(Parseable current, String uri, String ns, Scope<P,E,L,A,CL> scope, L loc, A anno)
           
 Grammar<P,E,L,A,CL> makeGrammar(Scope<P,E,L,A,CL> parent)
           
 P makeGroup(List<P> patterns, L loc, A anno)
           
 P makeInterleave(List<P> patterns, L loc, A anno)
           
 P makeList(P p, L loc, A anno)
           
 L makeLocation(String systemId, int lineNumber, int columnNumber)
           
 P makeMixed(P p, L loc, A anno)
           
 P makeNotAllowed(L loc, A anno)
           
 P makeOneOrMore(P p, L loc, A anno)
           
 P makeOptional(P p, L loc, A anno)
           
 P makeText(L loc, A anno)
           
 P makeValue(String datatypeLibrary, String type, String value, Context c, String ns, L loc, A anno)
           
 P makeZeroOrMore(P p, L loc, A anno)
           
 boolean usesComments()
          If this SchemaBuilderis interested in actually parsing comments, this method returns true.
 

Method Detail

getNameClassBuilder

NameClassBuilder<N,E,L,A,CL> getNameClassBuilder()
                                                                                                                                                                             throws BuildException
Returns the NameClassBuilder, which is used to build name classes for this SchemaBuilder. The NameClasses that are built will then be fed into this SchemaBuilderto further build RELAX NG patterns.

Returns:
always return a non-null valid object. This method can (and probably should) always return the same object.
Throws:
BuildException

makeChoice

P makeChoice(List<P> patterns,
             L loc,
             A anno)
                                   throws BuildException
Throws:
BuildException

makeInterleave

P makeInterleave(List<P> patterns,
                 L loc,
                 A anno)
                                       throws BuildException
Throws:
BuildException

makeGroup

P makeGroup(List<P> patterns,
            L loc,
            A anno)
                                  throws BuildException
Throws:
BuildException

makeOneOrMore

P makeOneOrMore(P p,
                L loc,
                A anno)
                                      throws BuildException
Throws:
BuildException

makeZeroOrMore

P makeZeroOrMore(P p,
                 L loc,
                 A anno)
                                       throws BuildException
Throws:
BuildException

makeOptional

P makeOptional(P p,
               L loc,
               A anno)
                                     throws BuildException
Throws:
BuildException

makeList

P makeList(P p,
           L loc,
           A anno)
                                 throws BuildException
Throws:
BuildException

makeMixed

P makeMixed(P p,
            L loc,
            A anno)
                                  throws BuildException
Throws:
BuildException

makeEmpty

P makeEmpty(L loc,
            A anno)

makeNotAllowed

P makeNotAllowed(L loc,
                 A anno)

makeText

P makeText(L loc,
           A anno)

makeAttribute

P makeAttribute(N nc,
                P p,
                L loc,
                A anno)
                                      throws BuildException
Throws:
BuildException

makeElement

P makeElement(N nc,
              P p,
              L loc,
              A anno)
                                    throws BuildException
Throws:
BuildException

makeDataPatternBuilder

DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary,
                                          String type,
                                          L loc)
                                          throws BuildException
Throws:
BuildException

makeValue

P makeValue(String datatypeLibrary,
            String type,
            String value,
            Context c,
            String ns,
            L loc,
            A anno)
                                  throws BuildException
Throws:
BuildException

makeGrammar

Grammar<P,E,L,A,CL> makeGrammar(Scope<P,E,L,A,CL> parent)
Parameters:
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.

annotate

P annotate(P p,
           A anno)
                                 throws BuildException
Called when annotation is found right inside a pattern such as,

 <element name="foo">     <!-- this becomes 'P' -->
   <foreign:annotation /> <!-- this becomes 'A' -->
   ...
 </element>
 

Throws:
BuildException

annotateAfter

P annotateAfter(P p,
                E e)
                                      throws BuildException
Called when element annotation is found after a pattern. such as,

 <element name="foo">
   <empty />              <!-- this becomes 'P' -->
   <foreign:annotation /> <!-- this becomes 'E' -->
 </element>
 

Throws:
BuildException

commentAfter

P commentAfter(P p,
               CL comments)
                                     throws BuildException
Throws:
BuildException

makeExternalRef

P makeExternalRef(Parseable current,
                  String uri,
                  String ns,
                  Scope<P,E,L,A,CL> scope,
                  L loc,
                  A anno)
                                        throws BuildException,
                                               IllegalSchemaException
Parameters:
current - Current grammar that we are parsing. This is what contains externalRef.
scope - The parent scope. null if there's no parent scope. See makeGrammar(Scope) for more details about when this parameter can be null.
Throws:
BuildException
IllegalSchemaException

makeLocation

L makeLocation(String systemId,
               int lineNumber,
               int columnNumber)

makeAnnotations

A makeAnnotations(CL comments,
                  Context context)
Creates Annotations object to parse annotations on patterns.

Returns:
must be non-null.

makeElementAnnotationBuilder

ElementAnnotationBuilder<P,E,L,A,CL> makeElementAnnotationBuilder(String ns,
                                                                  String localName,
                                                                  String prefix,
                                                                  L loc,
                                                                  CL comments,
                                                                  Context context)

makeCommentList

CL makeCommentList()

makeErrorPattern

P makeErrorPattern()

usesComments

boolean usesComments()
If this SchemaBuilderis 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.


expandPattern

P expandPattern(P p)
                                      throws BuildException,
                                             IllegalSchemaException
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.)

Throws:
BuildException
IllegalSchemaException


Copyright © 2011. All Rights Reserved.