Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.kohsuke.rngom.binary
Class SchemaBuilderImpl

    java.lang.Object
      org.kohsuke.rngom.binary.SchemaBuilderImpl

All Implemented Interfaces:
  Annotations, CommentList, ElementAnnotationBuilder, SchemaBuilder

    public class SchemaBuilderImpl

extends java.lang.Object
implements SchemaBuilder, ElementAnnotationBuilder, CommentList

Constructor Summary
`SchemaBuilderImpl(org.xml.sax.ErrorHandler eh)`
`SchemaBuilderImpl(org.xml.sax.ErrorHandler eh, org.relaxng.datatype.DatatypeLibraryFactory datatypeLibraryFactory, SchemaPatternBuilder pb)`

Method Summary
`void` | `addAttribute(java.lang.String ns, java.lang.String localName, java.lang.String prefix, java.lang.String value, Location loc)` Called for an attribute annotation.
`void` | `addComment(CommentList comments)` Adds comments following the last initial child element annotation.
`void` | `addComment(java.lang.String value, Location loc)`
`void` | `addElement(ParsedElementAnnotation ea)` Called for a child element annotation.
`void` | `addLeadingComment(CommentList comments)`
`void` | `addText(java.lang.String value, Location loc, CommentList comments)` Called when a child text is found.
`ParsedPattern` | `annotate(ParsedPattern p, Annotations anno)` Called when annotation is found right inside a pattern such as,
`ParsedPattern` | `annotateAfter(ParsedPattern p, ParsedElementAnnotation e)` Called when element annotation is found after a pattern.
`ParsedPattern` | `commentAfter(ParsedPattern p, CommentList comments)`
`ParsedPattern` | `expandPattern(ParsedPattern _pattern)` Called after all the parsing is done.
`NameClassBuilder` | `getNameClassBuilder()` Returns the `NameClassBuilder`, which is used to build name classes for this `SchemaBuilder`.
`Annotations` | `makeAnnotations(CommentList comments, Context context)` Creates `Annotations` object to parse annotations on patterns.
`ParsedPattern` | `makeAttribute(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno)`
`ParsedPattern` | `makeChoice(java.util.List patterns, Location loc, Annotations anno)`
`CommentList` | `makeCommentList()`
`DataPatternBuilder` | `makeDataPatternBuilder(java.lang.String datatypeLibrary, java.lang.String type, Location loc)`
`ParsedPattern` | `makeElement(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno)`
`ParsedElementAnnotation` | `makeElementAnnotation()` Called at the end to build an application data structure.
`ElementAnnotationBuilder` | `makeElementAnnotationBuilder(java.lang.String ns, java.lang.String localName, java.lang.String prefix, Location loc, CommentList comments, Context context)`
`ParsedPattern` | `makeEmpty(Location loc, Annotations anno)`
`ParsedPattern` | `makeErrorPattern()`
`ParsedPattern` | `makeExternalRef(Parseable current, java.lang.String uri, java.lang.String ns, Scope scope, Location loc, Annotations anno)`
`Grammar` | `makeGrammar(Scope parent)`
`ParsedPattern` | `makeGroup(java.util.List patterns, Location loc, Annotations anno)`
`ParsedPattern` | `makeInterleave(java.util.List patterns, Location loc, Annotations anno)`
`ParsedPattern` | `makeList(ParsedPattern p, Location loc, Annotations anno)`
`Location` | `makeLocation(java.lang.String systemId, int lineNumber, int columnNumber)`
`ParsedPattern` | `makeMixed(ParsedPattern p, Location loc, Annotations anno)`
`ParsedPattern` | `makeNotAllowed(Location loc, Annotations anno)`
`ParsedPattern` | `makeOneOrMore(ParsedPattern p, Location loc, Annotations anno)`
`ParsedPattern` | `makeOptional(ParsedPattern p, Location loc, Annotations anno)`
`ParsedPattern` | `makeText(Location loc, Annotations anno)`
`ParsedPattern` | `makeValue(java.lang.String datatypeLibrary, java.lang.String type, java.lang.String value, Context context, java.lang.String ns, Location loc, Annotations anno)`
`ParsedPattern` | `makeZeroOrMore(ParsedPattern p, Location loc, Annotations anno)`
`boolean` | `usesComments()` If this `SchemaBuilder`is interested in actually parsing comments, this method returns true.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SchemaBuilderImpl

    public SchemaBuilderImpl(org.xml.sax.ErrorHandler eh)

Parameters:
  `eh` - Error handler to receive errors while building the schema.

### SchemaBuilderImpl

    public SchemaBuilderImpl(org.xml.sax.ErrorHandler eh,
                             org.relaxng.datatype.DatatypeLibraryFactory datatypeLibraryFactory,
                             SchemaPatternBuilder pb)

Parameters:
  `eh` - Error handler to receive errors while building the schema.
  `datatypeLibraryFactory` - This is consulted to locate datatype libraries.
  `pb` - Used to build patterns.

Method Detail

### expandPattern

    public ParsedPattern expandPattern(ParsedPattern _pattern)
                                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 interface `SchemaBuilder`
  Throws:
    `BuildException`
    `IllegalSchemaException`

### getNameClassBuilder

    public NameClassBuilder getNameClassBuilder()

  Description copied from interface: `SchemaBuilder`
  Returns the `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.

  Specified by:
    `getNameClassBuilder` in interface `SchemaBuilder`
  Returns:
    always return a non-null valid object. This method can (and probably should) always return the same object.

### makeChoice

    public ParsedPattern makeChoice(java.util.List patterns,
                                    Location loc,
                                    Annotations anno)
                             throws BuildException

  Specified by:
    `makeChoice` in interface `SchemaBuilder`
  Throws:
    `BuildException`

### makeInterleave

    public ParsedPattern makeInterleave(java.util.List patterns,
                                        Location loc,
                                        Annotations anno)
                                 throws BuildException

  Specified by:
    `makeInterleave` in interface `SchemaBuilder`
  Throws:
    `BuildException`

### makeGroup

    public ParsedPattern makeGroup(java.util.List patterns,
                                   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`

### 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(java.lang.String datatypeLibrary,
                                                     java.lang.String type,
                                                     Location loc)
                                              throws BuildException

  Specified by:
    `makeDataPatternBuilder` in interface `SchemaBuilder`
  Throws:
    `BuildException`

### makeValue

    public ParsedPattern makeValue(java.lang.String datatypeLibrary,
                                   java.lang.String type,
                                   java.lang.String value,
                                   Context context,
                                   java.lang.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`
  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

    public ParsedPattern annotate(ParsedPattern p,
                                  Annotations 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 interface `SchemaBuilder`
  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 interface `SchemaBuilder`
  Throws:
    `BuildException`

### commentAfter

    public ParsedPattern commentAfter(ParsedPattern p,
                                      CommentList comments)
                               throws BuildException

  Specified by:
    `commentAfter` in interface `SchemaBuilder`
  Throws:
    `BuildException`

### makeExternalRef

    public ParsedPattern makeExternalRef(Parseable current,
                                         java.lang.String uri,
                                         java.lang.String ns,
                                         Scope scope,
                                         Location loc,
                                         Annotations anno)
                                  throws BuildException

  Specified by:
    `makeExternalRef` in interface `SchemaBuilder`
  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 `SchemaBuilder.makeGrammar(Scope)` for more details about when this parameter can be null.
  Throws:
    `BuildException`

### makeLocation

    public Location makeLocation(java.lang.String systemId,
                                 int lineNumber,
                                 int columnNumber)

  Specified by:
    `makeLocation` in interface `SchemaBuilder`

### makeAnnotations

    public Annotations makeAnnotations(CommentList comments,
                                       Context context)

  Description copied from interface: `SchemaBuilder`
  Creates `Annotations` object to parse annotations on patterns.

  Specified by:
    `makeAnnotations` in interface `SchemaBuilder`
  Returns:
    must be non-null.

### makeElementAnnotationBuilder

    public ElementAnnotationBuilder makeElementAnnotationBuilder(java.lang.String ns,
                                                                 java.lang.String localName,
                                                                 java.lang.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(java.lang.String value,
                           Location loc)
                    throws BuildException

  Specified by:
    `addComment` in interface `CommentList`
  Throws:
    `BuildException`

### addAttribute

    public void addAttribute(java.lang.String ns,
                             java.lang.String localName,
                             java.lang.String prefix,
                             java.lang.String value,
                             Location loc)

  Description copied from interface: `Annotations`
  Called for an attribute annotation.

  Specified by:
    `addAttribute` in interface `Annotations`

### addElement

    public void addElement(ParsedElementAnnotation ea)

  Description copied from interface: `Annotations`
  Called for a child element annotation.

  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`

### makeElementAnnotation

    public ParsedElementAnnotation makeElementAnnotation()

  Description copied from interface: `ElementAnnotationBuilder`
  Called at the end to build an application data structure.

  Specified by:
    `makeElementAnnotation` in interface `ElementAnnotationBuilder`

### addText

    public void addText(java.lang.String value,
                        Location loc,
                        CommentList comments)
                 throws BuildException

  Description copied from interface: `ElementAnnotationBuilder`
  Called when a child text is found.

  Specified by:
    `addText` in interface `ElementAnnotationBuilder`
  Throws:
    `BuildException`

### usesComments

    public boolean usesComments()

  Description copied from interface: `SchemaBuilder`
  If this `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.

  Specified by:
    `usesComments` in interface `SchemaBuilder`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD