Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSAttributeUse


         return null;
      }
      XSObjectList l = def.getAttributeUses();
      for (int i=0; i < l.getLength(); ++i)
      {
         XSAttributeUse use = (XSAttributeUse)l.item(i);
         if (attrName.equals(use.getAttrDeclaration().getName()))
         {
            return use;
         }
      }
      return null;
View Full Code Here


         return null;
      }
     
      for (int i=0; i<attributeUses.getLength(); ++i)
      {
         XSAttributeUse attr = (XSAttributeUse)attributeUses.item(i);

         if (attrName.equals(attr.getAttrDeclaration().getName()))
         {
            return attr;
         }
      }
     
View Full Code Here

     
      Set nameLookup = new HashSet(attributeUses.getLength());
     
      for (int i=0; i < attributeUses.getLength(); ++i)
      {
         XSAttributeUse attr = (XSAttributeUse)attributeUses.item(i);
         XSAttributeDeclaration attrDecl = attr.getAttrDeclaration();
         nameLookup.add(attrDecl.getName());
      }
     
      stripAttributes(element, nameLookup);
   }
View Full Code Here

         XSModel model = XSDUtil.getXSModel(XSDUtilTest.class.getResource("attributetypes.xsd"));
  
         XSElementDeclaration elemDecl = model.getElementDeclaration("Metadata", null);
         XSComplexTypeDefinition complexDecl = XSDUtil.getComplexTypeDef(elemDecl);
         XSObjectList list = complexDecl.getAttributeUses();
         XSAttributeUse attrUse = (XSAttributeUse)list.item(0);
  
         assertTrue(XSDUtil.hasPattern(attrUse.getAttrDeclaration()));     
         assertNull(XSDUtil.validate("1.8", attrUse.getAttrDeclaration()));
         assertNotNull(XSDUtil.validate("abc", attrUse.getAttrDeclaration()));
         assertTrue(XSDUtil.getEnumeration(attrUse.getAttrDeclaration()).length == 0);
         assertFalse(XSDUtil.isBooleanAttribute(attrUse.getAttrDeclaration()));
              
         attrUse = (XSAttributeUse)list.item(1);
         assertTrue(XSDUtil.getEnumeration(attrUse.getAttrDeclaration()).length == 9);
         assertFalse(XSDUtil.isBooleanAttribute(attrUse.getAttrDeclaration()));

         attrUse = (XSAttributeUse)list.item(2);
         assertTrue(XSDUtil.isBooleanAttribute(attrUse.getAttrDeclaration()));
      }
      catch (IOException e)
      {
         fail();           
      }
View Full Code Here

        XSObjectList attrUseS = fromAttrGrp.getAttributeUses();
        XSAttributeUseImpl  duplicateAttrUse =  null, oneAttrUse = null;
        int attrCount = attrUseS.getLength();
        for (int i=0; i<attrCount; i++) {
            oneAttrUse = (XSAttributeUseImpl)attrUseS.item(i);
            XSAttributeUse existingAttrUse = toAttrGrp.getAttributeUse(oneAttrUse.fAttrDecl.getNamespace(),
                    oneAttrUse.fAttrDecl.getName());
            if (existingAttrUse == null) {
               
                String idName = toAttrGrp.addAttributeUse(oneAttrUse);
                if (idName != null) {
View Full Code Here

            sendElementEvent("psv:attributeUses");
        }
        else {
            sendIndentedElement("psv:attributeUses");
            for (int i = 0; i < uses.getLength(); i++) {
                XSAttributeUse use = (XSAttributeUse)uses.item(i);
                sendIndentedElement("psv:attributeUse");
                sendElementEvent("psv:required", String.valueOf(use.getRequired()));
                processPSVIAttributeDeclarationOrRef(use.getAttrDeclaration());
                processPSVIValueConstraint(use.getConstraintType(), use.getConstraintValue());
                sendUnIndentedElement("psv:attributeUse");
            }
            sendUnIndentedElement("psv:attributeUses");
        }
    }
View Full Code Here

                                              attrGpAnnotation);
            }
           
            XSObjectList attrUses = attrGpDecl.getAttributeUses();
            for (int attrUsesIdx = 0; attrUsesIdx < attrUses.size(); attrUsesIdx++) {
               XSAttributeUse attrUse = (XSAttributeUse) attrUses.item(attrUsesIdx);
               XSAttributeDecl attrDecl = (XSAttributeDecl) attrUse.getAttrDeclaration();
               String constraintName = null;
               String constraintVal = null;          
               if (attrUse.getConstraintType() != XSConstants.VC_NONE) {
                   constraintName = (attrUse.getConstraintType() ==
                                               XSConstants.VC_DEFAULT) ?
                                               "default" : "fixed";
                   constraintVal = attrUse.getConstraintValue();
               }
               String requiredVal = (attrUse.getRequired() == true) ?
                                              "required" : "optional";
               addAttributeToSchemaComponent(document, attrGpDomNode,
                                             attrDecl, constraintName,
                                             constraintVal, requiredVal);
            }
View Full Code Here

        // iterate all attributes on the Complex type. all attributes on a
        // complex type (from all of xs:attribute & xs:attributeGroup
        // declarations) are expanded, into an XSObjectList list. 
        XSObjectList attributeUses = complexTypeDecl.getAttributeUses();
        for (int attrUsesIdx = 0; attrUsesIdx < attributeUses.getLength(); attrUsesIdx++) {
           XSAttributeUse attrUse = (XSAttributeUse) attributeUses.item(attrUsesIdx);
           String constraintName = null;
           String constraintVal = null;          
           if (attrUse.getConstraintType() != XSConstants.VC_NONE) {
              constraintName = (attrUse.getConstraintType() ==
                                         XSConstants.VC_DEFAULT) ?
                                         "default" : "fixed";
              constraintVal = attrUse.getConstraintValue();
           }
          
           String requiredVal = (attrUse.getRequired() == true) ?
                                 "required" : "optional";
          
           XSAttributeDecl attrDecl = (XSAttributeDecl)
                                                  attrUse.getAttrDeclaration();
           XSComplexTypeDefinition enclosingCTDefn = attrDecl.
                                                  getEnclosingCTDefinition();
           boolean complexTypesIdentical = XSTypeHelper.schemaTypesIdentical(
                                                            complexTypeDecl,
                                                            enclosingCTDefn);
View Full Code Here

            XSObject enclosingParent) {
       
        Element child=null;
        XSAttributeGroupDecl tempAttrGrp = null;
        XSAttributeUseImpl tempAttrUse = null;
        XSAttributeUse otherUse = null;
        String childName;
       
        for (child=firstAttr; child!=null; child=DOMUtil.getNextSiblingElement(child)) {
            childName = DOMUtil.getLocalName(child);
            if (childName.equals(SchemaSymbols.ELT_ATTRIBUTE)) {
View Full Code Here

        XSObjectList attrUseS = fromAttrGrp.getAttributeUses();
        XSAttributeUseImpl  oneAttrUse = null;
        int attrCount = attrUseS.getLength();
        for (int i=0; i<attrCount; i++) {
            oneAttrUse = (XSAttributeUseImpl)attrUseS.item(i);
            XSAttributeUse existingAttrUse = toAttrGrp.getAttributeUse(oneAttrUse.fAttrDecl.getNamespace(),
                    oneAttrUse.fAttrDecl.getName());
            if (existingAttrUse == null) {
               
                String idName = toAttrGrp.addAttributeUse(oneAttrUse, fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1);
                if (idName != null) {
View Full Code Here

TOP

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

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.