- java.lang.Object
-
- com.sun.tools.rngom.binary.SchemaBuilderImpl
-
- All Implemented Interfaces:
Annotations,CommentList,ElementAnnotationBuilder,SchemaBuilder
public class SchemaBuilderImpl extends java.lang.Object implements SchemaBuilder, ElementAnnotationBuilder, CommentList
-
-
Constructor Summary
Constructors Constructor Description SchemaBuilderImpl(org.xml.sax.ErrorHandler eh)SchemaBuilderImpl(org.xml.sax.ErrorHandler eh, com.sun.tools.rngdatatype.DatatypeLibraryFactory datatypeLibraryFactory, SchemaPatternBuilder pb)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(java.lang.String ns, java.lang.String localName, java.lang.String prefix, java.lang.String value, Location loc)Called for an attribute annotation.voidaddComment(CommentList comments)Adds comments following the last initial child element annotation.voidaddComment(java.lang.String value, Location loc)voidaddElement(ParsedElementAnnotation ea)Called for a child element annotation.voidaddLeadingComment(CommentList comments)voidaddText(java.lang.String value, Location loc, CommentList comments)Called when a child text is found.ParsedPatternannotate(ParsedPattern p, Annotations anno)Called when annotation is found right inside a pattern such as,ParsedPatternannotateAfter(ParsedPattern p, ParsedElementAnnotation e)Called when element annotation is found after a pattern.ParsedPatterncommentAfter(ParsedPattern p, CommentList comments)ParsedPatternexpandPattern(ParsedPattern _pattern)Called after all the parsing is done.NameClassBuildergetNameClassBuilder()Returns theNameClassBuilder, which is used to build name classes for thisSchemaBuilder.AnnotationsmakeAnnotations(CommentList comments, Context context)CreatesAnnotationsobject to parse annotations on patterns.ParsedPatternmakeAttribute(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno)ParsedPatternmakeChoice(java.util.List patterns, Location loc, Annotations anno)CommentListmakeCommentList()DataPatternBuildermakeDataPatternBuilder(java.lang.String datatypeLibrary, java.lang.String type, Location loc)ParsedPatternmakeElement(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno)ParsedElementAnnotationmakeElementAnnotation()Called at the end to build an application data structure.ElementAnnotationBuildermakeElementAnnotationBuilder(java.lang.String ns, java.lang.String localName, java.lang.String prefix, Location loc, CommentList comments, Context context)ParsedPatternmakeEmpty(Location loc, Annotations anno)ParsedPatternmakeErrorPattern()ParsedPatternmakeExternalRef(Parseable current, java.lang.String uri, java.lang.String ns, Scope scope, Location loc, Annotations anno)GrammarmakeGrammar(Scope parent)ParsedPatternmakeGroup(java.util.List patterns, Location loc, Annotations anno)ParsedPatternmakeInterleave(java.util.List patterns, Location loc, Annotations anno)ParsedPatternmakeList(ParsedPattern p, Location loc, Annotations anno)LocationmakeLocation(java.lang.String systemId, int lineNumber, int columnNumber)ParsedPatternmakeMixed(ParsedPattern p, Location loc, Annotations anno)ParsedPatternmakeNotAllowed(Location loc, Annotations anno)ParsedPatternmakeOneOrMore(ParsedPattern p, Location loc, Annotations anno)ParsedPatternmakeOptional(ParsedPattern p, Location loc, Annotations anno)ParsedPatternmakeText(Location loc, Annotations anno)ParsedPatternmakeValue(java.lang.String datatypeLibrary, java.lang.String type, java.lang.String value, Context context, java.lang.String ns, Location loc, Annotations anno)ParsedPatternmakeZeroOrMore(ParsedPattern p, Location loc, Annotations anno)booleanusesComments()If thisSchemaBuilderis interested in actually parsing comments, this method returns true.
-
-
-
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, com.sun.tools.rngdatatype.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:SchemaBuilderCalled after all the parsing is done.This hook typically allows as
SchemaBuilderto expand notAllowed (if it's following the simplification as in the spec.)- Specified by:
expandPatternin interfaceSchemaBuilder- Throws:
BuildExceptionIllegalSchemaException
-
getNameClassBuilder
public NameClassBuilder getNameClassBuilder()
Description copied from interface:SchemaBuilderReturns theNameClassBuilder, which is used to build name classes for thisSchemaBuilder. TheNameClasses that are built will then be fed into thisSchemaBuilderto further build RELAX NG patterns.- Specified by:
getNameClassBuilderin interfaceSchemaBuilder- 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:
makeChoicein interfaceSchemaBuilder- Throws:
BuildException
-
makeInterleave
public ParsedPattern makeInterleave(java.util.List patterns, Location loc, Annotations anno) throws BuildException
- Specified by:
makeInterleavein interfaceSchemaBuilder- Throws:
BuildException
-
makeGroup
public ParsedPattern makeGroup(java.util.List patterns, Location loc, Annotations anno) throws BuildException
- Specified by:
makeGroupin interfaceSchemaBuilder- Throws:
BuildException
-
makeOneOrMore
public ParsedPattern makeOneOrMore(ParsedPattern p, Location loc, Annotations anno) throws BuildException
- Specified by:
makeOneOrMorein interfaceSchemaBuilder- Throws:
BuildException
-
makeZeroOrMore
public ParsedPattern makeZeroOrMore(ParsedPattern p, Location loc, Annotations anno) throws BuildException
- Specified by:
makeZeroOrMorein interfaceSchemaBuilder- Throws:
BuildException
-
makeOptional
public ParsedPattern makeOptional(ParsedPattern p, Location loc, Annotations anno) throws BuildException
- Specified by:
makeOptionalin interfaceSchemaBuilder- Throws:
BuildException
-
makeList
public ParsedPattern makeList(ParsedPattern p, Location loc, Annotations anno) throws BuildException
- Specified by:
makeListin interfaceSchemaBuilder- Throws:
BuildException
-
makeMixed
public ParsedPattern makeMixed(ParsedPattern p, Location loc, Annotations anno) throws BuildException
- Specified by:
makeMixedin interfaceSchemaBuilder- Throws:
BuildException
-
makeEmpty
public ParsedPattern makeEmpty(Location loc, Annotations anno)
- Specified by:
makeEmptyin interfaceSchemaBuilder
-
makeNotAllowed
public ParsedPattern makeNotAllowed(Location loc, Annotations anno)
- Specified by:
makeNotAllowedin interfaceSchemaBuilder
-
makeText
public ParsedPattern makeText(Location loc, Annotations anno)
- Specified by:
makeTextin interfaceSchemaBuilder
-
makeErrorPattern
public ParsedPattern makeErrorPattern()
- Specified by:
makeErrorPatternin interfaceSchemaBuilder
-
makeAttribute
public ParsedPattern makeAttribute(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno) throws BuildException
- Specified by:
makeAttributein interfaceSchemaBuilder- Throws:
BuildException
-
makeElement
public ParsedPattern makeElement(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno) throws BuildException
- Specified by:
makeElementin interfaceSchemaBuilder- Throws:
BuildException
-
makeDataPatternBuilder
public DataPatternBuilder makeDataPatternBuilder(java.lang.String datatypeLibrary, java.lang.String type, Location loc) throws BuildException
- Specified by:
makeDataPatternBuilderin interfaceSchemaBuilder- 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:
makeValuein interfaceSchemaBuilder- Throws:
BuildException
-
makeGrammar
public Grammar makeGrammar(Scope parent)
- Specified by:
makeGrammarin 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>Grammaris created, it will receive thenullparent.
-
annotate
public ParsedPattern annotate(ParsedPattern p, Annotations anno) throws BuildException
Description copied from interface:SchemaBuilderCalled when annotation is found right inside a pattern such as,<element name="foo"> <!-- this becomes 'P' --> <foreign:annotation /> <!-- this becomes 'A' --> ... </element>- Specified by:
annotatein interfaceSchemaBuilder- Throws:
BuildException
-
annotateAfter
public ParsedPattern annotateAfter(ParsedPattern p, ParsedElementAnnotation e) throws BuildException
Description copied from interface:SchemaBuilderCalled 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:
annotateAfterin interfaceSchemaBuilder- Throws:
BuildException
-
commentAfter
public ParsedPattern commentAfter(ParsedPattern p, CommentList comments) throws BuildException
- Specified by:
commentAfterin interfaceSchemaBuilder- 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:
makeExternalRefin 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
public Location makeLocation(java.lang.String systemId, int lineNumber, int columnNumber)
- Specified by:
makeLocationin interfaceSchemaBuilder
-
makeAnnotations
public Annotations makeAnnotations(CommentList comments, Context context)
Description copied from interface:SchemaBuilderCreatesAnnotationsobject to parse annotations on patterns.- Specified by:
makeAnnotationsin interfaceSchemaBuilder- 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:
makeElementAnnotationBuilderin interfaceSchemaBuilder
-
makeCommentList
public CommentList makeCommentList()
- Specified by:
makeCommentListin interfaceSchemaBuilder
-
addComment
public void addComment(java.lang.String value, Location loc) throws BuildException- Specified by:
addCommentin interfaceCommentList- 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:AnnotationsCalled for an attribute annotation.- Specified by:
addAttributein interfaceAnnotations
-
addElement
public void addElement(ParsedElementAnnotation ea)
Description copied from interface:AnnotationsCalled for a child element annotation.- Specified by:
addElementin interfaceAnnotations
-
addComment
public void addComment(CommentList comments) throws BuildException
Description copied from interface:AnnotationsAdds comments following the last initial child element annotation.- Specified by:
addCommentin interfaceAnnotations- Throws:
BuildException
-
addLeadingComment
public void addLeadingComment(CommentList comments) throws BuildException
- Specified by:
addLeadingCommentin interfaceAnnotations- Throws:
BuildException
-
makeElementAnnotation
public ParsedElementAnnotation makeElementAnnotation()
Description copied from interface:ElementAnnotationBuilderCalled at the end to build an application data structure.- Specified by:
makeElementAnnotationin interfaceElementAnnotationBuilder
-
addText
public void addText(java.lang.String value, Location loc, CommentList comments) throws BuildExceptionDescription copied from interface:ElementAnnotationBuilderCalled when a child text is found.- Specified by:
addTextin interfaceElementAnnotationBuilder- Throws:
BuildException
-
usesComments
public boolean usesComments()
Description copied from interface:SchemaBuilderIf thisSchemaBuilderis 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:
usesCommentsin interfaceSchemaBuilder
-
-