Java Code Examples for com.sun.org.apache.xerces.internal.xs.XSTypeDefinition#getNamespace()

The following examples show how to use com.sun.org.apache.xerces.internal.xs.XSTypeDefinition#getNamespace() . 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: XSSimpleTypeDecl.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * DOM Level 3
 * Checks if a type is derived from another by restriction. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the
 *         reference type
 */
private boolean isDerivedByRestriction (String ancestorNS, String ancestorName, XSTypeDefinition type) {
    XSTypeDefinition oldType = null;
    while (type != null && type != oldType) {
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS != null && ancestorNS.equals(type.getNamespace()))
                        || (type.getNamespace() == null && ancestorNS == null))) {

            return true;
        }
        oldType = type;
        type = type.getBaseType();
    }

    return false;
}
 
Example 2
Source File: XSSimpleTypeDecl.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public boolean derivedFrom(String ancestorNS, String ancestorName, short derivation) {
    // REVISIT: implement according to derivation

    // ancestor is null, retur false
    if (ancestorName == null)
        return false;
    // ancestor is anyType, return true
    if (URI_SCHEMAFORSCHEMA.equals(ancestorNS) &&
            ANY_TYPE.equals(ancestorName)) {
        return true;
    }

    // recursively get base, and compare it with ancestor
    XSTypeDefinition type = this;
    while (!(ancestorName.equals(type.getName()) &&
            ((ancestorNS == null && type.getNamespace() == null) ||
                    (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) &&   // compare with ancestor
                    type != fAnySimpleType) {  // reached anySimpleType
        type = type.getBaseType();
    }

    return type != fAnySimpleType;
}
 
Example 3
Source File: XSSimpleTypeDecl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * DOM Level 3
 * Checks if a type is derived from another by restriction. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the
 *         reference type
 */
private boolean isDerivedByRestriction (String ancestorNS, String ancestorName, XSTypeDefinition type) {
    XSTypeDefinition oldType = null;
    while (type != null && type != oldType) {
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS != null && ancestorNS.equals(type.getNamespace()))
                        || (type.getNamespace() == null && ancestorNS == null))) {

            return true;
        }
        oldType = type;
        type = type.getBaseType();
    }

    return false;
}
 
Example 4
Source File: XSSimpleTypeDecl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * DOM Level 3
 * Checks if a type is derived from another by restriction. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the
 *         reference type
 */
private boolean isDerivedByRestriction (String ancestorNS, String ancestorName, XSTypeDefinition type) {
    XSTypeDefinition oldType = null;
    while (type != null && type != oldType) {
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS != null && ancestorNS.equals(type.getNamespace()))
                        || (type.getNamespace() == null && ancestorNS == null))) {

            return true;
        }
        oldType = type;
        type = type.getBaseType();
    }

    return false;
}
 
Example 5
Source File: XSSimpleTypeDecl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * DOM Level 3
 * Checks if a type is derived from another by restriction. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the
 *         reference type
 */
private boolean isDerivedByRestriction (String ancestorNS, String ancestorName, XSTypeDefinition type) {
    XSTypeDefinition oldType = null;
    while (type != null && type != oldType) {
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS != null && ancestorNS.equals(type.getNamespace()))
                        || (type.getNamespace() == null && ancestorNS == null))) {

            return true;
        }
        oldType = type;
        type = type.getBaseType();
    }

    return false;
}
 
Example 6
Source File: XSSimpleTypeDecl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * DOM Level 3
 * Checks if a type is derived from another by restriction. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the
 *         reference type
 */
private boolean isDerivedByRestriction (String ancestorNS, String ancestorName, XSTypeDefinition type) {
    XSTypeDefinition oldType = null;
    while (type != null && type != oldType) {
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS != null && ancestorNS.equals(type.getNamespace()))
                        || (type.getNamespace() == null && ancestorNS == null))) {

            return true;
        }
        oldType = type;
        type = type.getBaseType();
    }

    return false;
}
 
Example 7
Source File: XSSimpleTypeDecl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * DOM Level 3
 * Checks if a type is derived from another by restriction. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the
 *         reference type
 */
private boolean isDerivedByRestriction (String ancestorNS, String ancestorName, XSTypeDefinition type) {
    XSTypeDefinition oldType = null;
    while (type != null && type != oldType) {
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS != null && ancestorNS.equals(type.getNamespace()))
                        || (type.getNamespace() == null && ancestorNS == null))) {

            return true;
        }
        oldType = type;
        type = type.getBaseType();
    }

    return false;
}
 
Example 8
Source File: XSDHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void addGlobalTypeDecl(XSTypeDefinition decl) {
    final String namespace = decl.getNamespace();
    final String declKey = (namespace == null || namespace.length() == 0)
        ? "," + decl.getName() : namespace + "," + decl.getName();

    if (fGlobalTypeDecls.get(declKey) == null) {
        fGlobalTypeDecls.put(declKey, decl);
    }
}
 
Example 9
Source File: XSDHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
void addGlobalTypeDecl(XSTypeDefinition decl) {
    final String namespace = decl.getNamespace();
    final String declKey = (namespace == null || namespace.length() == 0)
        ? "," + decl.getName() : namespace + "," + decl.getName();

    if (fGlobalTypeDecls.get(declKey) == null) {
        fGlobalTypeDecls.put(declKey, decl);
    }
}
 
Example 10
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void addGlobalTypeDecl(XSTypeDefinition decl) {
    final String namespace = decl.getNamespace();
    final String declKey = (namespace == null || namespace.length() == 0)
        ? "," + decl.getName() : namespace + "," + decl.getName();

    if (fGlobalTypeDecls.get(declKey) == null) {
        fGlobalTypeDecls.put(declKey, decl);
    }
}
 
Example 11
Source File: XSDHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void addGlobalTypeDecl(XSTypeDefinition decl) {
    final String namespace = decl.getNamespace();
    final String declKey = (namespace == null || namespace.length() == 0)
        ? "," + decl.getName() : namespace + "," + decl.getName();

    if (fGlobalTypeDecls.get(declKey) == null) {
        fGlobalTypeDecls.put(declKey, decl);
    }
}
 
Example 12
Source File: XSDHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void addGlobalTypeDecl(XSTypeDefinition decl) {
    final String namespace = decl.getNamespace();
    final String declKey = (namespace == null || namespace.length() == 0)
        ? "," + decl.getName() : namespace + "," + decl.getName();

    if (fGlobalTypeDecls.get(declKey) == null) {
        fGlobalTypeDecls.put(declKey, decl);
    }
}
 
Example 13
Source File: TypeInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public TypeInfoImpl(XSTypeDefinition t) {
    this( t.getNamespace(), t.getName() );
}
 
Example 14
Source File: XSSimpleTypeDecl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Checks if a type is derived from another by any combination of restriction, list ir union. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the reference type
 */
private boolean isDerivedByAny(String ancestorNS, String ancestorName,
        XSTypeDefinition type) {

    boolean derivedFrom = false;
    XSTypeDefinition oldType = null;
    // for each base, item or member type
    while (type != null && type != oldType)  {

        // If the ancestor type is reached or is the same as this type.
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS == null && type.getNamespace() == null)
                        || (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
            derivedFrom = true;
            break;
        }

        // check if derived by restriction or list or union
        if (isDerivedByRestriction(ancestorNS, ancestorName, type)) {
            return true;
        } else if (isDerivedByList(ancestorNS, ancestorName, type)) {
            return true;
        } else  if (isDerivedByUnion(ancestorNS, ancestorName, type)) {
            return true;
        }
        oldType = type;
        // get the base, item or member type depending on the variety
        if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_ABSENT
                || ((XSSimpleTypeDecl) type).getVariety() == VARIETY_ATOMIC) {
            type = type.getBaseType();
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_UNION) {
            for (int i = 0; i < ((XSSimpleTypeDecl) type).getMemberTypes().getLength(); i++) {
                return isDerivedByAny(ancestorNS, ancestorName,
                        (XSTypeDefinition) ((XSSimpleTypeDecl) type)
                        .getMemberTypes().item(i));
            }
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_LIST) {
            type = ((XSSimpleTypeDecl) type).getItemType();
        }
    }

    return derivedFrom;
}
 
Example 15
Source File: XSSimpleTypeDecl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Checks if a type is derived from another by any combination of restriction, list ir union. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the reference type
 */
private boolean isDerivedByAny(String ancestorNS, String ancestorName,
        XSTypeDefinition type) {

    boolean derivedFrom = false;
    XSTypeDefinition oldType = null;
    // for each base, item or member type
    while (type != null && type != oldType)  {

        // If the ancestor type is reached or is the same as this type.
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS == null && type.getNamespace() == null)
                        || (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
            derivedFrom = true;
            break;
        }

        // check if derived by restriction or list or union
        if (isDerivedByRestriction(ancestorNS, ancestorName, type)) {
            return true;
        } else if (isDerivedByList(ancestorNS, ancestorName, type)) {
            return true;
        } else  if (isDerivedByUnion(ancestorNS, ancestorName, type)) {
            return true;
        }
        oldType = type;
        // get the base, item or member type depending on the variety
        if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_ABSENT
                || ((XSSimpleTypeDecl) type).getVariety() == VARIETY_ATOMIC) {
            type = type.getBaseType();
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_UNION) {
            for (int i = 0; i < ((XSSimpleTypeDecl) type).getMemberTypes().getLength(); i++) {
                return isDerivedByAny(ancestorNS, ancestorName,
                        (XSTypeDefinition) ((XSSimpleTypeDecl) type)
                        .getMemberTypes().item(i));
            }
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_LIST) {
            type = ((XSSimpleTypeDecl) type).getItemType();
        }
    }

    return derivedFrom;
}
 
Example 16
Source File: XSSimpleTypeDecl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Checks if a type is derived from another by any combination of restriction, list ir union. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the reference type
 */
private boolean isDerivedByAny(String ancestorNS, String ancestorName,
        XSTypeDefinition type) {

    boolean derivedFrom = false;
    XSTypeDefinition oldType = null;
    // for each base, item or member type
    while (type != null && type != oldType)  {

        // If the ancestor type is reached or is the same as this type.
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS == null && type.getNamespace() == null)
                        || (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
            derivedFrom = true;
            break;
        }

        // check if derived by restriction or list or union
        if (isDerivedByRestriction(ancestorNS, ancestorName, type)) {
            return true;
        } else if (isDerivedByList(ancestorNS, ancestorName, type)) {
            return true;
        } else  if (isDerivedByUnion(ancestorNS, ancestorName, type)) {
            return true;
        }
        oldType = type;
        // get the base, item or member type depending on the variety
        if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_ABSENT
                || ((XSSimpleTypeDecl) type).getVariety() == VARIETY_ATOMIC) {
            type = type.getBaseType();
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_UNION) {
            for (int i = 0; i < ((XSSimpleTypeDecl) type).getMemberTypes().getLength(); i++) {
                return isDerivedByAny(ancestorNS, ancestorName,
                        (XSTypeDefinition) ((XSSimpleTypeDecl) type)
                        .getMemberTypes().item(i));
            }
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_LIST) {
            type = ((XSSimpleTypeDecl) type).getItemType();
        }
    }

    return derivedFrom;
}
 
Example 17
Source File: XSSimpleTypeDecl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Checks if a type is derived from another by any combination of restriction, list ir union. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the reference type
 */
private boolean isDerivedByAny(String ancestorNS, String ancestorName,
        XSTypeDefinition type) {

    boolean derivedFrom = false;
    XSTypeDefinition oldType = null;
    // for each base, item or member type
    while (type != null && type != oldType)  {

        // If the ancestor type is reached or is the same as this type.
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS == null && type.getNamespace() == null)
                        || (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
            derivedFrom = true;
            break;
        }

        // check if derived by restriction or list or union
        if (isDerivedByRestriction(ancestorNS, ancestorName, type)) {
            return true;
        } else if (isDerivedByList(ancestorNS, ancestorName, type)) {
            return true;
        } else  if (isDerivedByUnion(ancestorNS, ancestorName, type)) {
            return true;
        }
        oldType = type;
        // get the base, item or member type depending on the variety
        if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_ABSENT
                || ((XSSimpleTypeDecl) type).getVariety() == VARIETY_ATOMIC) {
            type = type.getBaseType();
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_UNION) {
            for (int i = 0; i < ((XSSimpleTypeDecl) type).getMemberTypes().getLength(); i++) {
                return isDerivedByAny(ancestorNS, ancestorName,
                        (XSTypeDefinition) ((XSSimpleTypeDecl) type)
                        .getMemberTypes().item(i));
            }
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_LIST) {
            type = ((XSSimpleTypeDecl) type).getItemType();
        }
    }

    return derivedFrom;
}
 
Example 18
Source File: XSSimpleTypeDecl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Checks if a type is derived from another by any combination of restriction, list ir union. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the reference type
 */
private boolean isDerivedByAny(String ancestorNS, String ancestorName,
        XSTypeDefinition type) {

    boolean derivedFrom = false;
    XSTypeDefinition oldType = null;
    // for each base, item or member type
    while (type != null && type != oldType)  {

        // If the ancestor type is reached or is the same as this type.
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS == null && type.getNamespace() == null)
                        || (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
            derivedFrom = true;
            break;
        }

        // check if derived by restriction or list or union
        if (isDerivedByRestriction(ancestorNS, ancestorName, type)) {
            return true;
        } else if (isDerivedByList(ancestorNS, ancestorName, type)) {
            return true;
        } else  if (isDerivedByUnion(ancestorNS, ancestorName, type)) {
            return true;
        }
        oldType = type;
        // get the base, item or member type depending on the variety
        if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_ABSENT
                || ((XSSimpleTypeDecl) type).getVariety() == VARIETY_ATOMIC) {
            type = type.getBaseType();
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_UNION) {
            for (int i = 0; i < ((XSSimpleTypeDecl) type).getMemberTypes().getLength(); i++) {
                return isDerivedByAny(ancestorNS, ancestorName,
                        (XSTypeDefinition) ((XSSimpleTypeDecl) type)
                        .getMemberTypes().item(i));
            }
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_LIST) {
            type = ((XSSimpleTypeDecl) type).getItemType();
        }
    }

    return derivedFrom;
}
 
Example 19
Source File: XSSimpleTypeDecl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Checks if a type is derived from another by any combination of restriction, list ir union. See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by restriciton for the reference type
 */
private boolean isDerivedByAny(String ancestorNS, String ancestorName,
        XSTypeDefinition type) {

    boolean derivedFrom = false;
    XSTypeDefinition oldType = null;
    // for each base, item or member type
    while (type != null && type != oldType)  {

        // If the ancestor type is reached or is the same as this type.
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS == null && type.getNamespace() == null)
                        || (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
            derivedFrom = true;
            break;
        }

        // check if derived by restriction or list or union
        if (isDerivedByRestriction(ancestorNS, ancestorName, type)) {
            return true;
        } else if (isDerivedByList(ancestorNS, ancestorName, type)) {
            return true;
        } else  if (isDerivedByUnion(ancestorNS, ancestorName, type)) {
            return true;
        }
        oldType = type;
        // get the base, item or member type depending on the variety
        if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_ABSENT
                || ((XSSimpleTypeDecl) type).getVariety() == VARIETY_ATOMIC) {
            type = type.getBaseType();
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_UNION) {
            for (int i = 0; i < ((XSSimpleTypeDecl) type).getMemberTypes().getLength(); i++) {
                return isDerivedByAny(ancestorNS, ancestorName,
                        (XSTypeDefinition) ((XSSimpleTypeDecl) type)
                        .getMemberTypes().item(i));
            }
        } else if (((XSSimpleTypeDecl) type).getVariety() == VARIETY_LIST) {
            type = ((XSSimpleTypeDecl) type).getItemType();
        }
    }

    return derivedFrom;
}
 
Example 20
Source File: TypeInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public TypeInfoImpl(XSTypeDefinition t) {
    this( t.getNamespace(), t.getName() );
}