Examples of DOMForest


Examples of com.sun.tools.xjc.reader.internalizer.DOMForest

    private XSSchemaSet loadWSDL()
        throws SAXException {

       
        // build DOMForest just like we handle XML Schema
        DOMForest forest = buildDOMForest( new XMLSchemaInternalizationLogic() );
       
        DOMForestScanner scanner = new DOMForestScanner(forest);
       
        XSOMParser xsomParser = createXSOMParser( forest );
       
        // find <xsd:schema>s and parse them individually
        for( InputSource grammar : opt.getGrammars() ) {
            Document wsdlDom = forest.get( grammar.getSystemId() );

            NodeList schemas = wsdlDom.getElementsByTagNameNS(WellKnownNamespace.XML_SCHEMA,"schema");
            for( int i=0; i<schemas.getLength(); i++ )
                scanner.scan( (Element)schemas.item(i), xsomParser.getParserHandler() );
        }
View Full Code Here

Examples of com.sun.tools.xjc.reader.internalizer.DOMForest

     * 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() {
                    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);
View Full Code Here

Examples of com.sun.tools.xjc.reader.internalizer.DOMForest

            if( opt.mode==Mode.FOREST ) {
                // dump DOM forest and quit
                ModelLoader loader  = new ModelLoader( opt, new JCodeModel(), receiver );
                try {
                    DOMForest forest = loader.buildDOMForest(new XMLSchemaInternalizationLogic());
                    forest.dump(System.out);
                    return 0;
                } catch (SAXException e) {
                    // the error should have already been reported
                } catch (IOException e) {
                    receiver.error(e);
View Full Code Here

Examples of com.sun.tools.xjc.reader.internalizer.DOMForest

    public void setClassNameAllocator(ClassNameAllocator allocator) {
        opts.classNameAllocator = allocator;
    }

    public void resetSchema() {
        forest = new DOMForest(new XMLSchemaInternalizationLogic());
        forest.setErrorHandler(this);
        forest.setEntityResolver(opts.entityResolver);
    }
View Full Code Here

Examples of com.sun.tools.xjc.reader.internalizer.DOMForest

                    return new ReferenceFinder(parent, catalog);
                }
            };
           
            Constructor<DOMForest> c = null;
            DOMForest forest = null;

            try {
                c = DOMForest.class.getConstructor(InternalizationLogic.class, Options.class);
                forest = c.newInstance(logic, opts);
            } catch (Throwable t) {
                c = DOMForest.class.getConstructor(InternalizationLogic.class);
                forest = c.newInstance(logic);
            }
            forest.setErrorHandler((ErrorReceiver)schemaCompiler);
            f.set(schemaCompiler, forest);
        } catch (Throwable ex)  {
            //ignore
        }
    }
View Full Code Here

Examples of com.sun.tools.xjc.reader.internalizer.DOMForest

  /**
   * Return values of all {@code <jaxb:class ref="..." />} attributes.
   */
  private Set<String> getClassReferencesFromEpisodeFile(String episodeFile) throws SAXException {
    DOMForest forest = new DOMForest(new XMLSchemaInternalizationLogic(), new Options());

    Document episodeDocument = forest.parse(new InputSource(episodeFile), true);

    NodeList nodeList = episodeDocument.getElementsByTagNameNS(Const.JAXB_NSURI, "class");
    Set<String> classReferences = new HashSet<String>();

    for (int i = 0, len = nodeList.getLength(); i < len; i++) {
View Full Code Here

Examples of com.sun.tools.xjc.reader.internalizer.DOMForest

    public void setClassNameAllocator(ClassNameAllocator allocator) {
        opts.classNameAllocator = allocator;
    }

    public void resetSchema() {
        forest = new DOMForest(new XMLSchemaInternalizationLogic());
        forest.setErrorHandler(this);
        forest.setEntityResolver(opts.entityResolver);
    }
View Full Code Here

Examples of com.sun.tools.xjc.reader.internalizer.DOMForest

            if( opt.mode==Mode.FOREST ) {
                // dump DOM forest and quit
                ModelLoader loader  = new ModelLoader( opt, new JCodeModel(), receiver );
                try {
                    DOMForest forest = loader.buildDOMForest(new XMLSchemaInternalizationLogic());
                    forest.dump(System.out);
                    return 0;
                } catch (SAXException e) {
                    // the error should have already been reported
                } catch (IOException e) {
                    receiver.error(e);
View Full Code Here

Examples of com.sun.tools.xjc.reader.internalizer.DOMForest

            if( opt.mode==Mode.FOREST ) {
                // dump DOM forest and quit
                ModelLoader loader  = new ModelLoader( opt, new JCodeModel(), receiver );
                try {
                    DOMForest forest = loader.buildDOMForest(new XMLSchemaInternalizationLogic());
                    forest.dump(System.out);
                    return 0;
                } catch (SAXException e) {
                    // the error should have already been reported
                } catch (IOException e) {
                    receiver.error(e);
View Full Code Here

Examples of com.sun.tools.xjc.reader.internalizer.DOMForest

    private void hackInNewInternalizationLogic(SchemaCompiler schemaCompiler,
                                               final OASISCatalogManager catalog) {
        try {
            Field f = schemaCompiler.getClass().getDeclaredField("forest");
            f.setAccessible(true);
            DOMForest forest = new DOMForest(new XMLSchemaInternalizationLogic() {
                public XMLFilterImpl createExternalReferenceFinder(DOMForest parent) {
                    return new ReferenceFinder(parent, catalog);
                }

            });
            forest.setErrorHandler((ErrorReceiver)schemaCompiler);
            f.set(schemaCompiler, forest);
        } catch (Throwable ex)  {
            //ignore
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.