com.sun.xml.internal.rngom.parse.Parseable Java Examples

The following examples show how to use com.sun.xml.internal.rngom.parse.Parseable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SchemaBuilderImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope,
        Location loc, Annotations anno)
        throws BuildException {
    for (OpenIncludes inc = openIncludes;
            inc != null;
            inc = inc.parent) {
        if (inc.uri.equals(uri)) {
            error("recursive_include", uri, (Locator) loc);
            return pb.makeError();
        }
    }
    try {
        return current.parseExternal(uri, new SchemaBuilderImpl(ns, uri, this), scope, ns);
    } catch (IllegalSchemaException e) {
        noteError();
        return pb.makeError();
    }
}
 
Example #2
Source File: SchemaBuilderImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope,
        Location loc, Annotations anno)
        throws BuildException {
    for (OpenIncludes inc = openIncludes;
            inc != null;
            inc = inc.parent) {
        if (inc.uri.equals(uri)) {
            error("recursive_include", uri, (Locator) loc);
            return pb.makeError();
        }
    }
    try {
        return current.parseExternal(uri, new SchemaBuilderImpl(ns, uri, this), scope, ns);
    } catch (IllegalSchemaException e) {
        noteError();
        return pb.makeError();
    }
}
 
Example #3
Source File: SchemaBuilderImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope,
        Location loc, Annotations anno)
        throws BuildException {
    for (OpenIncludes inc = openIncludes;
            inc != null;
            inc = inc.parent) {
        if (inc.uri.equals(uri)) {
            error("recursive_include", uri, (Locator) loc);
            return pb.makeError();
        }
    }
    try {
        return current.parseExternal(uri, new SchemaBuilderImpl(ns, uri, this), scope, ns);
    } catch (IllegalSchemaException e) {
        noteError();
        return pb.makeError();
    }
}
 
Example #4
Source File: SchemaBuilderImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope,
        Location loc, Annotations anno)
        throws BuildException {
    for (OpenIncludes inc = openIncludes;
            inc != null;
            inc = inc.parent) {
        if (inc.uri.equals(uri)) {
            error("recursive_include", uri, (Locator) loc);
            return pb.makeError();
        }
    }
    try {
        return current.parseExternal(uri, new SchemaBuilderImpl(ns, uri, this), scope, ns);
    } catch (IllegalSchemaException e) {
        noteError();
        return pb.makeError();
    }
}
 
Example #5
Source File: SchemaBuilderImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope,
        Location loc, Annotations anno)
        throws BuildException {
    for (OpenIncludes inc = openIncludes;
            inc != null;
            inc = inc.parent) {
        if (inc.uri.equals(uri)) {
            error("recursive_include", uri, (Locator) loc);
            return pb.makeError();
        }
    }
    try {
        return current.parseExternal(uri, new SchemaBuilderImpl(ns, uri, this), scope, ns);
    } catch (IllegalSchemaException e) {
        noteError();
        return pb.makeError();
    }
}
 
Example #6
Source File: SchemaBuilderImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope,
        Location loc, Annotations anno)
        throws BuildException {
    for (OpenIncludes inc = openIncludes;
            inc != null;
            inc = inc.parent) {
        if (inc.uri.equals(uri)) {
            error("recursive_include", uri, (Locator) loc);
            return pb.makeError();
        }
    }
    try {
        return current.parseExternal(uri, new SchemaBuilderImpl(ns, uri, this), scope, ns);
    } catch (IllegalSchemaException e) {
        noteError();
        return pb.makeError();
    }
}
 
Example #7
Source File: SchemaBuilderHost.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri,
    String ns, Scope _scope, Location _loc, Annotations _anno)
    throws BuildException, IllegalSchemaException {

    ScopeHost scope = (ScopeHost) _scope;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeExternalRef(current, uri, ns, scope.lhs, loc.lhs, anno.lhs),
        rhs.makeExternalRef(current, uri, ns, scope.rhs, loc.rhs, anno.rhs) );
}
 
Example #8
Source File: ModelLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a RELAX NG grammar into an annotated grammar.
 */
private Model loadRELAXNG() throws SAXException {

    // build DOM forest
    final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() );

    // use JAXP masquerading to validate the input document.
    // DOMForest -> ExtensionBindingChecker -> RNGOM

    XMLReaderCreator xrc = new XMLReaderCreator() {
        public XMLReader createXMLReader() {

            // foreset parser cannot change the receivers while it's working,
            // so we need to have one XMLFilter that works as a buffer
            XMLFilter buffer = new XMLFilterImpl() {
                @Override
                public void parse(InputSource source) throws IOException, SAXException {
                    forest.createParser().parse( source, this, this, this );
                }
            };

            XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver);
            f.setParent(buffer);

            f.setEntityResolver(opt.entityResolver);

            return f;
        }
    };

    Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc );

    return loadRELAXNG(p);

}
 
Example #9
Source File: IncludeHost.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void endInclude(Parseable current, String uri, String ns, Location _loc, Annotations _anno) throws BuildException, IllegalSchemaException {
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    lhs.endInclude( current, uri, ns, loc.lhs, anno.lhs );
    rhs.endInclude( current, uri, ns, loc.rhs, anno.rhs );
}
 
Example #10
Source File: SchemaBuilderHost.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri,
    String ns, Scope _scope, Location _loc, Annotations _anno)
    throws BuildException, IllegalSchemaException {

    ScopeHost scope = (ScopeHost) _scope;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeExternalRef(current, uri, ns, scope.lhs, loc.lhs, anno.lhs),
        rhs.makeExternalRef(current, uri, ns, scope.rhs, loc.rhs, anno.rhs) );
}
 
Example #11
Source File: SchemaBuilderImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void endInclude(Parseable current, String uri, String ns,
        Location loc, Annotations anno) throws BuildException {
    for (OpenIncludes inc = sb.openIncludes;
            inc != null;
            inc = inc.parent) {
        if (inc.uri.equals(uri)) {
            sb.error("recursive_include", uri, (Locator) loc);
            return;
        }
    }

    for (Override o = overrides; o != null; o = o.next) {
        o.replacementStatus = o.prp.getReplacementStatus();
        o.prp.setReplacementStatus(RefPattern.REPLACEMENT_REQUIRE);
    }
    try {
        SchemaBuilderImpl isb = new SchemaBuilderImpl(ns, uri, sb);
        current.parseInclude(uri, isb, new GrammarImpl(isb, grammar), ns);
        for (Override o = overrides; o != null; o = o.next) {
            if (o.prp.getReplacementStatus() == RefPattern.REPLACEMENT_REQUIRE) {
                if (o.prp.getName() == null) {
                    sb.error("missing_start_replacement", (Locator) loc);
                } else {
                    sb.error("missing_define_replacement", o.prp.getName(), (Locator) loc);
                }
            }
        }
    } catch (IllegalSchemaException e) {
        sb.noteError();
    } finally {
        for (Override o = overrides; o != null; o = o.next) {
            o.prp.setReplacementStatus(o.replacementStatus);
        }
    }
}
 
Example #12
Source File: SchemaBuilderImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void endInclude(Parseable current, String uri, String ns,
        Location loc, Annotations anno) throws BuildException {
    for (OpenIncludes inc = sb.openIncludes;
            inc != null;
            inc = inc.parent) {
        if (inc.uri.equals(uri)) {
            sb.error("recursive_include", uri, (Locator) loc);
            return;
        }
    }

    for (Override o = overrides; o != null; o = o.next) {
        o.replacementStatus = o.prp.getReplacementStatus();
        o.prp.setReplacementStatus(RefPattern.REPLACEMENT_REQUIRE);
    }
    try {
        SchemaBuilderImpl isb = new SchemaBuilderImpl(ns, uri, sb);
        current.parseInclude(uri, isb, new GrammarImpl(isb, grammar), ns);
        for (Override o = overrides; o != null; o = o.next) {
            if (o.prp.getReplacementStatus() == RefPattern.REPLACEMENT_REQUIRE) {
                if (o.prp.getName() == null) {
                    sb.error("missing_start_replacement", (Locator) loc);
                } else {
                    sb.error("missing_define_replacement", o.prp.getName(), (Locator) loc);
                }
            }
        }
    } catch (IllegalSchemaException e) {
        sb.noteError();
    } finally {
        for (Override o = overrides; o != null; o = o.next) {
            o.prp.setReplacementStatus(o.replacementStatus);
        }
    }
}
 
Example #13
Source File: IncludeHost.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void endInclude(Parseable current, String uri, String ns, Location _loc, Annotations _anno) throws BuildException, IllegalSchemaException {
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    lhs.endInclude( current, uri, ns, loc.lhs, anno.lhs );
    rhs.endInclude( current, uri, ns, loc.rhs, anno.rhs );
}
 
Example #14
Source File: SchemaBuilderHost.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri,
    String ns, Scope _scope, Location _loc, Annotations _anno)
    throws BuildException, IllegalSchemaException {

    ScopeHost scope = (ScopeHost) _scope;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeExternalRef(current, uri, ns, scope.lhs, loc.lhs, anno.lhs),
        rhs.makeExternalRef(current, uri, ns, scope.rhs, loc.rhs, anno.rhs) );
}
 
Example #15
Source File: ModelLoader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Loads RELAX NG compact syntax
 */
private Model loadRELAXNGCompact() {
    if(opt.getBindFiles().length>0)
        errorReceiver.error(new SAXParseException(
            Messages.format(Messages.ERR_BINDING_FILE_NOT_SUPPORTED_FOR_RNC),null));

    // TODO: entity resolver?
    Parseable p = new CompactParseable( opt.getGrammars()[0], errorReceiver );

    return loadRELAXNG(p);

}
 
Example #16
Source File: ModelLoader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Common part between the XML syntax and the compact syntax.
 */
private Model loadRELAXNG(Parseable p) {
    SchemaBuilder sb = new CheckingSchemaBuilder(new DSchemaBuilderImpl(),errorReceiver);

    try {
        DPattern out = (DPattern)p.parse(sb);
        return RELAXNGCompiler.build(out,codeModel,opt);
    } catch (IllegalSchemaException e) {
        errorReceiver.error(e.getMessage(),e);
        return null;
    }
}
 
Example #17
Source File: IncludeHost.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void endInclude(Parseable current, String uri, String ns, Location _loc, Annotations _anno) throws BuildException, IllegalSchemaException {
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    lhs.endInclude( current, uri, ns, loc.lhs, anno.lhs );
    rhs.endInclude( current, uri, ns, loc.rhs, anno.rhs );
}
 
Example #18
Source File: ModelLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Loads RELAX NG compact syntax
 */
private Model loadRELAXNGCompact() {
    if(opt.getBindFiles().length>0)
        errorReceiver.error(new SAXParseException(
            Messages.format(Messages.ERR_BINDING_FILE_NOT_SUPPORTED_FOR_RNC),null));

    // TODO: entity resolver?
    Parseable p = new CompactParseable( opt.getGrammars()[0], errorReceiver );

    return loadRELAXNG(p);

}
 
Example #19
Source File: ModelLoader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Common part between the XML syntax and the compact syntax.
 */
private Model loadRELAXNG(Parseable p) {
    SchemaBuilder sb = new CheckingSchemaBuilder(new DSchemaBuilderImpl(),errorReceiver);

    try {
        DPattern out = (DPattern)p.parse(sb);
        return RELAXNGCompiler.build(out,codeModel,opt);
    } catch (IllegalSchemaException e) {
        errorReceiver.error(e.getMessage(),e);
        return null;
    }
}
 
Example #20
Source File: ModelLoader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a RELAX NG grammar into an annotated grammar.
 */
private Model loadRELAXNG() throws SAXException {

    // build DOM forest
    final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() );

    // use JAXP masquerading to validate the input document.
    // DOMForest -> ExtensionBindingChecker -> RNGOM

    XMLReaderCreator xrc = new XMLReaderCreator() {
        public XMLReader createXMLReader() {

            // foreset parser cannot change the receivers while it's working,
            // so we need to have one XMLFilter that works as a buffer
            XMLFilter buffer = new XMLFilterImpl() {
                @Override
                public void parse(InputSource source) throws IOException, SAXException {
                    forest.createParser().parse( source, this, this, this );
                }
            };

            XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver);
            f.setParent(buffer);

            f.setEntityResolver(opt.entityResolver);

            return f;
        }
    };

    Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc );

    return loadRELAXNG(p);

}
 
Example #21
Source File: IncludeHost.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void endInclude(Parseable current, String uri, String ns, Location _loc, Annotations _anno) throws BuildException, IllegalSchemaException {
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    lhs.endInclude( current, uri, ns, loc.lhs, anno.lhs );
    rhs.endInclude( current, uri, ns, loc.rhs, anno.rhs );
}
 
Example #22
Source File: SchemaBuilderImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void endInclude(Parseable current, String uri, String ns,
        Location loc, Annotations anno) throws BuildException {
    for (OpenIncludes inc = sb.openIncludes;
            inc != null;
            inc = inc.parent) {
        if (inc.uri.equals(uri)) {
            sb.error("recursive_include", uri, (Locator) loc);
            return;
        }
    }

    for (Override o = overrides; o != null; o = o.next) {
        o.replacementStatus = o.prp.getReplacementStatus();
        o.prp.setReplacementStatus(RefPattern.REPLACEMENT_REQUIRE);
    }
    try {
        SchemaBuilderImpl isb = new SchemaBuilderImpl(ns, uri, sb);
        current.parseInclude(uri, isb, new GrammarImpl(isb, grammar), ns);
        for (Override o = overrides; o != null; o = o.next) {
            if (o.prp.getReplacementStatus() == RefPattern.REPLACEMENT_REQUIRE) {
                if (o.prp.getName() == null) {
                    sb.error("missing_start_replacement", (Locator) loc);
                } else {
                    sb.error("missing_define_replacement", o.prp.getName(), (Locator) loc);
                }
            }
        }
    } catch (IllegalSchemaException e) {
        sb.noteError();
    } finally {
        for (Override o = overrides; o != null; o = o.next) {
            o.prp.setReplacementStatus(o.replacementStatus);
        }
    }
}
 
Example #23
Source File: SchemaBuilderHost.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri,
    String ns, Scope _scope, Location _loc, Annotations _anno)
    throws BuildException, IllegalSchemaException {

    ScopeHost scope = (ScopeHost) _scope;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeExternalRef(current, uri, ns, scope.lhs, loc.lhs, anno.lhs),
        rhs.makeExternalRef(current, uri, ns, scope.rhs, loc.rhs, anno.rhs) );
}
 
Example #24
Source File: IncludeHost.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void endInclude(Parseable current, String uri, String ns, Location _loc, Annotations _anno) throws BuildException, IllegalSchemaException {
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    lhs.endInclude( current, uri, ns, loc.lhs, anno.lhs );
    rhs.endInclude( current, uri, ns, loc.rhs, anno.rhs );
}
 
Example #25
Source File: ModelLoader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a RELAX NG grammar into an annotated grammar.
 */
private Model loadRELAXNG() throws SAXException {

    // build DOM forest
    final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() );

    // use JAXP masquerading to validate the input document.
    // DOMForest -> ExtensionBindingChecker -> RNGOM

    XMLReaderCreator xrc = new XMLReaderCreator() {
        public XMLReader createXMLReader() {

            // foreset parser cannot change the receivers while it's working,
            // so we need to have one XMLFilter that works as a buffer
            XMLFilter buffer = new XMLFilterImpl() {
                @Override
                public void parse(InputSource source) throws IOException, SAXException {
                    forest.createParser().parse( source, this, this, this );
                }
            };

            XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver);
            f.setParent(buffer);

            f.setEntityResolver(opt.entityResolver);

            return f;
        }
    };

    Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc );

    return loadRELAXNG(p);

}
 
Example #26
Source File: ModelLoader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Loads RELAX NG compact syntax
 */
private Model loadRELAXNGCompact() {
    if(opt.getBindFiles().length>0)
        errorReceiver.error(new SAXParseException(
            Messages.format(Messages.ERR_BINDING_FILE_NOT_SUPPORTED_FOR_RNC),null));

    // TODO: entity resolver?
    Parseable p = new CompactParseable( opt.getGrammars()[0], errorReceiver );

    return loadRELAXNG(p);

}
 
Example #27
Source File: ModelLoader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Common part between the XML syntax and the compact syntax.
 */
private Model loadRELAXNG(Parseable p) {
    SchemaBuilder sb = new CheckingSchemaBuilder(new DSchemaBuilderImpl(),errorReceiver);

    try {
        DPattern out = (DPattern)p.parse(sb);
        return RELAXNGCompiler.build(out,codeModel,opt);
    } catch (IllegalSchemaException e) {
        errorReceiver.error(e.getMessage(),e);
        return null;
    }
}
 
Example #28
Source File: SchemaBuilderHost.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ParsedPattern makeExternalRef(Parseable current, String uri,
    String ns, Scope _scope, Location _loc, Annotations _anno)
    throws BuildException, IllegalSchemaException {

    ScopeHost scope = (ScopeHost) _scope;
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    return new ParsedPatternHost(
        lhs.makeExternalRef(current, uri, ns, scope.lhs, loc.lhs, anno.lhs),
        rhs.makeExternalRef(current, uri, ns, scope.rhs, loc.rhs, anno.rhs) );
}
 
Example #29
Source File: SchemaBuilderImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void endInclude(Parseable current, String uri, String ns,
        Location loc, Annotations anno) throws BuildException {
    for (OpenIncludes inc = sb.openIncludes;
            inc != null;
            inc = inc.parent) {
        if (inc.uri.equals(uri)) {
            sb.error("recursive_include", uri, (Locator) loc);
            return;
        }
    }

    for (Override o = overrides; o != null; o = o.next) {
        o.replacementStatus = o.prp.getReplacementStatus();
        o.prp.setReplacementStatus(RefPattern.REPLACEMENT_REQUIRE);
    }
    try {
        SchemaBuilderImpl isb = new SchemaBuilderImpl(ns, uri, sb);
        current.parseInclude(uri, isb, new GrammarImpl(isb, grammar), ns);
        for (Override o = overrides; o != null; o = o.next) {
            if (o.prp.getReplacementStatus() == RefPattern.REPLACEMENT_REQUIRE) {
                if (o.prp.getName() == null) {
                    sb.error("missing_start_replacement", (Locator) loc);
                } else {
                    sb.error("missing_define_replacement", o.prp.getName(), (Locator) loc);
                }
            }
        }
    } catch (IllegalSchemaException e) {
        sb.noteError();
    } finally {
        for (Override o = overrides; o != null; o = o.next) {
            o.prp.setReplacementStatus(o.replacementStatus);
        }
    }
}
 
Example #30
Source File: IncludeHost.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void endInclude(Parseable current, String uri, String ns, Location _loc, Annotations _anno) throws BuildException, IllegalSchemaException {
    LocationHost loc = cast(_loc);
    AnnotationsHost anno = cast(_anno);

    lhs.endInclude( current, uri, ns, loc.lhs, anno.lhs );
    rhs.endInclude( current, uri, ns, loc.rhs, anno.rhs );
}