com.sun.xml.internal.fastinfoset.util.LocalNameQualifiedNamesMap Java Examples

The following examples show how to use com.sun.xml.internal.fastinfoset.util.LocalNameQualifiedNamesMap. 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: Encoder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Attribute Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.17 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralAttributeQualifiedNameOnSecondBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeAttributeQualifiedNameOnSecondBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
                return;
            }
        }
    }

    encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #2
Source File: Encoder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Element Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.18 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralElementQualifiedNameOnThirdBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeElementQualifiedNameOnThirdBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #3
Source File: Encoder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Attribute Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.17 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralAttributeQualifiedNameOnSecondBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeAttributeQualifiedNameOnSecondBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
                return;
            }
        }
    }

    encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #4
Source File: Encoder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Attribute Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.17 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralAttributeQualifiedNameOnSecondBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeAttributeQualifiedNameOnSecondBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
                return;
            }
        }
    }

    encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #5
Source File: DOMDocumentSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected final void encodeElement(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        final QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    // Was DOM node created using an NS-aware call?
    if (localName != null) {
        encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefixFromQualifiedName(qName),
                localName, entry);
    } else {
        encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, "", qName, entry);
    }
}
 
Example #6
Source File: SAXDocumentSerializerWithPrefixMapping.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected final boolean encodeAttribute(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        if (encodeAttributeMapEntry(entry, namespaceURI)) return true;
        // Check the entry is a member of the read only map
        if (_v.attributeName.isQNameFromReadOnlyMap(entry._value[0])) {
            entry = _v.attributeName.obtainDynamicEntry(localName);
            if (entry._valueIndex > 0) {
                if (encodeAttributeMapEntry(entry, namespaceURI)) return true;
            }
        }
    }

    return encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, getPrefix(namespaceURI),
            localName, entry);
}
 
Example #7
Source File: Encoder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Element Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.18 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralElementQualifiedNameOnThirdBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeElementQualifiedNameOnThirdBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #8
Source File: DOMDocumentSerializer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected final void encodeElement(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        final QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    // Was DOM node created using an NS-aware call?
    if (localName != null) {
        encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefixFromQualifiedName(qName),
                localName, entry);
    } else {
        encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, "", qName, entry);
    }
}
 
Example #9
Source File: Encoder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Attribute Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.17 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralAttributeQualifiedNameOnSecondBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeAttributeQualifiedNameOnSecondBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
                return;
            }
        }
    }

    encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #10
Source File: DOMDocumentSerializer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected final void encodeElement(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        final QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    // Was DOM node created using an NS-aware call?
    if (localName != null) {
        encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefixFromQualifiedName(qName),
                localName, entry);
    } else {
        encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, "", qName, entry);
    }
}
 
Example #11
Source File: SAXDocumentSerializer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void encodeElement(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            final QualifiedName n = names[i];
            if ((namespaceURI == n.namespaceName || namespaceURI.equals(n.namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefixFromQualifiedName(qName),
            localName, entry);
}
 
Example #12
Source File: SAXDocumentSerializer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void encodeElement(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            final QualifiedName n = names[i];
            if ((namespaceURI == n.namespaceName || namespaceURI.equals(n.namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefixFromQualifiedName(qName),
            localName, entry);
}
 
Example #13
Source File: Encoder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Attribute Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.17 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralAttributeQualifiedNameOnSecondBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeAttributeQualifiedNameOnSecondBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
                return;
            }
        }
    }

    encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #14
Source File: DOMDocumentSerializer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected final void encodeAttribute(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        final QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
                return;
            }
        }
    }

    // Was DOM node created using an NS-aware call?
    if (localName != null) {
        encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, getPrefixFromQualifiedName(qName),
                localName, entry);
    } else {
        encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, "", qName, entry);
    }
}
 
Example #15
Source File: Encoder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Element Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.18 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralElementQualifiedNameOnThirdBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeElementQualifiedNameOnThirdBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #16
Source File: SAXDocumentSerializerWithPrefixMapping.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected final boolean encodeAttribute(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        if (encodeAttributeMapEntry(entry, namespaceURI)) return true;
        // Check the entry is a member of the read only map
        if (_v.attributeName.isQNameFromReadOnlyMap(entry._value[0])) {
            entry = _v.attributeName.obtainDynamicEntry(localName);
            if (entry._valueIndex > 0) {
                if (encodeAttributeMapEntry(entry, namespaceURI)) return true;
            }
        }
    }

    return encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, getPrefix(namespaceURI),
            localName, entry);
}
 
Example #17
Source File: SAXDocumentSerializerWithPrefixMapping.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected final void encodeElement(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        if (encodeElementMapEntry(entry, namespaceURI)) return;
        // Check the entry is a member of the read only map
        if (_v.elementName.isQNameFromReadOnlyMap(entry._value[0])) {
            entry = _v.elementName.obtainDynamicEntry(localName);
            if (entry._valueIndex > 0) {
                if (encodeElementMapEntry(entry, namespaceURI)) return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefix(namespaceURI),
            localName, entry);
}
 
Example #18
Source File: SAXDocumentSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void encodeElement(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            final QualifiedName n = names[i];
            if ((namespaceURI == n.namespaceName || namespaceURI.equals(n.namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefixFromQualifiedName(qName),
            localName, entry);
}
 
Example #19
Source File: SAXDocumentSerializerWithPrefixMapping.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected final boolean encodeAttribute(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        if (encodeAttributeMapEntry(entry, namespaceURI)) return true;
        // Check the entry is a member of the read only map
        if (_v.attributeName.isQNameFromReadOnlyMap(entry._value[0])) {
            entry = _v.attributeName.obtainDynamicEntry(localName);
            if (entry._valueIndex > 0) {
                if (encodeAttributeMapEntry(entry, namespaceURI)) return true;
            }
        }
    }

    return encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, getPrefix(namespaceURI),
            localName, entry);
}
 
Example #20
Source File: Encoder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Attribute Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.17 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralAttributeQualifiedNameOnSecondBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeAttributeQualifiedNameOnSecondBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
                return;
            }
        }
    }

    encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #21
Source File: SAXDocumentSerializerWithPrefixMapping.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected final void encodeElement(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        if (encodeElementMapEntry(entry, namespaceURI)) return;
        // Check the entry is a member of the read only map
        if (_v.elementName.isQNameFromReadOnlyMap(entry._value[0])) {
            entry = _v.elementName.obtainDynamicEntry(localName);
            if (entry._valueIndex > 0) {
                if (encodeElementMapEntry(entry, namespaceURI)) return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefix(namespaceURI),
            localName, entry);
}
 
Example #22
Source File: DOMDocumentSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected final void encodeAttribute(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        final QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
                return;
            }
        }
    }

    // Was DOM node created using an NS-aware call?
    if (localName != null) {
        encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, getPrefixFromQualifiedName(qName),
                localName, entry);
    } else {
        encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, "", qName, entry);
    }
}
 
Example #23
Source File: SAXDocumentSerializerWithPrefixMapping.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected final void encodeElement(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        if (encodeElementMapEntry(entry, namespaceURI)) return;
        // Check the entry is a member of the read only map
        if (_v.elementName.isQNameFromReadOnlyMap(entry._value[0])) {
            entry = _v.elementName.obtainDynamicEntry(localName);
            if (entry._valueIndex > 0) {
                if (encodeElementMapEntry(entry, namespaceURI)) return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefix(namespaceURI),
            localName, entry);
}
 
Example #24
Source File: Encoder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Element Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.18 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralElementQualifiedNameOnThirdBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeElementQualifiedNameOnThirdBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #25
Source File: SAXDocumentSerializer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected void encodeElement(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            final QualifiedName n = names[i];
            if ((namespaceURI == n.namespaceName || namespaceURI.equals(n.namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefixFromQualifiedName(qName),
            localName, entry);
}
 
Example #26
Source File: Encoder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Encode a qualified name of an Element Informaiton Item on the third bit
 * of an octet.
 * Implementation of clause C.18 of ITU-T Rec. X.891 | ISO/IEC 24824-1.
 *
 * <p>
 * The index of the qualified name will be encoded if the name is present
 * in the vocabulary otherwise the qualified name will be encoded literally
 * (see {@link #encodeLiteralElementQualifiedNameOnThirdBit}).
 *
 * @param namespaceURI the namespace URI of the qualified name.
 * @param prefix the prefix of the qualified name.
 * @param localName the local name of the qualified name.
 */
protected final void encodeElementQualifiedNameOnThirdBit(String namespaceURI, String prefix, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((prefix == names[i].prefix || prefix.equals(names[i].prefix))
                    && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnThirdBit(names[i].index);
                return;
            }
        }
    }

    encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, prefix,
            localName, entry);
}
 
Example #27
Source File: SAXDocumentSerializerWithPrefixMapping.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected boolean encodeAttributeMapEntry(LocalNameQualifiedNamesMap.Entry entry, String namespaceURI) throws IOException {
    QualifiedName[] names = entry._value;
    for (int i = 0; i < entry._valueIndex; i++) {
        if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
            encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
            return true;
        }
    }
    return false;
}
 
Example #28
Source File: StAXDocumentSerializer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean encodeAttribute(String namespaceURI, String prefix, String localName) throws IOException {
    final LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName);
    for (int i = 0; i < entry._valueIndex; i++) {
        final QualifiedName name = entry._value[i];
        if ((prefix == name.prefix || prefix.equals(name.prefix))
                && (namespaceURI == name.namespaceName || namespaceURI.equals(name.namespaceName))) {
            encodeNonZeroIntegerOnSecondBitFirstBitZero(name.index);
            return true;
        }
    }

    entry.addQualifiedName(new QualifiedName(prefix, namespaceURI, localName, "", _v.attributeName.getNextIndex()));
    return false;
}
 
Example #29
Source File: SAXDocumentSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected boolean encodeAttribute(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
                return true;
            }
        }
    }

    return encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, getPrefixFromQualifiedName(qName),
            localName, entry);
}
 
Example #30
Source File: SAXDocumentSerializer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected boolean encodeAttribute(String namespaceURI, String qName, String localName) throws IOException {
    LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(qName);
    if (entry._valueIndex > 0) {
        QualifiedName[] names = entry._value;
        for (int i = 0; i < entry._valueIndex; i++) {
            if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) {
                encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index);
                return true;
            }
        }
    }

    return encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, getPrefixFromQualifiedName(qName),
            localName, entry);
}