Java Code Examples for com.sun.org.apache.xml.internal.serializer.ElemDesc#isAttrFlagSet()

The following examples show how to use com.sun.org.apache.xml.internal.serializer.ElemDesc#isAttrFlagSet() . 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: LiteralAttribute.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}
 
Example 2
Source File: LiteralAttribute.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}
 
Example 3
Source File: LiteralAttribute.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}
 
Example 4
Source File: LiteralAttribute.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}
 
Example 5
Source File: LiteralAttribute.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}
 
Example 6
Source File: LiteralAttribute.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}
 
Example 7
Source File: LiteralAttribute.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}
 
Example 8
Source File: LiteralAttribute.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}
 
Example 9
Source File: LiteralAttribute.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}
 
Example 10
Source File: LiteralAttribute.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}
 
Example 11
Source File: LiteralAttribute.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // push handler
    il.append(methodGen.loadHandler());
    // push attribute name - namespace prefix set by parent node
    il.append(new PUSH(cpg, _name));
    // push attribute value
    _value.translate(classGen, methodGen);

    // Generate code that calls SerializationHandler.addUniqueAttribute()
    // if all attributes are unique.
    SyntaxTreeNode parent = getParent();
    if (parent instanceof LiteralElement
        && ((LiteralElement)parent).allAttributesUnique()) {

        int flags = 0;
        boolean isHTMLAttrEmpty = false;
        ElemDesc elemDesc = ((LiteralElement)parent).getElemDesc();

        // Set the HTML flags
        if (elemDesc != null) {
            if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTREMPTY)) {
                flags = flags | SerializationHandler.HTML_ATTREMPTY;
                isHTMLAttrEmpty = true;
            }
            else if (elemDesc.isAttrFlagSet(_name, ElemDesc.ATTRURL)) {
                flags = flags | SerializationHandler.HTML_ATTRURL;
            }
        }

        if (_value instanceof SimpleAttributeValue) {
            String attrValue = ((SimpleAttributeValue)_value).toString();

            if (!hasBadChars(attrValue) && !isHTMLAttrEmpty) {
                flags = flags | SerializationHandler.NO_BAD_CHARS;
            }
        }

        il.append(new PUSH(cpg, flags));
        il.append(methodGen.uniqueAttribute());
    }
    else {
        // call attribute
        il.append(methodGen.attribute());
    }
}