Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSElementDeclaration


      if (!isDocStyle())
      {
         JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
         XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());

         XSElementDeclaration unwrapped = SchemaUtils.unwrapArrayType(xt);
         StringBuilder builder = new StringBuilder();

         while (unwrapped != null)
         {
            xt = unwrapped.getTypeDefinition();
            primitive = !unwrapped.getNillable();
            builder.append("[]");
            unwrapped = SchemaUtils.unwrapArrayType(xt);
         }
         if (builder.length() > 0)
         {
View Full Code Here


      //Consider Global Element Declarations that may have anonymous complex types
      xsnamedmap = xsmodel.getComponents(XSConstants.ELEMENT_DECLARATION);
      len = xsnamedmap != null ? xsnamedmap.getLength() : 0;
      for (int i = 0; i < len; i++)
      {
         XSElementDeclaration elm = (XSElementDeclaration)xsnamedmap.item(i);
         String elmname = elm.getName();
         XSTypeDefinition elmtype = elm.getTypeDefinition();
         if (elmtype != null && elmtype instanceof XSComplexTypeDefinition)
         {
            XSComplexTypeDefinition ctype = (XSComplexTypeDefinition)elmtype;
            String nsuri = elmtype.getNamespace();
            String tname = elmtype.getName();
View Full Code Here

      {
         vars.addAll(createVARsforXSModelGroup((XSModelGroup)xsterm, schema, origType));
         return vars;
      }

      XSElementDeclaration elem = (XSElementDeclaration)xsterm;

      //    TODO: Check if the element contains any anon complex type
      //    TODO: If yes, create class that is ComplexTypeName+ElementName
      //    TODO: ItemsItem  If the elem contains anon simpletype
      //    TODO: No need to create seperate Java class

      String tname = elem.getName();
      XSTypeDefinition xstypedef = elem.getTypeDefinition();

      String xstypename = xstypedef.getName();
      // Check if it is a composite type
      if (xstypename != null && xstypedef.getName().equals(origType.getName()) && xstypedef.getNamespace().equals(origType.getNamespace()))
      {
         // it is a composite type
         QName qn = new QName(origType.getNamespace(), origType.getName());
         VAR vr = createVAR(qn, elem, (XSComplexTypeDefinition)xstypedef, tname, pkgname, arrayType);
         vars.add(vr);
         return vars;
      }
      else

      if (xstypename == null && xstypedef instanceof XSComplexTypeDefinition)
      {
         XSComplexTypeDefinition xsc = (XSComplexTypeDefinition)xstypedef;
         String subname = utils.firstLetterUpperCase(tname);
         // Save the fname in a temp var
         String tempfname = this.fname;
         // it will be an anonymous type
         if (containingElement == null || containingElement.length() == 0)
            containingElement = origType.getName();

         String anonName;
         if (elem.getScope() == XSConstants.SCOPE_GLOBAL)
         {
            anonName = subname;
         }
         else
         {
            anonName = containingElement + subname;
         }

         anonName = utils.firstLetterUpperCase(anonName);
         this.fname = anonName;

         if (!generatedFiles.contains(this.fname))
         {
            generatedFiles.add(this.fname);
            this.createJavaFile((XSComplexTypeDefinition)xstypedef, schema, false);
         }

         // Restore the fname
         this.fname = tempfname;
         // Bypass rest of processing
         QName anonqn = new QName(anonName);
         VAR vr = createVAR(anonqn, elem, xsc, tname, pkgname, arrayType);
         vars.add(vr);
         return vars;
      }
      else
      {
         String temp = this.fname;
         // Unwrap any array wrappers
         if (SchemaUtils.isWrapperArrayType(xstypedef))
         {
            XSComplexTypeDefinition complex = (XSComplexTypeDefinition)xstypedef;
            XSModelGroup group = (XSModelGroup)complex.getParticle().getTerm();
            XSElementDeclaration element = (XSElementDeclaration)((XSParticle)group.getParticles().item(0)).getTerm();
            xstypedef = element.getTypeDefinition();
            xstypename = xstypedef.getName();
            arrayType = true;
         }

         QName qn = null;
View Full Code Here

      XSNamedMap elements = model.getComponents(XSConstants.ELEMENT_DECLARATION);
      if (ctx.trace)
         log.trace("Model elements: " + types.getLength());
      for(int i = 0; i < elements.getLength(); ++i)
      {
         XSElementDeclaration element = (XSElementDeclaration)elements.item(i);
         bindElement(ctx, element, 1, 0, false);
      }

      schema.setUnresolvedContentBoundToDOM(true);
View Full Code Here

         XSParticle particle = (XSParticle)particles.item(j);
         XSTerm term = particle.getTerm();
         switch(term.getType())
         {
            case XSConstants.ELEMENT_DECLARATION:
               XSElementDeclaration element = ((XSElementDeclaration)term);
               sharedElements.add(element);
               break;
            case XSConstants.WILDCARD:
               // todo is it actually possible?
               break;
View Full Code Here

                    sig.append(subSig).append("|");
                }
                sig.append("]");
                break;
            case XSConstants.ELEMENT_DECLARATION:
                XSElementDeclaration elementDeclaration = (XSElementDeclaration) term;
                final String tempSig;
                if (XSTypeDefinition.COMPLEX_TYPE == elementDeclaration.getTypeDefinition().getTypeCategory()) {
                    tempSig = ComplexTypeDescription.getSignature((XSComplexTypeDefinition) elementDeclaration.getTypeDefinition());
                }
                else {
                    tempSig = SimpleTypeDescription.getSignature((XSSimpleTypeDefinition) elementDeclaration.getTypeDefinition());
                }
                sig.append(tempSig);
                break;
            case XSConstants.WILDCARD:
                AbstractTypeDescription.logger.warn("==> found wildcard");
View Full Code Here

                    type = AnonymousTypeFactory.getProxy(type);
                }
                typeDefinition = onVisitTypeDefinition(type, parent);
                break;
            case XSConstants.ELEMENT_DECLARATION:
                XSElementDeclaration elementDeclaration = (XSElementDeclaration) object;
                typeDefinition = onVisitElementDeclaration(elementDeclaration, parent);

                break;
            case XSConstants.ATTRIBUTE_DECLARATION:
                throw new RuntimeException("Not implemented yet - XSConstants.ATTRIBUTE_DECLARATION !");
View Full Code Here

    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {

        JLabel cell = (JLabel) delegateTreeCellRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);

        if (value instanceof XSElementDeclaration) {
            XSElementDeclaration xselem = (XSElementDeclaration) value;
            StringBuilder sb = new StringBuilder();
            sb.append(xselem.getName());
            sb.append(":");
            sb.append(xselem.getTypeDefinition().getName());
            sb.append(", <");
            sb.append(xselem.getNamespace());
            sb.append(">");
            cell.setText(sb.toString());
            cell.setIcon(ElementRenderer.icon);
        }
View Full Code Here

   public QName getXMLType(QName xmlName)
   {
      QName xmlType = null;
      String nsURI = xmlName.getNamespaceURI();
      String localPart = xmlName.getLocalPart();
      XSElementDeclaration xsel = schemaModel.getElementDeclaration(localPart, nsURI);
      if (xsel != null)
      {
         XSTypeDefinition xstype = xsel.getTypeDefinition();
         if (xstype == null)
            throw new WSException("Cannot obtain XSTypeDefinition for: " + xmlName);

         if (xstype.getAnonymous() == false)
         {
View Full Code Here

         }

         namedMap = model.getComponents(XSConstants.ELEMENT_DECLARATION);
         for (int i = 0; i < namedMap.getLength(); i++)
         {
            XSElementDeclaration element = (XSElementDeclaration)namedMap.item(i);
            analyzeElement(element, null, element.getNamespace(), null, null);
         }
         processed.clear();
      }
View Full Code Here

TOP

Related Classes of org.apache.xerces.xs.XSElementDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.