use of com.sun.xml.xsom.XSElementDecl in project schema2proto by entur.
the class SchemaTreeTraverser method schema.
/* (non-Javadoc)
* @see com.sun.xml.xsom.visitor.XSVisitor#schema(com.sun.xml.xsom.XSSchema)
*/
public void schema(XSSchema s) {
// QUICK HACK: don't print the built-in components
if (s.getTargetNamespace().equals(Const.schemaNamespace)) {
return;
}
SchemaTreeNode newNode = new SchemaTreeNode("Schema " + s.getLocator().getSystemId(), s.getLocator());
this.currNode = newNode;
this.model.addSchemaNode(newNode);
for (XSAttGroupDecl groupDecl : s.getAttGroupDecls().values()) {
attGroupDecl(groupDecl);
}
for (XSAttributeDecl attrDecl : s.getAttributeDecls().values()) {
attributeDecl(attrDecl);
}
for (XSComplexType complexType : s.getComplexTypes().values()) {
complexType(complexType);
}
for (XSElementDecl elementDecl : s.getElementDecls().values()) {
elementDecl(elementDecl);
}
for (XSModelGroupDecl modelGroupDecl : s.getModelGroupDecls().values()) {
modelGroupDecl(modelGroupDecl);
}
for (XSSimpleType simpleType : s.getSimpleTypes().values()) {
simpleType(simpleType);
}
}
use of com.sun.xml.xsom.XSElementDecl in project schema2proto by entur.
the class SchemaWriter method schema.
public void schema(XSSchema s) {
// QUICK HACK: don't print the built-in components
if (s.getTargetNamespace().equals(Const.schemaNamespace))
return;
println(MessageFormat.format("<schema targetNamespace=\"{0}\">", s.getTargetNamespace()));
indent++;
Iterator itr;
itr = s.iterateAttGroupDecls();
while (itr.hasNext()) attGroupDecl((XSAttGroupDecl) itr.next());
itr = s.iterateAttributeDecls();
while (itr.hasNext()) attributeDecl((XSAttributeDecl) itr.next());
itr = s.iterateComplexTypes();
while (itr.hasNext()) complexType((XSComplexType) itr.next());
itr = s.iterateElementDecls();
while (itr.hasNext()) elementDecl((XSElementDecl) itr.next());
itr = s.iterateModelGroupDecls();
while (itr.hasNext()) modelGroupDecl((XSModelGroupDecl) itr.next());
itr = s.iterateSimpleTypes();
while (itr.hasNext()) simpleType((XSSimpleType) itr.next());
indent--;
println("</schema>");
}
use of com.sun.xml.xsom.XSElementDecl in project jolie by jolie.
the class SchemaWriter method particle.
public void particle(XSParticle part) {
int i;
StringBuffer buf = new StringBuffer();
i = part.getMaxOccurs();
if (i == XSParticle.UNBOUNDED)
buf.append(" maxOccurs=\"unbounded\"");
else if (i != 1)
buf.append(" maxOccurs=\"" + i + '\"');
i = part.getMinOccurs();
if (i != 1)
buf.append(" minOccurs=\"" + i + '\"');
final String extraAtts = buf.toString();
part.getTerm().visit(new XSTermVisitor() {
public void elementDecl(XSElementDecl decl) {
if (decl.isLocal())
SchemaWriter.this.elementDecl(decl, extraAtts);
else {
// reference
println(MessageFormat.format("<element ref=\"'{'{0}'}'{1}\"{2}/>", new Object[] { decl.getTargetNamespace(), decl.getName(), extraAtts }));
}
}
public void modelGroupDecl(XSModelGroupDecl decl) {
// reference
println(MessageFormat.format("<group ref=\"'{'{0}'}'{1}\"{2}/>", new Object[] { decl.getTargetNamespace(), decl.getName(), extraAtts }));
}
public void modelGroup(XSModelGroup group) {
SchemaWriter.this.modelGroup(group, extraAtts);
}
public void wildcard(XSWildcard wc) {
SchemaWriter.this.wildcard(wc, extraAtts);
}
});
}
use of com.sun.xml.xsom.XSElementDecl in project jolie by jolie.
the class SchemaTreeTraverser method schema.
/* (non-Javadoc)
* @see com.sun.xml.xsom.visitor.XSVisitor#schema(com.sun.xml.xsom.XSSchema)
*/
public void schema(XSSchema s) {
// QUICK HACK: don't print the built-in components
if (s.getTargetNamespace().equals(Const.schemaNamespace)) {
return;
}
SchemaTreeNode newNode = new SchemaTreeNode("Schema " + s.getLocator().getSystemId(), s.getLocator());
this.currNode = newNode;
this.model.addSchemaNode(newNode);
for (XSAttGroupDecl groupDecl : s.getAttGroupDecls().values()) {
attGroupDecl(groupDecl);
}
for (XSAttributeDecl attrDecl : s.getAttributeDecls().values()) {
attributeDecl(attrDecl);
}
for (XSComplexType complexType : s.getComplexTypes().values()) {
complexType(complexType);
}
for (XSElementDecl elementDecl : s.getElementDecls().values()) {
elementDecl(elementDecl);
}
for (XSModelGroupDecl modelGroupDecl : s.getModelGroupDecls().values()) {
modelGroupDecl(modelGroupDecl);
}
for (XSSimpleType simpleType : s.getSimpleTypes().values()) {
simpleType(simpleType);
}
}
use of com.sun.xml.xsom.XSElementDecl in project eclipselink by eclipse-ee4j.
the class BeanValidationPlugin method processElement.
/**
* Processes an xsd element.
* <p>
* Example:
* {@code <xsd:element name="someCollection" minOccurs="1" maxOccurs="unbounded"/>}
*/
private void processElement(CElementPropertyInfo propertyInfo, ClassOutline co, List<FacetCustomization> customizations) {
XSParticle particle = (XSParticle) propertyInfo.getSchemaComponent();
JFieldVar fieldVar = co.implClass.fields().get(propertyInfo.getName(false));
processMinMaxOccurs(particle, fieldVar);
XSTerm term = particle.getTerm();
if (term instanceof XSElementDecl) {
processTermElement(particle, fieldVar, (XSElementDecl) term, customizations);
// When a complex type resides inside another complex type and thus gets lazily loaded or processed.
} else if (term instanceof DelayedRef.Element) {
processTermElement(particle, fieldVar, ((DelayedRef.Element) term).get(), customizations);
}
}
Aggregations