Examples of XSSimpleTypeDecl


Examples of org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

        int len = types.getLength();
        Object[] values = new Object[len];
        types.getValues(values, 0);
        for (int i = 0; i < values.length; i++) {
            if (values[i] instanceof XSSimpleTypeDecl) {
                XSSimpleTypeDecl decl = (XSSimpleTypeDecl)values[i];
                System.out.println("tm.registerDatatype(new XSDDatatype(\""
                                    + decl.getName()
                                    + "\"));");
            } else {
                System.out.println(" - " + values[i]);
            }
        }
View Full Code Here

Examples of org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

    public final XSSimpleTypeDecl getSimpleTypeDecl(){
        int     chunk       = fSTDeclIndex >> CHUNK_SHIFT;
        int     index       = fSTDeclIndex &  CHUNK_MASK;
        ensureSTDeclCapacity(chunk);
        if (fSTDecl[chunk][index] == null) {
            fSTDecl[chunk][index] = new XSSimpleTypeDecl();
        } else {
            fSTDecl[chunk][index].reset();
        }
        fSTDeclIndex++;
        return fSTDecl[chunk][index];
View Full Code Here

Examples of org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

        fSTDecl[chunk] = new XSSimpleTypeDecl[CHUNK_SIZE];
        return true;
    }

    private static XSSimpleTypeDecl[][] resize(XSSimpleTypeDecl array[][], int newsize) {
        XSSimpleTypeDecl newarray[][] = new XSSimpleTypeDecl[newsize][];
        System.arraycopy(array, 0, newarray, 0, array.length);
        return newarray;
    }
View Full Code Here

Examples of org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

    public boolean evaluate(QName element, XMLAttributes attributes) throws Exception {
        int type1 = child1.getType();
        int type2 = child2.getType();
        Object obj1, obj2;
        XSSimpleTypeDecl simpleType;

        if (type1 == TYPE_UNTYPED && type2 == TYPE_DOUBLE) {
            // attribute and numeral
            String attrValue = child1.getValue(attributes).toString();
            simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType("double");
            //cast the attribute value into double as per the XPath 2.0 general comparison rules
            obj1 = simpleType.validate(attrValue, null, null);
            obj2 = child2.getValue(attributes);
            return DataMatcher.compareActualValues(obj1, obj2, comp, simpleType);
           
        } else if (type1 == TYPE_UNTYPED && type2 == TYPE_STRING) {
            // attribute and string
            String attrValue = child1.getValue(attributes).toString();
            simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType("string");
            //cast the attribute value into string as per the XPath 2.0 general comparison rules
            obj1 = simpleType.validate(attrValue, null, null);
            obj2 = child2.getValue(attributes);
            return DataMatcher.compareActualValues(obj1, obj2, comp, simpleType);
           
        } else if (type1 == TYPE_DOUBLE && type2 == TYPE_UNTYPED) {
            // numeral and attribute
            String attrValue = child2.getValue(attributes).toString();
            simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType("double");
            obj1 = child1.getValue(attributes);
            //cast the attribute value into double as per the XPath 2.0 general comparison rules
            obj2 = simpleType.validate(attrValue, null, null);
            return DataMatcher.compareActualValues(obj1, obj2, comp, simpleType);
           
        } else if (type1 == TYPE_STRING && type2 == TYPE_UNTYPED) {
            // string and attribute
            String attrValue = child2.getValue(attributes).toString();
            simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType("string");
            obj1 = child1.getValue(attributes);
            //cast the attribute value into string as per the XPath 2.0 general comparison rules
            obj2 = simpleType.validate(attrValue, null, null);
            return DataMatcher.compareActualValues(obj1, obj2, comp, simpleType);
           
        } else if (type1 == TYPE_UNTYPED && type2 == TYPE_UNTYPED) {
            // attr and attr
            String attrVal1 = child1.getValue(attributes).toString();
            String attrVal2 = child2.getValue(attributes).toString();
            simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType("string");
            //cast the both attribute values into string as per the XPath 2.0 general comparison rules
            obj1 = simpleType.validate(attrVal1, null, null);
            obj2 = simpleType.validate(attrVal2, null, null);
            return DataMatcher.compareActualValues(obj1, obj2, comp, simpleType);
           
        } else if (type1 == TYPE_UNTYPED && type2 == TYPE_OTHER) {
            // attr and cast expr
            String type = child2.getTypeName();
            String attrVal = child1.getValue(attributes).toString();
           
            simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(type);
            if (simpleType == null) {
                throw new XPathException("Casted type is not a built-in type");
            }
            //try to cast the attribute value into the type of the cast expression
            obj1 = simpleType.validate(attrVal, null, null);
            obj2 = child2.getValue(attributes);
            return DataMatcher.compareActualValues(obj1, obj2, comp, simpleType);
           
        } else if (type1 == TYPE_OTHER && type2 == TYPE_UNTYPED) {
            // cast expr and attr
            String type = child1.getTypeName();
            String attrVal = child2.getValue(attributes).toString();
           
            simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(type);
            if (simpleType == null) {
                throw new XPathException("Casted type is not a built-in type");
            }
            obj1 = child1.getValue(attributes);
            //try to cast the attribute value into the type of the cast expression
            obj2 = simpleType.validate(attrVal, null, null);
            return DataMatcher.compareActualValues(obj1, obj2, comp, simpleType);
           
        } else if (type1 == TYPE_OTHER && type2 == TYPE_OTHER) {
            //cast expr and cast expr
            String typeName1 = child1.getTypeName();
            String typeName2 = child2.getTypeName();
           
            simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(typeName1);
            if (simpleType == null) {
                throw new XPathException("Casted type is not a built-in type");
            }
            short dt1 = simpleType.getBuiltInKind();
           
            simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(typeName2);
            if (simpleType == null) {
                throw new XPathException("Casted type is not a built-in type");
            }
            short dt2 = simpleType.getBuiltInKind();
           
            // check whether the two types are comparable
            if (DataMatcher.isComparable(dt1, dt2, null, null)) {
                obj1 = simpleType.validate(child1.getValue(attributes), null, null);
                obj2 = child2.getValue(attributes);
                return DataMatcher.compareActualValues(obj1, obj2, comp, simpleType);
            } else {
                throw new XPathException("Invalid comparison between incompatible types");
            }
View Full Code Here

Examples of org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

        this.castedType = castedType;
    }

    public boolean evaluate(QName element, XMLAttributes attributes) throws Exception {
        Object obj = getValue(attributes);
        XSSimpleTypeDecl simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(getTypeName());
        if (simpleType.getNumeric()) {
            return obj != null && 0.0 != ((Double) obj).doubleValue();
        }
        else {
            return obj != null;
        }
View Full Code Here

Examples of org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

        return localname;
    }

    public int getType() {
        String type = getTypeName();
        XSSimpleTypeDecl simpleType = (XSSimpleTypeDecl) dvFactory.getBuiltInType(type);
        if (simpleType.getNumeric()) {
            return TYPE_DOUBLE;
        } else if (type.equals("string")) {
            return TYPE_STRING;
        } else {
            return TYPE_OTHER;
View Full Code Here

Examples of org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

        fSTDecl[chunk] = new XSSimpleTypeDecl[CHUNK_SIZE];
        return true;
    }

    private static XSSimpleTypeDecl[][] resize(XSSimpleTypeDecl array[][], int newsize) {
        XSSimpleTypeDecl newarray[][] = new XSSimpleTypeDecl[newsize][];
        System.arraycopy(array, 0, newarray, 0, array.length);
        return newarray;
    }
View Full Code Here

Examples of org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

           }        
         }
         else {
           // handling an anonymous schema type         
           if (typeDef.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
               XSSimpleTypeDecl simpleTypeDecl = (XSSimpleTypeDecl) typeDef;
               processSimpleTypeContents(document,
                                         elemDeclDomNode,
                                         simpleTypeDecl,
                                         simpleTypeDecl.getName());
           }
           else if (typeDef.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
              processAnonComplexTypeOnElement(document,
                                              elemDeclDomNode,
                                              typeDef);
View Full Code Here

Examples of org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

                                             Document document,
                                             Element schemaDeclDomNode)
                                             throws DOMException {
        // iterating global simple types in the Schema
        for (int stIdx = 0; stIdx < globalSimpleTypeDecls.size(); stIdx++) {
            XSSimpleTypeDecl simpleTypeDecl = (XSSimpleTypeDecl)
                                              globalSimpleTypeDecls.item(stIdx);
            // consider only user defined simple types
            if (!XMLConstants.W3C_XML_SCHEMA_NS_URI.equals
                                   (simpleTypeDecl.getNamespace())) {
                String stName = simpleTypeDecl.getName();
                processSimpleTypeContents(document, schemaDeclDomNode,
                                          simpleTypeDecl, stName);
            }
        }
    } // end of, processGlobalSimpleTypeDecl
View Full Code Here

Examples of org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl

              attrDeclDomNode.setAttributeNS(null, "type", typeName)
           }  
         }
         else {
           // handling an anonymous schema type
           XSSimpleTypeDecl simpleTypeDecl = (XSSimpleTypeDecl) typeDef;
           processSimpleTypeContents(document,
                                     attrDeclDomNode,
                                     simpleTypeDecl,
                                     simpleTypeDecl.getName());             
         }          
    } // end of, addAttributeToSchemaComponent
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.