use of com.sun.xml.xsom.XSTerm in project BIMserver by opensourceBIM.
the class XSDSchemaReader method createGroup.
private void createGroup(XSModelGroupDecl modelGroupDecl) {
EClass eClass = ecoreFactory.createEClass();
eClass.setName(modelGroupDecl.getName());
ePackage.getEClassifiers().add(eClass);
for (XSParticle particle : modelGroupDecl.getModelGroup().getChildren()) {
XSTerm term = particle.getTerm();
if (term.isElementDecl()) {
String name = term.asElementDecl().getName();
EClassifier subClass = ePackage.getEClassifier(name);
if (subClass != null && subClass instanceof EClass) {
((EClass) subClass).getESuperTypes().add(eClass);
}
}
}
}
use of com.sun.xml.xsom.XSTerm in project BIMserver by opensourceBIM.
the class XSDSchemaReader method fillComplexType.
private void fillComplexType(XSComplexType type) {
EClass eClass = (EClass) ePackage.getEClassifier(type.getName());
String superTypeName = type.getBaseType().getName();
EClass superType = (EClass) ePackage.getEClassifier(superTypeName);
if (superType != null) {
eClass.getESuperTypes().add(superType);
} else {
if (!superTypeName.equals("Entity") && !superTypeName.equals("anyType")) {
System.out.println("Super type not found: " + superTypeName);
}
}
XSParticle particle = type.getContentType().asParticle();
if (particle != null) {
XSTerm term = particle.getTerm();
if (term.isModelGroup()) {
XSModelGroup xsModelGroup = term.asModelGroup();
for (XSParticle p : xsModelGroup.getChildren()) {
XSTerm pterm = p.getTerm();
if (pterm.isModelGroup()) {
XSModelGroup asModelGroup = pterm.asModelGroup();
for (XSParticle x : asModelGroup.getChildren()) {
XSTerm term2 = x.getTerm();
if (term2.isElementDecl()) {
processElementDecl(eClass, term2.asElementDecl());
}
}
} else if (pterm.isElementDecl()) {
processElementDecl(eClass, pterm.asElementDecl());
}
}
} else if (term.isModelGroupDecl()) {
// EReference eReference = ecoreFactory.createEReference();
// eReference.setName(term.asModelGroupDecl().getName());
// EClassifier eClassifier =
// ePackage.getEClassifier(term.asModelGroupDecl().getName());
// eReference.setEType(eClassifier);
// eClass.getEStructuralFeatures().add(eReference);
} else if (term.isElementDecl()) {
System.out.println("ed");
} else {
System.out.println("lala");
}
}
}
use of com.sun.xml.xsom.XSTerm in project atlasmap by atlasmap.
the class SchemaInspector method printParticle.
private void printParticle(XSParticle particle, String rootName, XmlComplexType xmlComplexType) throws Exception {
XSTerm term = particle.getTerm();
if (term.isModelGroup()) {
XSModelGroup group = term.asModelGroup();
printGroup(group, rootName, xmlComplexType);
} else if (term.isModelGroupDecl()) {
printGroupDecl(term.asModelGroupDecl(), rootName, xmlComplexType);
} else if (term.isElementDecl()) {
CollectionType collectionType = getCollectionType(particle);
printElement(term.asElementDecl(), rootName, xmlComplexType, collectionType);
}
}
use of com.sun.xml.xsom.XSTerm in project atlasmap by atlasmap.
the class XmlSchemaInspector method printParticle.
private void printParticle(XSParticle particle, XmlComplexType parentXmlComplexType, Set<String> cachedComplexType) throws Exception {
XSTerm term = particle.getTerm();
if (term.isModelGroup()) {
XSModelGroup group = term.asModelGroup();
printGroup(group, parentXmlComplexType, cachedComplexType);
} else if (term.isModelGroupDecl()) {
printGroupDecl(term.asModelGroupDecl(), parentXmlComplexType, cachedComplexType);
} else if (term.isElementDecl()) {
CollectionType collectionType = getCollectionType(particle);
printElement(term.asElementDecl(), parentXmlComplexType, collectionType, cachedComplexType);
}
}
use of com.sun.xml.xsom.XSTerm in project narayana by jbosstm.
the class NBFSchemaParser method findElementType.
private void findElementType(XSComplexType xtype) {
XSContentType xsContentType = xtype.getContentType();
XSParticle particle = xsContentType.asParticle();
if (particle != null) {
XSTerm term = particle.getTerm();
if (term.isModelGroup()) {
XSModelGroup xsModelGroup = term.asModelGroup();
XSParticle[] particles = xsModelGroup.getChildren();
for (XSParticle p : particles) {
XSTerm pterm = p.getTerm();
if (pterm.isElementDecl()) {
XSElementDecl element = pterm.asElementDecl();
String name = element.getName();
log.debug(name);
XSType type = element.getType();
while (type != null) {
String typeName = type.getName();
if (typeName != null && (typeName.equals("long") || typeName.equals("string") || typeName.equals("integer") || typeName.equals("float") || typeName.endsWith("_type"))) {
log.debug(typeName);
flds.put(name, typeName);
break;
}
type = type.getBaseType();
}
}
}
}
}
}
Aggregations