Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition


      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");
            }

            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 (ctx.trace)
      {
         String msg = "bound attribute " + attrName;

         if(binding.getPropertyMetaData() != null)
         {
            msg += " property=" +
               binding.getPropertyMetaData().getName() +
               ", collectionType=" + binding.getPropertyMetaData().getCollectionType();
         }
         else if(binding.isMapEntryKey())
         {
            msg += "bound as a key in a map entry";
         }
         else if(binding.isMapEntryValue())
         {
            msg += "bound as a value in a map entry";
         }
         else
         {
            msg += " type=" + attrType.getName() + ", owner type=" + type.getQName();
         }

         if(binding.getDefaultConstraint() != null)
         {
            msg += ", default=" + binding.getDefaultConstraint();
View Full Code Here


    private Node parseElementChildren(final Node parent, final XSElementDeclaration xsElement) {
        log.trace("Parsing {}", xsElement);
        final XSTypeDefinition typeDefinition = xsElement.getTypeDefinition();
        switch (typeDefinition.getTypeCategory()) {
            case SIMPLE_TYPE: {
                final XSSimpleTypeDefinition simpleTypeDefinition = (XSSimpleTypeDefinition) typeDefinition;
                return new Node(parent, new QName(xsElement.getNamespace(), xsElement.getName()), convert(simpleTypeDefinition));
            }
            case COMPLEX_TYPE: {
                final XSComplexTypeDefinition complexTypeDefinition = (XSComplexTypeDefinition) typeDefinition;
                final Node element = new Node(parent, new QName(xsElement.getNamespace(), xsElement.getName()), new HashSet<Node>(), new ArrayList<Node>());
View Full Code Here

   private AttributeBinding bindAttribute(XSAttributeUse attrUse)
   {
      XSAttributeDeclaration attr = attrUse.getAttrDeclaration();
      QName attrName = new QName(attr.getNamespace(), attr.getName());

      XSSimpleTypeDefinition attrType = attr.getTypeDefinition();
      TypeBinding typeBinding = bindSimpleType(attrType);

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

      AttributeBinding binding = new AttributeBinding(schema, 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 (processAnnotations)
      {
         XSAnnotation an = attr.getAnnotation();
         if(an != null)
         {
            if (trace)
            {
               log.trace(attrName + " attribute annotation");
            }

            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 (trace)
      {
         String msg = "bound attribute " + attrName;

         if(binding.getPropertyMetaData() != null)
         {
            msg += " property=" +
               binding.getPropertyMetaData().getName() +
               ", collectionType=" + binding.getPropertyMetaData().getCollectionType();
         }
         else if(binding.isMapEntryKey())
         {
            msg += "bound as a key in a map entry";
         }
         else if(binding.isMapEntryValue())
         {
            msg += "bound as a value in a map entry";
         }
         else
         {
            msg += " type=" + attrType.getName();
         }

         if(binding.getDefaultConstraint() != null)
         {
            msg += ", default=" + binding.getDefaultConstraint();
View Full Code Here

   private AttributeBinding bindAttribute(XSAttributeUse attrUse)
   {
      XSAttributeDeclaration attr = attrUse.getAttrDeclaration();
      QName attrName = new QName(attr.getNamespace(), attr.getName());

      XSSimpleTypeDefinition attrType = attr.getTypeDefinition();
      TypeBinding typeBinding = bindSimpleType(attrType);

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

      AttributeBinding binding = new AttributeBinding(schema, 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 (processAnnotations)
      {
         XSAnnotation an = attr.getAnnotation();
         if(an != null)
         {
            if (trace)
            {
               log.trace(attrName + " attribute annotation");
            }

            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 (trace)
      {
         String msg = "bound attribute " + attrName;

         if(binding.getPropertyMetaData() != null)
         {
            msg += " property=" +
               binding.getPropertyMetaData().getName() +
               ", collectionType=" + binding.getPropertyMetaData().getCollectionType();
         }
         else if(binding.isMapEntryKey())
         {
            msg += "bound as a key in a map entry";
         }
         else if(binding.isMapEntryValue())
         {
            msg += "bound as a value in a map entry";
         }
         else
         {
            msg += " type=" + attrType.getName();
         }

         if(binding.getDefaultConstraint() != null)
         {
            msg += ", default=" + binding.getDefaultConstraint();
View Full Code Here

                        synth);

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSFacetTest01.xsd"));

        XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) model
                .getTypeDefinition("ST1", "XSFacetTest");
        // Item 0 is whitespace
        XSFacet length = (XSFacet) st.getFacets().item(1);

        XSAnnotation annotation = length.getAnnotation();
        assertNull("TEST1_NO_ANNOTATION_" + synth, annotation);
        XSObjectList annotations = length.getAnnotations();
        assertEquals("TEST1_NO_ANNOTATIONS_" + synth, 0, annotations
View Full Code Here

                        synth);

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSFacetTest01.xsd"));

        XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) model
                .getTypeDefinition("ST2", "XSFacetTest");
        // Item 0 is whitespace
        XSFacet minLength = (XSFacet) st.getFacets().item(1);

        XSAnnotation annotation = minLength.getAnnotation();
        assertEquals("TEST2_NO_ANNOTATION_" + synth, expected, trim(annotation
                .getAnnotationString()));
        XSObjectList annotations = minLength.getAnnotations();
        assertEquals(
                "TEST2_NO_ANNOTATIONS_" + synth,
                expected,
                trim(((XSAnnotation) annotations.item(0)).getAnnotationString()));

        XSFacet maxLength = (XSFacet) st.getFacets().item(2);
        annotation = maxLength.getAnnotation();
        assertEquals("TEST2_NO_ANNOTATION_" + synth, expected2, trim(annotation
                .getAnnotationString()));
        annotations = maxLength.getAnnotations();
        assertEquals(
View Full Code Here

                        synth);

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSFacetTest01.xsd"));

        XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) model
                .getTypeDefinition("ST3", "XSFacetTest");
        XSFacet whitespace = (XSFacet) st.getFacets().item(0);

        XSAnnotation annotation = whitespace.getAnnotation();
        assertEquals("TEST3_ANNOTATION_" + synth, expected, trim(annotation
                .getAnnotationString()));
        XSObjectList annotations = whitespace.getAnnotations();
View Full Code Here

                        synth);

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSFacetTest01.xsd"));

        XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) model
                .getTypeDefinition("ST4", "XSFacetTest");
        // Item 0 is minInclusive
        XSFacet minInclusive = (XSFacet) st.getFacets().item(1);

        XSAnnotation annotation = minInclusive.getAnnotation();
        assertEquals("TEST4_ANNOTATION_" + synth, expected, trim(annotation
                .getAnnotationString()));
        XSObjectList annotations = minInclusive.getAnnotations();
View Full Code Here

                        synth);

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSFacetTest01.xsd"));

        XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) model
                .getTypeDefinition("ST5", "XSFacetTest");
        // Item 0 is minInclusive
        XSFacet maxInclusive = (XSFacet) st.getFacets().item(1);

        XSAnnotation annotation = maxInclusive.getAnnotation();
        assertEquals("TEST5_ANNOTATION_" + synth, expected, trim(annotation
                .getAnnotationString()));
        XSObjectList annotations = maxInclusive.getAnnotations();
View Full Code Here

                        synth);

        XSModel model = fSchemaLoader
                .loadURI(getResourceURL("XSFacetTest01.xsd"));

        XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) model
                .getTypeDefinition("ST6", "XSFacetTest");
        // Item 0 is minInclusive
        XSFacet fractionDigits = (XSFacet) st.getFacets().item(1);

        XSAnnotation annotation = fractionDigits.getAnnotation();
        assertEquals("TEST6_ANNOTATION_" + synth, expected, trim(annotation
                .getAnnotationString()));
        XSObjectList annotations = fractionDigits.getAnnotations();
View Full Code Here

TOP

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

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.