01: package org.kohsuke.rngom.parse;
02:
03: import org.kohsuke.rngom.ast.builder.*;
04: import org.kohsuke.rngom.ast.om.*;
05:
06: /**
07: * An input that can be turned into a RELAX NG pattern.
08: *
09: * <p>
10: * This is either a RELAX NG schema in the XML format, or a RELAX NG
11: * schema in the compact syntax.
12: */
13: public interface Parseable {
14: /**
15: * Parses this {@link Parseable} object into a RELAX NG pattern.
16: *
17: * @param sb
18: * The builder of the schema object model. This object
19: * dictates how the actual pattern is constructed.
20: *
21: * @return
22: * a parsed object. Always returns a non-null valid object.
23: */
24: <P extends ParsedPattern> P parse(SchemaBuilder<?, P, ?, ?, ?, ?> sb)
25: throws BuildException, IllegalSchemaException;
26:
27: /**
28: * Called from {@link Include} in response to
29: * {@link Include#endInclude(Parseable, String, String, Location, Annotations)}
30: * to parse the included grammar.
31: *
32: * @param g
33: * receives the events from the included grammar.
34: */
35: <P extends ParsedPattern> P parseInclude(String uri,
36: SchemaBuilder<?, P, ?, ?, ?, ?> f,
37: IncludedGrammar<P, ?, ?, ?, ?> g, String inheritedNs)
38: throws BuildException, IllegalSchemaException;
39:
40: /**
41: * Called from {@link SchemaBuilder} in response to
42: * {@link SchemaBuilder#makeExternalRef(Parseable, String, String, Scope, Location, Annotations)}
43: * to parse the referenced grammar.
44: *
45: * @param f
46: * receives the events from the referenced grammar.
47: */
48: <P extends ParsedPattern> P parseExternal(String uri,
49: SchemaBuilder<?, P, ?, ?, ?, ?> f, Scope s,
50: String inheritedNs) throws BuildException,
51: IllegalSchemaException;
52: }
|