Examples of XSAttributeDeclaration


Examples of org.apache.xerces.impl.xs.psvi.XSAttributeDeclaration

                    attrImpl.setSpecified(specified);
                    // Identifier registration
                    // REVISIT: try to retrieve XML Schema attribute declaration
                    //          we should try to modify psvi API to allows to
                    //          check if id type
                    XSAttributeDeclaration xsDecl = (XSAttributeDeclaration)((attrPSVI!=null)?attrPSVI.getAttributeDeclaration():null);
                    if (attributes.getType(i).equals("ID") ||
                        (xsDecl !=null && ((XSSimpleType)xsDecl.getTypeDefinition()).isIDType())) {
                        ((ElementImpl) el).setIdAttributeNode(attr);
                    }
                }
                // REVISIT: Handle entities in attribute value.
            }

            setCharacterData(false);
            fCurrentNode.appendChild(el);
            fCurrentNode = el;
        }
        else {
            int el =
                fDeferredDocumentImpl.createDeferredElement(fNamespaceAware ?
                                                            element.uri : null,
                                                            element.rawname);
            int attrCount = attributes.getLength();
            for (int i = 0; i < attrCount; i++) {
                String attrValue = attributes.getValue(i);
                // REVISIT: consider moving this code to the XML Schema validator.
                //          When PSVI and XML Schema component interfaces are finalized
                //          remove dependancy on *Impl class.
                AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI);
               
                if (fNormalizeData) {
                    // If validation is not attempted, the SchemaNormalizedValue will be null.
                    // We shouldn't take the normalized value in this case.
                    if (attrPSVI != null && attrPSVI.getValidationAttempted() == AttributePSVI.VALIDATION_FULL) {
                        attrValue = attrPSVI.getSchemaNormalizedValue();
                    }

                }
                int attr = fDeferredDocumentImpl.setDeferredAttribute(el,
                                                    attributes.getQName(i),
                                                    attributes.getURI(i),
                                                    attrValue,
                                                    attributes.isSpecified(i));
                // identifier registration
                // REVISIT: try to retrieve XML Schema attribute declaration
                //          we should try to modify psvi API to allows to
                //          check if id type
                XSAttributeDeclaration xsDecl = (XSAttributeDeclaration)((attrPSVI!=null)?attrPSVI.getAttributeDeclaration():null);
               
                if (attributes.getType(i).equals("ID") ||
                    (xsDecl !=null && ((XSSimpleType)xsDecl.getTypeDefinition()).isIDType())) {
                    fDeferredDocumentImpl.setIdAttributeNode(el, attr);
                }
            }
            fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, el);
            fCurrentNodeIndex = el;
View Full Code Here

Examples of org.apache.xerces.impl.xs.psvi.XSAttributeDeclaration

                    attrImpl.setSpecified(specified);
                    // Identifier registration
                    // REVISIT: try to retrieve XML Schema attribute declaration
                    //          we should try to modify psvi API to allows to
                    //          check if id type
                    XSAttributeDeclaration xsDecl = (XSAttributeDeclaration)((attrPSVI!=null)?attrPSVI.getAttributeDeclaration():null);
                    if (attributes.getType(i).equals("ID") ||
                        (xsDecl !=null && ((XSSimpleType)xsDecl.getTypeDefinition()).isIDType())) {
                        ((ElementImpl) el).setIdAttributeNode(attr);
                    }
                }
                // REVISIT: Handle entities in attribute value.
            }

            setCharacterData(false);
            // filter nodes
            if (fDOMFilter != null) {
                short code = fDOMFilter.startElement(el);
                switch (code) {
                    case DOMBuilderFilter.FILTER_INTERRUPT:{
                        throw new RuntimeException("The normal processing of the document was interrupted.");
                    }  
                    case DOMBuilderFilter.FILTER_REJECT:{
                        fFilterReject = true;
                        fRejectedElement.setValues(element);
                        return;
                    }
                    case DOMBuilderFilter.FILTER_SKIP: {
                        fSkippedElemStack.push(element);
                        return;
                    }
                    default: {
                    }
                }
            }

            fCurrentNode.appendChild(el);
            fCurrentNode = el;
        }
        else {
            int el =
                fDeferredDocumentImpl.createDeferredElement(fNamespaceAware ?
                                                            element.uri : null,
                                                            element.rawname);
            int attrCount = attributes.getLength();
            for (int i = 0; i < attrCount; i++) {
                String attrValue = attributes.getValue(i);
                // REVISIT: consider moving this code to the XML Schema validator.
                //          When PSVI and XML Schema component interfaces are finalized
                //          remove dependancy on *Impl class.
                AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI);
               
                if (fNormalizeData) {
                    // If validation is not attempted, the SchemaNormalizedValue will be null.
                    // We shouldn't take the normalized value in this case.
                    if (attrPSVI != null && attrPSVI.getValidationAttempted() == AttributePSVI.VALIDATION_FULL) {
                        attrValue = attrPSVI.getSchemaNormalizedValue();
                    }

                }
                int attr = fDeferredDocumentImpl.setDeferredAttribute(el,
                                                    attributes.getQName(i),
                                                    attributes.getURI(i),
                                                    attrValue,
                                                    attributes.isSpecified(i));
                // identifier registration
                // REVISIT: try to retrieve XML Schema attribute declaration
                //          we should try to modify psvi API to allows to
                //          check if id type
                XSAttributeDeclaration xsDecl = (XSAttributeDeclaration)((attrPSVI!=null)?attrPSVI.getAttributeDeclaration():null);
               
                if (attributes.getType(i).equals("ID") ||
                    (xsDecl !=null && ((XSSimpleType)xsDecl.getTypeDefinition()).isIDType())) {
                    fDeferredDocumentImpl.setIdAttributeNode(el, attr);
                }
            }
            fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, el);
            fCurrentNodeIndex = el;
View Full Code Here

Examples of org.apache.xerces.xs.XSAttributeDeclaration

                     ignoreIfNotFound = true;
                  }  
                  else if (attributeUses.getLength() == 1)
                  {
                     XSAttributeUse xsAttrUse = (XSAttributeUse) attributeUses.item(0);
                     XSAttributeDeclaration xsAttr = xsAttrUse.getAttrDeclaration();
                     if(xsAttr.getNamespace() == null && "id".equals(xsAttr.getName()))
                        ignoreIfNotFound = true;
                  }
               }
            }
           
View Full Code Here

Examples of org.apache.xerces.xs.XSAttributeDeclaration

      }
      else
      {
         for(int i = 0; i < xsAttrUses.getLength(); ++i)
         {
            XSAttributeDeclaration xsAttr = ((XSAttributeUse)xsAttrUses.item(i)).getAttrDeclaration();
            QName xsAttrQName = new QName(xsAttr.getNamespace(), xsAttr.getName());
            AttributeBinding attrBinding = typeBinding.getAttribute(xsAttrQName);
            assertNotNull("Type " + typeBinding.getQName() + " declares attribute " + xsAttrQName, attrBinding);
            assertEquivalent(xsAttr.getTypeDefinition(), attrBinding.getType());
         }
      }
     
      XSWildcard xsAttrWildcard = xsType.getAttributeWildcard();
      if(xsAttrWildcard != null)
View Full Code Here

Examples of org.apache.xerces.xs.XSAttributeDeclaration

        }
      }
      XSObjectList attrs = ((XSComplexTypeDefinition)type).getAttributeUses();
      for(int i=0;i<attrs.getLength();i++){
        XSAttributeUse attrUse = (XSAttributeUse)attrs.item(i);
        XSAttributeDeclaration attr = attrUse.getAttrDeclaration();
        AttributeInfo attrInfo = new AttributeInfo(attr.getName(),true,AttributeInfo.NONE,attrUse.getRequired());
        tagInfo.addAttributeInfo(attrInfo);
      }
     
    }
  }
View Full Code Here

Examples of org.apache.xerces.xs.XSAttributeDeclaration

      {
         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(), getPackageName(xstype.getNamespace()), primitive);
            if (vars == null)
               vars = new ArrayList();
            vars.add(v);
         }
      }
View Full Code Here

Examples of org.apache.xerces.xs.XSAttributeDeclaration

   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

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

Examples of org.apache.xerces.xs.XSAttributeDeclaration

   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

Examples of org.apache.xerces.xs.XSAttributeDeclaration

   private static void bindAttributes(SchemaBinding doc,
                                      TypeBinding type,
                                      XSAttributeUse attrUse)
   {
      XSAttributeDeclaration attr = attrUse.getAttrDeclaration();
      XSSimpleTypeDefinition attrType = attr.getTypeDefinition();
      TypeBinding typeBinding = bindSimpleType(doc, attrType);
      QName attrName = new QName(attr.getNamespace(), attr.getName());
      AttributeBinding binding = type.addAttribute(attrName, typeBinding, RtAttributeHandler.INSTANCE);
      if( attrUse.getConstraintType() == XSConstants.VC_DEFAULT )
      {
         // Associate the default value with the binding
         binding.setDefaultConstraint(attrUse.getConstraintValue());
      }

      XSAnnotation an = attr.getAnnotation();
      if(an != null)
      {
         XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString());
         XsdAppInfo appInfo = xsdAn.getAppInfo();
         if(appInfo != null)
         {
            PropertyMetaData propertyMetaData = appInfo.getPropertyMetaData();
            if(propertyMetaData != null)
            {
               binding.setPropertyMetaData(propertyMetaData);
            }

            boolean mapEntryKey = appInfo.isMapEntryKey();
            if(mapEntryKey)
            {
               binding.setMapEntryKey(mapEntryKey);
            }

            boolean mapEntryValue = appInfo.isMapEntryValue();
            if(mapEntryValue)
            {
               binding.setMapEntryValue(mapEntryValue);
            }
         }
      }

      if(log.isTraceEnabled())
      {
         String msg = "attribute " +
            new QName(attr.getNamespace(), attr.getName()) +
            ": ";

         if(binding.getPropertyMetaData() != null)
         {
            msg += " property=" +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.