Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSAttributeDeclaration


        // note that if use is prohibited the attribute use itself is absent from the XSModel so
        // we would never get here anyway
        boolean mandatory = au.getRequired();

        // Get the contained attribute declaration
        XSAttributeDeclaration ad = au.getAttrDeclaration();

        // The name of the Attribute Declaration becomes the name of the PropDef
        QName name = new QName(noNull(ad.getNamespace()), ad.getName());

        // Since this is an attribute declaration we assume it converts to
        // a single value property (we ignore the XML Schema List Type)
        boolean multiple = false;

        // Get the simple type def for this attribute
        XSSimpleTypeDefinition std = ad.getTypeDefinition();

        // convert it to a propdef
        return simpleTypeToPropDef(std, name, mandatory, multiple);
    }
View Full Code Here


   private void addAttributeMappings(XSObjectList attributes, JavaXmlTypeMapping jxtm)
   {
      for (int i = 0; i < attributes.getLength(); i++)
      {
         XSAttributeUse obj = (XSAttributeUse)attributes.item(i);
         XSAttributeDeclaration att = obj.getAttrDeclaration();
         XSSimpleTypeDefinition simple = att.getTypeDefinition();
         addJavaXMLTypeMap(simple, "none", "", "", jxtm.getJavaWsdlMapping(), true);
         VariableMapping vm = new VariableMapping(jxtm);
         String name = att.getName();
         vm.setXmlAttributeName(name);
         // JBWS-1170 Convert characters which are illegal in Java identifiers
         vm.setJavaVariableName(ToolsUtils.convertInvalidCharacters(Introspector.decapitalize(name)));
         jxtm.addVariableMapping(vm);
      }
View Full Code Here

      //Merge the attributes
      JBossXSNamedMap nmap = (JBossXSNamedMap)nsi.getComponents(XSConstants.ATTRIBUTE_DECLARATION);
      int len = nmap.getLength();
      for(int i=0;i<len;i++)
      {
         XSAttributeDeclaration xatt = (XSAttributeDeclaration)nmap.item(i);
         this.addXSAttributeDeclaration(xatt);
      }

      //Merge the types
      nmap = (JBossXSNamedMap)nsi.getComponents(XSConstants.TYPE_DEFINITION);
View Full Code Here

         XSObjectList list = jxstype.getAttributeUses();
         for (int i = 0; i < list.getLength(); i++)
         {
            XSAttributeUse use = (XSAttributeUse)list.item(i);
            XSAttributeDeclaration decl = use.getAttrDeclaration();
            buf.append(write(decl));
         }

         if (baseType != null)
         {
View Full Code Here

      //Copy all the attributes
      xsmp = xsmodel.getComponents(XSConstants.ATTRIBUTE_DECLARATION);
      len = xsmp != null ? xsmp.getLength() : 0;
      for (int i = 0; i < len; i++)
      {
         XSAttributeDeclaration xsattr = (XSAttributeDeclaration)xsmp.item(i);
         jb.addXSAttributeDeclaration(xsattr);
      }

      //copy all the global annotations
      //xsmp = xsmodel.getComponents(XSConstants.ANNOTATION);
View Full Code Here

   private void addAttributeMappings(XSObjectList attributes, JavaXmlTypeMapping jxtm)
   {
      for (int i = 0; i < attributes.getLength(); i++)
      {
         XSAttributeUse obj = (XSAttributeUse)attributes.item(i);
         XSAttributeDeclaration att = obj.getAttrDeclaration();
         XSSimpleTypeDefinition simple = att.getTypeDefinition();
         addJavaXMLTypeMap(simple, "none", "", "", jxtm.getJavaWsdlMapping(), true);
         VariableMapping vm = new VariableMapping(jxtm);
         String name = att.getName();
         vm.setXmlAttributeName(name);
         // JBWS-1170 Convert characters which are illegal in Java identifiers
         vm.setJavaVariableName(ToolsUtils.convertInvalidCharacters(Introspector.decapitalize(name)));
         jxtm.addVariableMapping(vm);
      }
View Full Code Here

      {
         int len = xsobjlist.getLength();
         for (int i = 0; i < len; i++)
         {
            XSAttributeUse obj = (XSAttributeUse)xsobjlist.item(i);
            XSAttributeDeclaration att = obj.getAttrDeclaration();
            XSSimpleTypeDefinition xstype = att.getTypeDefinition();
            QName qn = SchemaUtils.handleSimpleType(xstype);
            boolean primitive = obj.getRequired();
            VAR v = createVAR(qn, att.getName(), pkgname, primitive);
            if (vars == null)
               vars = new ArrayList();
            vars.add(v);
         }
      }
View Full Code Here

      return binding;
   }

   private static AttributeBinding bindAttributes(Context ctx, TypeBinding type, XSAttributeUse attrUse)
   {
      XSAttributeDeclaration attr = attrUse.getAttrDeclaration();
      QName attrName = new QName(attr.getNamespace(), attr.getName());

      if (ctx.trace)
      {
         log.trace("binding attribute " + attrName + " for " + type.getQName() + ", required=" + attrUse.getRequired());
      }

      XSSimpleTypeDefinition attrType = attr.getTypeDefinition();
      TypeBinding typeBinding = bindSimpleType(ctx, attrType);
      AttributeBinding binding = type.addAttribute(attrName, typeBinding, DefaultHandlers.ATTRIBUTE_HANDLER);
      binding.setRequired(attrUse.getRequired());
      if(attrUse.getConstraintType() == XSConstants.VC_DEFAULT)
      {
         // Associate the default value with the binding
         binding.setDefaultConstraint(attrUse.getConstraintValue());
      }

      if (ctx.processAnnotations)
      {
         XSAnnotation an = attr.getAnnotation();
         if(an != null)
         {
            if (ctx.trace)
            {
               log.trace(attrName + " attribute annotation");
View Full Code Here

     * @param value
     * @param cell
     */
    private static void renderAttributeType(final Object value, JLabel cell) {
        if (value instanceof XSAttributeDeclaration) {
            XSAttributeDeclaration attribute = (XSAttributeDeclaration) value;
            StringBuilder sb = new StringBuilder();
            sb.append(attribute.getName());
            sb.append(", <");
            final String namespace = attribute.getNamespace();
            sb.append((null == namespace) ? "default namespace" : namespace);
            sb.append(">");
            cell.setText(sb.toString());
            cell.setIcon(AttributeRenderer.icon);
        }
View Full Code Here

    private void onVisitAttributes(XSObjectList attributeUsesList, XSObject parent) {
        for (int i = 0; i < attributeUsesList.getLength(); ++i) {
            XSAttributeUse xsAttribute = (XSAttributeUse) attributeUsesList.item(i);
            // attribute declaration contains interesting properties of the
            // attribute
            XSAttributeDeclaration xsAttributeType = xsAttribute.getAttrDeclaration();

            XsModelWalker.logger.debug("--> Attribute [{" + xsAttributeType.getNamespace() + "}:" + xsAttributeType.getName() + "]");

            executeWorker(xsAttributeType, parent);

            // handle
            /*
             * TODO check if we really need this...
             *
             * A {scope} of global identifies attribute declarations available for use in complex type definitions
             * throughout the schema. Locally scoped declarations are available for use only within the complex type
             * definition identified by the {scope} property. This property is ·absent· in the case of declarations
             * within attribute group definitions: their scope will be determined when they are used in the construction
             * of complex type definitions.
             */
            XSComplexTypeDefinition ctypedef = xsAttributeType.getEnclosingCTDefinition();
            if (null != ctypedef) {
                visitComponent(ctypedef, parent);
            }

            visitComponent(xsAttributeType.getTypeDefinition(), parent);
        }

    }
View Full Code Here

TOP

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

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.