use of com.sun.xml.xsom.XSSimpleType in project atlasmap by atlasmap.
the class SchemaWriter method listSimpleType.
public void listSimpleType(XSListSimpleType type) {
XSSimpleType itemType = type.getItemType();
if (itemType.isLocal()) {
println("<list>");
indent++;
simpleType(itemType);
indent--;
println("</list>");
} else {
// global type
println(MessageFormat.format("<list itemType=\"'{'{0}'}'{1}\" />", itemType.getTargetNamespace(), itemType.getName()));
}
}
use of com.sun.xml.xsom.XSSimpleType in project atlasmap by atlasmap.
the class redefine method action3.
private void action3() throws SAXException {
XSSimpleType oldSt = $runtime.currentSchema.getSimpleType(newSt.getName());
if (oldSt == null) {
$runtime.reportError(Messages.format(Messages.ERR_UNDEFINED_SIMPLETYPE, newSt.getName()));
} else {
newSt.redefine((SimpleTypeImpl) oldSt);
$runtime.currentSchema.addSimpleType(newSt, true);
}
}
use of com.sun.xml.xsom.XSSimpleType in project atlasmap by atlasmap.
the class SchemaTreeTraverser method unionSimpleType.
/* (non-Javadoc)
* @see com.sun.xml.xsom.visitor.XSSimpleTypeVisitor#unionSimpleType(com.sun.xml.xsom.XSUnionSimpleType)
*/
public void unionSimpleType(XSUnionSimpleType type) {
final int len = type.getMemberSize();
StringBuffer ref = new StringBuffer();
for (int i = 0; i < len; i++) {
XSSimpleType member = type.getMember(i);
if (member.isGlobal()) {
ref.append(MessageFormat.format(" '{'{0}'}'{1}", new Object[] { member.getTargetNamespace(), member.getName() }));
}
}
String name = (ref.length() == 0) ? "Union" : ("Union memberTypes=\"" + ref + "\"");
SchemaTreeNode newNode = new SchemaTreeNode(name, type.getLocator());
this.currNode.add(newNode);
this.currNode = newNode;
for (int i = 0; i < len; i++) {
XSSimpleType member = type.getMember(i);
if (member.isLocal()) {
simpleType(member);
}
}
this.currNode = (SchemaTreeNode) this.currNode.getParent();
}
use of com.sun.xml.xsom.XSSimpleType in project atlasmap by atlasmap.
the class XmlSchemaInspector method printAttributes.
private void printAttributes(XSComplexType xsComplexType, XmlComplexType parentXmlComplexType) {
Collection<? extends XSAttributeUse> c = xsComplexType.getDeclaredAttributeUses();
for (XSAttributeUse aC : c) {
XmlField xmlField = AtlasXmlModelFactory.createXmlField();
XSAttributeDecl attributeDecl = aC.getDecl();
xmlField.setName(getNameNS(attributeDecl));
xmlField.setAttribute(true);
if (attributeDecl.getDefaultValue() != null) {
xmlField.setValue(attributeDecl.getDefaultValue().value);
} else if (attributeDecl.getFixedValue() != null) {
xmlField.setValue(attributeDecl.getFixedValue().value);
}
xmlField.setPath(parentXmlComplexType.getPath() + "/" + "@" + getNameNS(attributeDecl));
FieldType attrType = getFieldType(attributeDecl.getType().getName());
xmlField.setFieldType(attrType);
if (xmlField.getFieldType() == null) {
// check the simple types in the schema....
XSSimpleType simpleType = xsComplexType.getRoot().getSimpleType(xsComplexType.getTargetNamespace(), attributeDecl.getType().getName());
if (simpleType != null) {
FieldType fieldType = getFieldType(simpleType.getBaseType().getName());
xmlField.setFieldType(fieldType);
xmlField.setTypeName(attributeDecl.getType().getName());
if (simpleType.asRestriction() != null) {
mapRestrictions(xmlField, simpleType.asRestriction());
}
} else {
// cannot figure it out....
xmlField.setFieldType(FieldType.UNSUPPORTED);
}
}
parentXmlComplexType.getXmlFields().getXmlField().add(xmlField);
}
}
Aggregations