com.sun.org.apache.xerces.internal.impl.xs.XSGrammarBucket Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.impl.xs.XSGrammarBucket. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public XSDHandler (XSGrammarBucket gBucket) {
    this();
    fGrammarBucket = gBucket;

    // Note: don't use SchemaConfiguration internally
    //       we will get stack overflaw because
    //       XMLSchemaValidator will be instantiating XSDHandler...
    fSchemaGrammarDescription = new XSDDescription();
}
 
Example #2
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public XSDHandler (XSGrammarBucket gBucket) {
    this();
    fGrammarBucket = gBucket;

    // Note: don't use SchemaConfiguration internally
    //       we will get stack overflaw because
    //       XMLSchemaValidator will be instantiating XSDHandler...
    fSchemaGrammarDescription = new XSDDescription();
}
 
Example #3
Source File: XSDHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public XSDHandler (XSGrammarBucket gBucket) {
    this();
    fGrammarBucket = gBucket;

    // Note: don't use SchemaConfiguration internally
    //       we will get stack overflaw because
    //       XMLSchemaValidator will be instantiating XSDHandler...
    fSchemaGrammarDescription = new XSDDescription();
}
 
Example #4
Source File: XSDHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public XSDHandler (XSGrammarBucket gBucket) {
    this();
    fGrammarBucket = gBucket;

    // Note: don't use SchemaConfiguration internally
    //       we will get stack overflaw because
    //       XMLSchemaValidator will be instantiating XSDHandler...
    fSchemaGrammarDescription = new XSDDescription();
}
 
Example #5
Source File: XSDHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public XSDHandler (XSGrammarBucket gBucket) {
    this();
    fGrammarBucket = gBucket;

    // Note: don't use SchemaConfiguration internally
    //       we will get stack overflaw because
    //       XMLSchemaValidator will be instantiating XSDHandler...
    fSchemaGrammarDescription = new XSDDescription();
}
 
Example #6
Source File: XSDHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public XSDHandler (XSGrammarBucket gBucket) {
    this();
    fGrammarBucket = gBucket;

    // Note: don't use SchemaConfiguration internally
    //       we will get stack overflaw because
    //       XMLSchemaValidator will be instantiating XSDHandler...
    fSchemaGrammarDescription = new XSDDescription();
}
 
Example #7
Source File: XSDHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public XSDHandler (XSGrammarBucket gBucket) {
    this();
    fGrammarBucket = gBucket;

    // Note: don't use SchemaConfiguration internally
    //       we will get stack overflaw because
    //       XMLSchemaValidator will be instantiating XSDHandler...
    fSchemaGrammarDescription = new XSDDescription();
}
 
Example #8
Source File: XSDHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public XSDHandler (XSGrammarBucket gBucket) {
    this();
    fGrammarBucket = gBucket;

    // Note: don't use SchemaConfiguration internally
    //       we will get stack overflaw because
    //       XMLSchemaValidator will be instantiating XSDHandler...
    fSchemaGrammarDescription = new XSDDescription();
}
 
Example #9
Source File: XSDHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public XSDHandler (XSGrammarBucket gBucket) {
    this();
    fGrammarBucket = gBucket;

    // Note: don't use SchemaConfiguration internally
    //       we will get stack overflaw because
    //       XMLSchemaValidator will be instantiating XSDHandler...
    fSchemaGrammarDescription = new XSDDescription();
}
 
Example #10
Source File: XSDHandler.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public XSDHandler (XSGrammarBucket gBucket) {
    this();
    fGrammarBucket = gBucket;

    // Note: don't use SchemaConfiguration internally
    //       we will get stack overflaw because
    //       XMLSchemaValidator will be instantiating XSDHandler...
    fSchemaGrammarDescription = new XSDDescription();
}
 
Example #11
Source File: XSDHandler.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void refreshGrammars(XSGrammarBucket gBucket) {
    fGrammarBucket = gBucket;
    fInitialGrammarSet = null;
}
 
Example #12
Source File: XSAttributeChecker.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example #13
Source File: XSAttributeChecker.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example #14
Source File: XSAttributeChecker.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example #15
Source File: XSDHandler.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void refreshGrammars(XSGrammarBucket gBucket) {
    fGrammarBucket = gBucket;
    fInitialGrammarSet = null;
}
 
Example #16
Source File: XSAttributeChecker.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example #17
Source File: XSDHandler.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void refreshGrammars(XSGrammarBucket gBucket) {
    fGrammarBucket = gBucket;
    fInitialGrammarSet = null;
}
 
Example #18
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void refreshGrammars(XSGrammarBucket gBucket) {
    fGrammarBucket = gBucket;
    fInitialGrammarSet = null;
}
 
Example #19
Source File: XSAttributeChecker.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    XSAttributeDecl attrDecl;
    for (Map.Entry<String, List<String>> entry : fNonSchemaAttrs.entrySet()) {
        // get name, uri, localpart
        String attrRName = entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        List<String> values = entry.getValue();
        String elName;
        String attrName = values.get(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = values.get(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate(values.get(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example #20
Source File: XSAttributeChecker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example #21
Source File: XSDHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void refreshGrammars(XSGrammarBucket gBucket) {
    fGrammarBucket = gBucket;
    fInitialGrammarSet = null;
}
 
Example #22
Source File: XSAttributeChecker.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example #23
Source File: XSDHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void refreshGrammars(XSGrammarBucket gBucket) {
    fGrammarBucket = gBucket;
    fInitialGrammarSet = null;
}
 
Example #24
Source File: XSAttributeChecker.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example #25
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public void refreshGrammars(XSGrammarBucket gBucket) {
    fGrammarBucket = gBucket;
    fInitialGrammarSet = null;
}
 
Example #26
Source File: XSAttributeChecker.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example #27
Source File: XSDHandler.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void refreshGrammars(XSGrammarBucket gBucket) {
    fGrammarBucket = gBucket;
    fInitialGrammarSet = null;
}
 
Example #28
Source File: XSAttributeChecker.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}
 
Example #29
Source File: XSDHandler.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void refreshGrammars(XSGrammarBucket gBucket) {
    fGrammarBucket = gBucket;
    fInitialGrammarSet = null;
}
 
Example #30
Source File: XSAttributeChecker.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
    // for all attributes
    Iterator entries = fNonSchemaAttrs.entrySet().iterator();
    XSAttributeDecl attrDecl;
    while (entries.hasNext()) {
        Map.Entry entry = (Map.Entry) entries.next();
        // get name, uri, localpart
        String attrRName = (String) entry.getKey();
        String attrURI = attrRName.substring(0,attrRName.indexOf(','));
        String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
        // find associated grammar
        SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
        if (sGrammar == null) {
            continue;
        }
        // and get the datatype validator, if there is one
        attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
        if (attrDecl == null) {
            continue;
        }
        XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
        if (dv == null) {
            continue;
        }

        // get all values appeared with this attribute name
        Vector values = (Vector) entry.getValue();
        String elName;
        String attrName = (String)values.elementAt(0);
        // for each of the values
        int count = values.size();
        for (int i = 1; i < count; i += 2) {
            elName = (String)values.elementAt(i);
            try {
                // and validate it using the XSSimpleType
                // REVISIT: what would be the proper validation context?
                //          guess we need to save that in the vectors too.
                dv.validate((String)values.elementAt(i+1), null, null);
            } catch(InvalidDatatypeValueException ide) {
                reportSchemaError ("s4s-att-invalid-value",
                                   new Object[] {elName, attrName, ide.getMessage()},
                                   null);
            }
        }
    }
}