Package com.sun.xml.xsom.parser

Examples of com.sun.xml.xsom.parser.XSOMParser


    public LinkedHashMap<String,LinkedHashMap> parseFile( InputStream inputFile ) {
        LinkedHashMap<String,LinkedHashMap> fields = new LinkedHashMap<String, LinkedHashMap>();

        try {
            XSOMParser parser = new XSOMParser();
            ParseErrorHandler parserError = new ParseErrorHandler();
            parser.setErrorHandler(parserError);

            parser.parse(inputFile);

/*            Set<SchemaDocument> docs = parser.getDocuments();
            Iterator<SchemaDocument> docIt = docs.iterator();

            while( docIt.hasNext() ) {
                SchemaDocument doc = docIt.next();
            }*/

            XSSchemaSet set = parser.getResult();

            LinkedHashMap<String,LinkedHashMap> elementField = null;
            Iterator<XSElementDecl> jtr = set.iterateElementDecls();
            while( jtr.hasNext() ) {
                XSElementDecl ele = jtr.next();
View Full Code Here


  public boolean parse(String fname) {
    boolean rc = false;

    try {
      flds.clear();
      XSOMParser parser = new XSOMParser();
      parser.parse(fname);
      XSSchemaSet xsSchema = parser.getResult();
      XSSchema schema = xsSchema.getSchema(1);
      File file = new File(fname);

      XSElementDecl element = schema.getElementDecl(file.getName().replace(".xsd", ""));
View Full Code Here

         configBeans.add(InfinispanConfiguration.class);

         XMLTreeOutputWalker tw = new XMLTreeOutputWalker(sb);
         FileLookup fl = new FileLookup();
         InputStream file = fl.lookupFile("schema/infinispan-config-" + Version.getMajorVersion() + ".xsd");
         XSOMParser reader = new XSOMParser();
         reader.parse(file);
         XSSchemaSet xss = reader.getResult();
         XSOMSchemaTreeWalker w = new XSOMSchemaTreeWalker(xss.getSchema(1), "infinispan");
         TreeNode root = w.getRoot();

         associateBeansWithTreeNodes(configBeans, root);
View Full Code Here

         if (file == null)
            throw new Exception("Schema file " + schemaFile
                     + " not found on classpath. Documentation creation aborted");

         XSOMParser reader = new XSOMParser();
         reader.parse(file);
         XSSchemaSet xss = reader.getResult();
         XSOMSchemaTreeWalker w = new XSOMSchemaTreeWalker(xss.getSchema(1), getRootElementName());
         TreeNode root = w.getRoot();
         associateBeansWithTreeNodes(configBeans, root);

         preXMLTableOfContentsCreate(w, tw);
View Full Code Here

    StreamResult result = new StreamResult(tempSchemaStream);
    transformer.transform(source, result);
    tempSchemaStream.close();

    //set up the XSOM Parser.
    XSOMParser parser = new XSOMParser();
    parser.setErrorHandler(new ThrowEverythingHandler()); //throw all errors and warnings.

    //make sure the schema included in the wsdl is correct.
    parser.parse(tempSchemaFile.toURI().toURL());
    XSSchemaSet schemaSet = parser.getResult();
    XSSchema wsdlSchema = schemaSet.getSchema(FULL_NAMESPACE);
    assertNotNull(wsdlSchema);

    //make sure the data schema is imported and correct.
    XSSchema dataSchema = schemaSet.getSchema(DATA_NAMESPACE);
View Full Code Here

        // 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() );
        }
        return xsomParser.getResult();
    }
View Full Code Here

        return BGMBuilder.build(xs, codeModel, errorReceiver, opt);
    }

    public XSOMParser createXSOMParser(XMLParser parser) {
        // set up other parameters to XSOMParser
        XSOMParser reader = new XSOMParser(new XMLSchemaParser(parser));
        reader.setAnnotationParser(new AnnotationParserFactoryImpl(opt));
        reader.setErrorHandler(errorReceiver);
        reader.setEntityResolver(opt.entityResolver);
        return reader;
    }
View Full Code Here

        reader.setEntityResolver(opt.entityResolver);
        return reader;
    }

    public XSOMParser createXSOMParser(final DOMForest forest) {
        XSOMParser p = createXSOMParser(forest.createParser());
        p.setEntityResolver(new EntityResolver() {
            public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                // DOMForest only parses documents that are rearchable through systemIds,
                // and it won't pick up references like <xs:import namespace="..." /> without
                // @schemaLocation. So we still need to use an entity resolver here to resolve
                // these references, yet we don't want to just run them blindly, since if we do that
View Full Code Here

                filter.setContentHandler(handler);
                return filter;
            }
        };

        XSOMParser reader = createXSOMParser(parser);

        // parse source grammars
        for (InputSource value : opt.getGrammars())
            reader.parse(value);

        return reader.getResult();
    }
View Full Code Here

     * @return
     *      null if the parsing failed.
     */
    public XSSchemaSet createXSOM(DOMForest forest, SCDBasedBindingSet scdBasedBindingSet) throws SAXException {
        // set up other parameters to XSOMParser
        XSOMParser reader = createXSOMParser(forest);

        // re-parse the transformed schemas
        for (String systemId : forest.getRootDocuments()) {
            errorReceiver.pollAbort();
            Document dom = forest.get(systemId);
            if (!dom.getDocumentElement().getNamespaceURI().equals(Const.JAXB_NSURI))
                reader.parse(systemId);
        }

        XSSchemaSet result = reader.getResult();

        if(result!=null)
            scdBasedBindingSet.apply(result,errorReceiver);

        return result;
View Full Code Here

TOP

Related Classes of com.sun.xml.xsom.parser.XSOMParser

Copyright © 2018 www.massapicom. 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.