Exemplo n.º 1
0
 private void assembleAttributeDeclaration(Writer w, AttributeInfo ai) throws IOException {
   // TODO: default value
   w.append(
       "<xsd:attribute name=\""
           + ai.getXMLName()
           + "\" type=\""
           + ai.getXSDType(processingEnv.getTypeUtils())
           + "\" "
           + (ai.isRequired() ? "use=\"required\"" : "")
           + ">\r\n");
   assembleDocumentation(w, ai);
   w.append("</xsd:attribute>\r\n");
 }
Exemplo n.º 2
0
 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");
   }
 }