本文整理汇总了Java中com.sun.xml.xsom.parser.XSOMParser.parse方法的典型用法代码示例。如果您正苦于以下问题:Java XSOMParser.parse方法的具体用法?Java XSOMParser.parse怎么用?Java XSOMParser.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.xsom.parser.XSOMParser
的用法示例。
在下文中一共展示了XSOMParser.parse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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;
}