use of com.sun.xml.xsom.parser.XSOMParser in project atlasmap by atlasmap.
the class AtlasXmlSchemaSetParser method createXSOMParser.
private XSOMParser createXSOMParser() {
XSOMParser parser = new XSOMParser(this.saxParserFactory);
parser.setEntityResolver(new XSOMClasspathEntityResolver(this.classLoader));
parser.setAnnotationParser(new DomAnnotationParserFactory());
parser.setErrorHandler(new XSOMErrorHandler());
return parser;
}
use of com.sun.xml.xsom.parser.XSOMParser in project BIMserver by opensourceBIM.
the class XSDSchemaReader method start.
@SuppressWarnings("deprecation")
private void start() {
ePackage = ecoreFactory.createEPackage();
ePackage.setName("ifc2x3");
ePackage.setNsPrefix("iai");
ePackage.setNsURI("http:///buildingsmart.ifc.ecore");
XSOMParser parser = new XSOMParser();
try {
parser.parse(getClass().getResource("IFC2X3.xsd"));
XSSchemaSet schemas = parser.getResult();
for (XSSchema schema : schemas.getSchemas()) {
if (schema.getTargetNamespace().equals("http://www.iai-tech.org/ifcXML/IFC2x3/FINAL")) {
for (XSComplexType type : schema.getComplexTypes().values()) {
createComplexType(type);
}
for (XSSimpleType simpleType : schema.getSimpleTypes().values()) {
createSimpleType(simpleType);
}
}
}
for (XSSchema schema : schemas.getSchemas()) {
if (schema.getTargetNamespace().equals("http://www.iai-tech.org/ifcXML/IFC2x3/FINAL")) {
for (XSComplexType type : schema.getComplexTypes().values()) {
fillComplexType(type);
}
for (XSModelGroupDecl modelGroupDecl : schema.getModelGroupDecls().values()) {
createGroup(modelGroupDecl);
}
}
}
writeEMF("test.ecore");
} catch (SAXException e) {
e.printStackTrace();
}
}
use of com.sun.xml.xsom.parser.XSOMParser in project narayana by jbosstm.
the class NBFSchemaParser method parse.
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", ""));
if (element != null) {
log.debug("element is " + element.getName());
bufferName = element.getName();
XSType xtype = element.getType();
if (xtype.isComplexType()) {
findElementType(xtype.asComplexType());
rc = true;
}
}
} catch (Exception e) {
log.error("parse " + fname + " failed with " + e.getMessage(), e);
}
return rc;
}
use of com.sun.xml.xsom.parser.XSOMParser in project esb0 by karalus.
the class XSDArtifact method getXSSchemaSet.
@Override
public XSSchemaSet getXSSchemaSet() throws SAXException {
if (_schemaSet == null) {
XSOMParser xsomParser = new XSOMParser(JAXPFactoryHelper.getSAXParserFactory());
xsomParser.setEntityResolver(getResolver());
InputSource is = new InputSource(getContentAsStream());
is.setSystemId(getURI());
xsomParser.parse(is);
_schemaSet = xsomParser.getResult();
}
return _schemaSet;
}
use of com.sun.xml.xsom.parser.XSOMParser in project esb0 by karalus.
the class JsonSchemaGenerator method createJsonSchemaGenerator.
public static JsonSchemaGenerator createJsonSchemaGenerator(String systemId, String namespace) throws SAXException {
XSOMParser xsomParser = new XSOMParser(JAXPFactoryHelper.getSAXParserFactory());
xsomParser.parse(systemId);
// System.out.println("Number of parsed docs: " + xsomParser.getDocuments().size());
Map<String, String> prefixMap = new HashMap<String, String>();
prefixMap.put("", namespace);
return new JsonSchemaGenerator(xsomParser.getResult(), prefixMap);
}
Aggregations