当前位置: 首页>>代码示例>>Java>>正文


Java XSOMParser类代码示例

本文整理汇总了Java中com.sun.xml.xsom.parser.XSOMParser的典型用法代码示例。如果您正苦于以下问题:Java XSOMParser类的具体用法?Java XSOMParser怎么用?Java XSOMParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XSOMParser类属于com.sun.xml.xsom.parser包,在下文中一共展示了XSOMParser类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSchemaParser

import com.sun.xml.xsom.parser.XSOMParser; //导入依赖的package包/类
private XSOMParser createSchemaParser() {
	XSOMParser parser = new XSOMParser();
	if (entityResolver == null) {
		entityResolver = prismContext.getEntityResolver();
		if (entityResolver == null) {
			throw new IllegalStateException(
					"Entity resolver is not set (even tried to pull it from prism context)");
		}
	}
	SchemaHandler errorHandler = new SchemaHandler(entityResolver);
	parser.setErrorHandler(errorHandler);
	parser.setAnnotationParser(new DomAnnotationParserFactory());
	parser.setEntityResolver(errorHandler);

	return parser;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:17,代码来源:DomToSchemaProcessor.java

示例2: getSchemaSet

import com.sun.xml.xsom.parser.XSOMParser; //导入依赖的package包/类
private XSSchemaSet getSchemaSet()
	throws IOException, SAXException
{
	if ( schemaSet == null ) {
		XSOMParser schemaParser = new XSOMParser();
		ValueVector vec = getParameterVector( "schema" );
		if ( vec.size() > 0 ) {
			for( Value v : vec ) {
				schemaParser.parse( new File( v.strValue() ) );
			}
		}
		parseWSDLTypes( schemaParser );
		schemaSet = schemaParser.getResult();
		String nsPrefix = "jolie";
		int i = 1;
		for( XSSchema schema : schemaSet.getSchemas() ) {
			if ( !schema.getTargetNamespace().equals( XMLConstants.W3C_XML_SCHEMA_NS_URI ) ) {
				namespacePrefixMap.put( schema.getTargetNamespace(), nsPrefix + i++ );
			}
		}
	}

	return schemaSet;
}
 
开发者ID:jolie,项目名称:jolie,代码行数:25,代码来源:SoapProtocol.java

示例3: ParserContext

import com.sun.xml.xsom.parser.XSOMParser; //导入依赖的package包/类
public ParserContext( XSOMParser owner, XMLParser parser ) {
    this.owner = owner;
    this.parser = parser;

    try {
        parse(new InputSource(ParserContext.class.getResource("datatypes.xsd").toExternalForm()));

        SchemaImpl xs = (SchemaImpl)
            schemaSet.getSchema("http://www.w3.org/2001/XMLSchema");
        xs.addSimpleType(schemaSet.anySimpleType,true);
        xs.addComplexType(schemaSet.anyType,true);
    } catch( SAXException e ) {
        // this must be a bug of XSOM
        if(e.getException()!=null)
            e.getException().printStackTrace();
        else
            e.printStackTrace();
        throw new InternalError();
    }
}
 
开发者ID:jolie,项目名称:jolie,代码行数:21,代码来源:ParserContext.java

示例4: validateIsFaultType

import com.sun.xml.xsom.parser.XSOMParser; //导入依赖的package包/类
public static boolean validateIsFaultType(NamespaceType namespace, SchemaElementType type, File baseSchemaDir)
    throws Exception {
    XSOMParser parser = new XSOMParser();
    parser.setErrorHandler(new DefaultErrorHandler());

    parser.parse(new File(baseSchemaDir.getAbsolutePath() + File.separator + namespace.getLocation()));

    XSSchemaSet sset = parser.getResult();
    XSComplexType bfct = sset.getComplexType(IntroduceConstants.BASEFAULTS_NAMESPACE, "BaseFaultType");
    XSElementDecl ct = sset.getElementDecl(namespace.getNamespace(), type.getType());
    if (ct.getType().isDerivedFrom(bfct)) {
        return true;
    } else {
        return false;
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:17,代码来源:MethodViewer.java

示例5: parseWSDLTypes

import com.sun.xml.xsom.parser.XSOMParser; //导入依赖的package包/类
private void parseWSDLTypes( XSOMParser schemaParser )
	throws IOException
{
	Definition definition = getWSDLDefinition();
	if ( definition != null ) {
		Types types = definition.getTypes();
		if ( types != null ) {
			List<ExtensibilityElement> list = types.getExtensibilityElements();
			for( ExtensibilityElement element : list ) {
				if ( element instanceof SchemaImpl ) {
					Element schemaElement = ((SchemaImpl) element).getElement();
					Map<String, String> namespaces = definition.getNamespaces();
					for( Entry<String, String> entry : namespaces.entrySet() ) {
						if ( entry.getKey().equals( "xmlns" ) || entry.getKey().trim().isEmpty() ) {
							continue;
						}
						if ( schemaElement.getAttribute( "xmlns:" + entry.getKey() ).isEmpty() ) {
							schemaElement.setAttribute( "xmlns:" + entry.getKey(), entry.getValue() );
						}
					}
					parseSchemaElement( definition, schemaElement, schemaParser );
				}
			}
		}
	}
}
 
开发者ID:jolie,项目名称:jolie,代码行数:27,代码来源:SoapProtocol.java

示例6: parse

import com.sun.xml.xsom.parser.XSOMParser; //导入依赖的package包/类
public XSSchemaSet parse(String resource) throws Exception {
	final XSOMParser parser = new XSOMParser();
	parser.setErrorHandler(null);
	parser.setEntityResolver(null);

	final URL resourceUrl = getClass().getClassLoader().getResource(
			resource);
	// parser.parseSchema(
	//				
	// new File("myschema.xsd"));
	// parser.parseSchema( new File("XHTML.xsd"));
	parser.parse(resourceUrl);
	XSSchemaSet sset = parser.getResult();
	return sset;
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:16,代码来源:SimpleTypesAnalyzerTest.java

示例7: initXsom

import com.sun.xml.xsom.parser.XSOMParser; //导入依赖的package包/类
private void initXsom() throws IOException {
try {
	SchemaImpl schema = (SchemaImpl) wsdlObject.getTypes()
			.getExtensibilityElements().get(0);

	Element el = schema.getElement();
	InputStream is = prepareSchema(el);
	XSOMParser parser = new XSOMParser();

	// is needed to read element documentations which are inside
	// annotations
	parser.setAnnotationParser(new AnnotationFactory());

	parser.parse(is);

	String targetNamespace = wsdlObject.getTargetNamespace();

	if (parser.getResult() == null)
		throw new IOException(
				"Could not initialize XML Schema");
	schemaObject = parser.getResult().getSchema(targetNamespace);

	addSchemaElements();

} catch (TransformerException | SAXException e) {
	throw new IOException("Problem initializing XML Schema.", e);
}

  }
 
开发者ID:impactcentre,项目名称:iif-generic-soap-client,代码行数:30,代码来源:WsdlDocument.java

示例8: parse

import com.sun.xml.xsom.parser.XSOMParser; //导入依赖的package包/类
private XSSimpleType parse ( SchemaSimpleType schemaSimpleType ) {

        ClassLoader cldr = this.getClass().getClassLoader();

        InputStream resourceXMLSchema = cldr.getResourceAsStream( schemaSimpleType.getSchemaFilePath() );

        File localXMLSchema = new File( schemaSimpleType.getTypeName() + ".xsd" );
        try {
            InputStream in = resourceXMLSchema;
            // Overwrite the file.
            OutputStream out = new FileOutputStream( localXMLSchema );

            while (in.available() > 0) {
                byte[] buf = new byte[1024];
                int len;
                while ((len = in.read( buf )) > 0) {
                    out.write( buf, 0, len );
                }
            }
            in.close();
            out.close();

        } catch (IOException iOException) {
        }


        XSSimpleType st = null;
        try {
            XSOMParser parser = new XSOMParser();
            parser.parse( localXMLSchema );
            XSSchemaSet schemaSet = parser.getResult();
            XSSchema xsSchema = schemaSet.getSchema( 1 );

            st = xsSchema.getSimpleType( schemaSimpleType.getTypeName() );

        } catch (Exception exp) {
            exp.printStackTrace( System.out );
        }

        localXMLSchema.delete();

        return st;
    }
 
开发者ID:CIRDLES,项目名称:ET_Redux,代码行数:44,代码来源:XMLSchemaProcessor.java


注:本文中的com.sun.xml.xsom.parser.XSOMParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。