Search in sources :

Example 11 with ElementInfo

use of com.predic8.membrane.annot.model.ElementInfo in project service-proxy by membrane.

the class Schemas method assembleElementInfo.

private void assembleElementInfo(Writer w, Model m, MainInfo main, ElementInfo i) throws IOException {
    w.append("<xsd:sequence>\r\n");
    for (ChildElementInfo cei : i.getCeis()) {
        w.append("<xsd:choice" + (cei.isRequired() ? " minOccurs=\"1\"" : " minOccurs=\"0\"") + (cei.isList() ? " maxOccurs=\"unbounded\"" : "") + ">\r\n");
        assembleDocumentation(w, i);
        for (ElementInfo ei : main.getChildElementDeclarations().get(cei.getTypeDeclaration()).getElementInfo()) {
            if (ei.getAnnotation().topLevel())
                w.append("<xsd:element ref=\"" + ei.getAnnotation().name() + "\">\r\n");
            else
                w.append("<xsd:element name=\"" + ei.getAnnotation().name() + "\" type=\"" + ei.getXSDTypeName(m) + "\">\r\n");
            assembleDocumentation(w, ei);
            w.append("</xsd:element>\r\n");
        }
        if (cei.getAnnotation().allowForeign())
            w.append("<xsd:any namespace=\"##other\" processContents=\"strict\" />\r\n");
        w.append("</xsd:choice>\r\n");
    }
    w.append("</xsd:sequence>\r\n");
    for (AttributeInfo ai : i.getAis()) if (!ai.getXMLName().equals("id"))
        assembleAttributeDeclaration(w, ai);
    if (i.getOai() != null) {
        w.append("<xsd:anyAttribute processContents=\"skip\">\r\n");
        assembleDocumentation(w, i.getOai());
        w.append("</xsd:anyAttribute>\r\n");
    }
}
Also used : AttributeInfo(com.predic8.membrane.annot.model.AttributeInfo) ElementInfo(com.predic8.membrane.annot.model.ElementInfo) ChildElementInfo(com.predic8.membrane.annot.model.ChildElementInfo) ChildElementInfo(com.predic8.membrane.annot.model.ChildElementInfo)

Aggregations

ChildElementInfo (com.predic8.membrane.annot.model.ChildElementInfo)11 ElementInfo (com.predic8.membrane.annot.model.ElementInfo)9 AttributeInfo (com.predic8.membrane.annot.model.AttributeInfo)5 ChildElementDeclarationInfo (com.predic8.membrane.annot.model.ChildElementDeclarationInfo)5 MainInfo (com.predic8.membrane.annot.model.MainInfo)5 TypeElement (javax.lang.model.element.TypeElement)5 BufferedWriter (java.io.BufferedWriter)4 ArrayList (java.util.ArrayList)4 FilerException (javax.annotation.processing.FilerException)4 Element (javax.lang.model.element.Element)4 FileObject (javax.tools.FileObject)4 OtherAttributesInfo (com.predic8.membrane.annot.model.OtherAttributesInfo)2 Model (com.predic8.membrane.annot.model.Model)1 TextContentInfo (com.predic8.membrane.annot.model.TextContentInfo)1 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 DeclaredType (javax.lang.model.type.DeclaredType)1 TypeMirror (javax.lang.model.type.TypeMirror)1