Java Code Examples for com.sun.org.apache.xerces.internal.xni.XMLAttributes#getType()

The following examples show how to use com.sun.org.apache.xerces.internal.xni.XMLAttributes#getType() . 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: XPointerElementHandler.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public boolean checkStringToken(QName element, XMLAttributes attributes){
    QName cacheQName = null;
    String id =null;
    String rawname =null;
    QName attrName = new QName();
    String attrType = null;
    String attrValue = null;
    int attrCount = attributes.getLength();
    for (int i = 0; i < attrCount; i++) {
        Augmentations aaugs = attributes.getAugmentations(i);
        attributes.getName(i,attrName);
        attrType = attributes.getType(i);
        attrValue = attributes.getValue(i);
        if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
            if(hasMoreToken()){
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                return true;
            }
            else{
                foundElement = element;
                includeElement = true;
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                fSubResourceIdentified = true;
                return true;
            }
        }
    }
    return false;
}
 
Example 2
Source File: XPointerElementHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean checkStringToken(QName element, XMLAttributes attributes){
    QName cacheQName = null;
    String id =null;
    String rawname =null;
    QName attrName = new QName();
    String attrType = null;
    String attrValue = null;
    int attrCount = attributes.getLength();
    for (int i = 0; i < attrCount; i++) {
        Augmentations aaugs = attributes.getAugmentations(i);
        attributes.getName(i,attrName);
        attrType = attributes.getType(i);
        attrValue = attributes.getValue(i);
        if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
            if(hasMoreToken()){
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                return true;
            }
            else{
                foundElement = element;
                includeElement = true;
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                fSubResourceIdentified = true;
                return true;
            }
        }
    }
    return false;
}
 
Example 3
Source File: XPointerElementHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public boolean checkStringToken(QName element, XMLAttributes attributes){
    QName cacheQName = null;
    String id =null;
    String rawname =null;
    QName attrName = new QName();
    String attrType = null;
    String attrValue = null;
    int attrCount = attributes.getLength();
    for (int i = 0; i < attrCount; i++) {
        Augmentations aaugs = attributes.getAugmentations(i);
        attributes.getName(i,attrName);
        attrType = attributes.getType(i);
        attrValue = attributes.getValue(i);
        if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
            if(hasMoreToken()){
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                return true;
            }
            else{
                foundElement = element;
                includeElement = true;
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                fSubResourceIdentified = true;
                return true;
            }
        }
    }
    return false;
}
 
Example 4
Source File: XPointerElementHandler.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public boolean checkStringToken(QName element, XMLAttributes attributes){
    QName cacheQName = null;
    String id =null;
    String rawname =null;
    QName attrName = new QName();
    String attrType = null;
    String attrValue = null;
    int attrCount = attributes.getLength();
    for (int i = 0; i < attrCount; i++) {
        Augmentations aaugs = attributes.getAugmentations(i);
        attributes.getName(i,attrName);
        attrType = attributes.getType(i);
        attrValue = attributes.getValue(i);
        if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
            if(hasMoreToken()){
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                return true;
            }
            else{
                foundElement = element;
                includeElement = true;
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                fSubResourceIdentified = true;
                return true;
            }
        }
    }
    return false;
}
 
Example 5
Source File: XPointerElementHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean checkStringToken(QName element, XMLAttributes attributes){
    QName cacheQName = null;
    String id =null;
    String rawname =null;
    QName attrName = new QName();
    String attrType = null;
    String attrValue = null;
    int attrCount = attributes.getLength();
    for (int i = 0; i < attrCount; i++) {
        Augmentations aaugs = attributes.getAugmentations(i);
        attributes.getName(i,attrName);
        attrType = attributes.getType(i);
        attrValue = attributes.getValue(i);
        if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
            if(hasMoreToken()){
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                return true;
            }
            else{
                foundElement = element;
                includeElement = true;
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                fSubResourceIdentified = true;
                return true;
            }
        }
    }
    return false;
}
 
Example 6
Source File: XPointerElementHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public boolean checkStringToken(QName element, XMLAttributes attributes){
    QName cacheQName = null;
    String id =null;
    String rawname =null;
    QName attrName = new QName();
    String attrType = null;
    String attrValue = null;
    int attrCount = attributes.getLength();
    for (int i = 0; i < attrCount; i++) {
        Augmentations aaugs = attributes.getAugmentations(i);
        attributes.getName(i,attrName);
        attrType = attributes.getType(i);
        attrValue = attributes.getValue(i);
        if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
            if(hasMoreToken()){
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                return true;
            }
            else{
                foundElement = element;
                includeElement = true;
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                fSubResourceIdentified = true;
                return true;
            }
        }
    }
    return false;
}
 
Example 7
Source File: XPointerElementHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public boolean checkStringToken(QName element, XMLAttributes attributes){
    QName cacheQName = null;
    String id =null;
    String rawname =null;
    QName attrName = new QName();
    String attrType = null;
    String attrValue = null;
    int attrCount = attributes.getLength();
    for (int i = 0; i < attrCount; i++) {
        Augmentations aaugs = attributes.getAugmentations(i);
        attributes.getName(i,attrName);
        attrType = attributes.getType(i);
        attrValue = attributes.getValue(i);
        if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
            if(hasMoreToken()){
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                return true;
            }
            else{
                foundElement = element;
                includeElement = true;
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                fSubResourceIdentified = true;
                return true;
            }
        }
    }
    return false;
}
 
Example 8
Source File: XPointerElementHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public boolean checkStringToken(QName element, XMLAttributes attributes){
    QName cacheQName = null;
    String id =null;
    String rawname =null;
    QName attrName = new QName();
    String attrType = null;
    String attrValue = null;
    int attrCount = attributes.getLength();
    for (int i = 0; i < attrCount; i++) {
        Augmentations aaugs = attributes.getAugmentations(i);
        attributes.getName(i,attrName);
        attrType = attributes.getType(i);
        attrValue = attributes.getValue(i);
        if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
            if(hasMoreToken()){
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                return true;
            }
            else{
                foundElement = element;
                includeElement = true;
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                fSubResourceIdentified = true;
                return true;
            }
        }
    }
    return false;
}
 
Example 9
Source File: XPointerElementHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean checkStringToken(QName element, XMLAttributes attributes){
    QName cacheQName = null;
    String id =null;
    String rawname =null;
    QName attrName = new QName();
    String attrType = null;
    String attrValue = null;
    int attrCount = attributes.getLength();
    for (int i = 0; i < attrCount; i++) {
        Augmentations aaugs = attributes.getAugmentations(i);
        attributes.getName(i,attrName);
        attrType = attributes.getType(i);
        attrValue = attributes.getValue(i);
        if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){
            if(hasMoreToken()){
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                return true;
            }
            else{
                foundElement = element;
                includeElement = true;
                fCurrentTokenType = 0;
                fCurrentTokenString = null;
                fSubResourceIdentified = true;
                return true;
            }
        }
    }
    return false;
}
 
Example 10
Source File: DOMNormalizer.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * The start of an element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void startElement(QName element, XMLAttributes attributes, Augmentations augs)
    throws XNIException {
    Element currentElement = (Element) fCurrentNode;
    int attrCount = attributes.getLength();
    if (DEBUG_EVENTS) {
        System.out.println("==>startElement: " +element+
                " attrs.length="+attrCount);
    }

    for (int i = 0; i < attrCount; i++) {
        attributes.getName(i, fAttrQName);
        Attr attr = null;

        attr = currentElement.getAttributeNodeNS(fAttrQName.uri, fAttrQName.localpart);
        if (attr == null) {
            // Must be a non-namespace aware DOM Level 1 node.
            attr = currentElement.getAttributeNode(fAttrQName.rawname);
        }
        AttributePSVI attrPSVI =
            (AttributePSVI) attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI);

        if (attrPSVI != null) {
            //REVISIT: instead we should be using augmentations:
            // to set/retrieve Id attributes
            XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition();
            boolean id = false;
            if (decl != null) {
                id = ((XSSimpleType)decl).isIDType();
            }
            else {
                decl = attrPSVI.getTypeDefinition();
                if (decl != null) {
                    id = ((XSSimpleType)decl).isIDType();
                }
            }
            if (id) {
                ((ElementImpl)currentElement).setIdAttributeNode(attr, true);
            }

            if (fPSVI) {
                ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI);
            }

            // Updating the TypeInfo for this attribute.
            ((AttrImpl) attr).setType(decl);

            if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) {
                // datatype-normalization
                // NOTE: The specified value MUST be set after we set
                //       the node value because that turns the "specified"
                //       flag to "true" which may overwrite a "false"
                //       value from the attribute list.
                final String normalizedValue = attrPSVI.getSchemaValue().getNormalizedValue();
                if (normalizedValue != null) {
                    boolean specified = attr.getSpecified();
                    attr.setValue(normalizedValue);
                    if (!specified) {
                        ((AttrImpl) attr).setSpecified(specified);
                    }
                }
            }
        }
        else { // DTD
            String type = null;
            boolean isDeclared = Boolean.TRUE.equals(attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_DECLARED));
            // For DOM Level 3 TypeInfo, the type name must
            // be null if this attribute has not been declared
            // in the DTD.
            if (isDeclared) {
                type = attributes.getType(i);
                if ("ID".equals (type)) {
                    ((ElementImpl) currentElement).setIdAttributeNode(attr, true);
                }
            }
            // Updating the TypeInfo for this attribute.
            ((AttrImpl) attr).setType(type);
        }
    }
}