Package com.sun.tools.rngom.binary
Class SchemaBuilderImpl
java.lang.Object
com.sun.tools.rngom.binary.SchemaBuilderImpl
- All Implemented Interfaces:
Annotations
,CommentList
,ElementAnnotationBuilder
,SchemaBuilder
public class SchemaBuilderImpl
extends Object
implements SchemaBuilder, ElementAnnotationBuilder, CommentList
-
Constructor Summary
ConstructorDescriptionSchemaBuilderImpl
(ErrorHandler eh, DatatypeLibraryFactory datatypeLibraryFactory, SchemaPatternBuilder pb) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called for an attribute annotation.void
addComment
(CommentList comments) Adds comments following the last initial child element annotation.void
addComment
(String value, Location loc) void
Called for a child element annotation.void
addLeadingComment
(CommentList comments) void
addText
(String value, Location loc, CommentList comments) Called when a child text is found.annotate
(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) expandPattern
(ParsedPattern _pattern) Called after all the parsing is done.Returns theNameClassBuilder
, which is used to build name classes for this .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) Called at the end to build an application data structure.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 context, String ns, Location loc, Annotations anno) makeZeroOrMore
(ParsedPattern p, Location loc, Annotations anno) boolean
If this is interested in actually parsing comments, this method returns true.
-
Constructor Details
-
SchemaBuilderImpl
- Parameters:
eh
- Error handler to receive errors while building the schema.
-
SchemaBuilderImpl
public SchemaBuilderImpl(ErrorHandler eh, 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 Details
-
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 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 this . TheNameClass
es that are built will then be fed into this 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.
-
makeChoice
public ParsedPattern makeChoice(List patterns, Location loc, Annotations anno) throws BuildException - Specified by:
makeChoice
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeInterleave
public ParsedPattern makeInterleave(List patterns, Location loc, Annotations anno) throws BuildException - Specified by:
makeInterleave
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeGroup
- Specified by:
makeGroup
in interfaceSchemaBuilder
- Throws:
BuildException
-
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
-
makeList
public ParsedPattern makeList(ParsedPattern p, Location loc, Annotations anno) throws BuildException - Specified by:
makeList
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeMixed
public ParsedPattern makeMixed(ParsedPattern p, Location loc, Annotations anno) throws BuildException - Specified by:
makeMixed
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeEmpty
- Specified by:
makeEmpty
in interfaceSchemaBuilder
-
makeNotAllowed
- Specified by:
makeNotAllowed
in interfaceSchemaBuilder
-
makeText
- Specified by:
makeText
in interfaceSchemaBuilder
-
makeErrorPattern
- Specified by:
makeErrorPattern
in interfaceSchemaBuilder
-
makeAttribute
public ParsedPattern makeAttribute(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno) throws BuildException - Specified by:
makeAttribute
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
-
makeDataPatternBuilder
public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, Location loc) throws BuildException - Specified by:
makeDataPatternBuilder
in interfaceSchemaBuilder
- Throws:
BuildException
-
makeValue
public ParsedPattern makeValue(String datatypeLibrary, String type, String value, Context context, String ns, Location loc, Annotations anno) throws BuildException - Specified by:
makeValue
in interfaceSchemaBuilder
- Throws:
BuildException
-
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.
-
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
-
makeExternalRef
public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope, Location loc, Annotations anno) throws BuildException - 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
-
makeLocation
- Specified by:
makeLocation
in interfaceSchemaBuilder
-
makeAnnotations
Description copied from interface:SchemaBuilder
CreatesAnnotations
object to parse annotations on patterns.- Specified by:
makeAnnotations
in interfaceSchemaBuilder
- Returns:
- must be non-null.
-
makeElementAnnotationBuilder
public ElementAnnotationBuilder makeElementAnnotationBuilder(String ns, String localName, String prefix, Location loc, CommentList comments, Context context) - Specified by:
makeElementAnnotationBuilder
in interfaceSchemaBuilder
-
makeCommentList
- Specified by:
makeCommentList
in interfaceSchemaBuilder
-
addComment
- Specified by:
addComment
in interfaceCommentList
- Throws:
BuildException
-
addAttribute
Description copied from interface:Annotations
Called for an attribute annotation.- Specified by:
addAttribute
in interfaceAnnotations
-
addElement
Description copied from interface:Annotations
Called for a child element annotation.- Specified by:
addElement
in interfaceAnnotations
-
addComment
Description copied from interface:Annotations
Adds comments following the last initial child element annotation.- Specified by:
addComment
in interfaceAnnotations
- Throws:
BuildException
-
addLeadingComment
- Specified by:
addLeadingComment
in interfaceAnnotations
- Throws:
BuildException
-
makeElementAnnotation
Description copied from interface:ElementAnnotationBuilder
Called at the end to build an application data structure.- Specified by:
makeElementAnnotation
in interfaceElementAnnotationBuilder
-
addText
Description copied from interface:ElementAnnotationBuilder
Called when a child text is found.- Specified by:
addText
in interfaceElementAnnotationBuilder
- Throws:
BuildException
-
usesComments
public boolean usesComments()Description copied from interface:SchemaBuilder
If this 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
-