com.sun.xml.internal.fastinfoset.QualifiedName Java Examples

The following examples show how to use com.sun.xml.internal.fastinfoset.QualifiedName. 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: AttributesHolder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public final int getIndex(String qName) {
    int i = qName.indexOf(':');
    String prefix = "";
    String localName = qName;
    if (i >= 0) {
        prefix = qName.substring(0, i);
        localName = qName.substring(i + 1);
    }

    for (i = 0; i < _attributeCount; i++) {
        QualifiedName name = _names[i];
        if (localName.equals(name.localName) &&
            prefix.equals(name.prefix)) {
            return i;
        }
    }
    return -1;
}
 
Example #2
Source File: AttributesHolder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public final int getIndex(String qName) {
    int i = qName.indexOf(':');
    String prefix = "";
    String localName = qName;
    if (i >= 0) {
        prefix = qName.substring(0, i);
        localName = qName.substring(i + 1);
    }

    for (i = 0; i < _attributeCount; i++) {
        QualifiedName name = _names[i];
        if (localName.equals(name.localName) &&
            prefix.equals(name.prefix)) {
            return i;
        }
    }
    return -1;
}
 
Example #3
Source File: SAXDocumentSerializer.java    From openjdk-jdk8u-backup 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 #4
Source File: AttributesHolder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public final int getIndex(String qName) {
    int i = qName.indexOf(':');
    String prefix = "";
    String localName = qName;
    if (i >= 0) {
        prefix = qName.substring(0, i);
        localName = qName.substring(i + 1);
    }

    for (i = 0; i < _attributeCount; i++) {
        QualifiedName name = _names[i];
        if (localName.equals(name.localName) &&
            prefix.equals(name.prefix)) {
            return i;
        }
    }
    return -1;
}
 
Example #5
Source File: DOMDocumentSerializer.java    From TencentKona-8 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 #6
Source File: DOMDocumentSerializer.java    From openjdk-8-source 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 #7
Source File: AttributesHolder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public final int getIndex(String qName) {
    int i = qName.indexOf(':');
    String prefix = "";
    String localName = qName;
    if (i >= 0) {
        prefix = qName.substring(0, i);
        localName = qName.substring(i + 1);
    }

    for (i = 0; i < _attributeCount; i++) {
        QualifiedName name = _names[i];
        if (localName.equals(name.localName) &&
            prefix.equals(name.prefix)) {
            return i;
        }
    }
    return -1;
}
 
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: AttributesHolder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private final void resize() {
    final int newLength = _attributeCount * 3 / 2 + 1;

    QualifiedName[] names = new QualifiedName[newLength];
    String[] values = new String[newLength];

    String[] algorithmURIs = new String[newLength];
    int[] algorithmIds = new int[newLength];
    Object[] algorithmData = new Object[newLength];

    System.arraycopy(_names, 0, names, 0, _attributeCount);
    System.arraycopy(_values, 0, values, 0, _attributeCount);

    System.arraycopy(_algorithmURIs, 0, algorithmURIs, 0, _attributeCount);
    System.arraycopy(_algorithmIds, 0, algorithmIds, 0, _attributeCount);
    System.arraycopy(_algorithmData, 0, algorithmData, 0, _attributeCount);

    _names = names;
    _values = values;

    _algorithmURIs = algorithmURIs;
    _algorithmIds = algorithmIds;
    _algorithmData = algorithmData;
}
 
Example #10
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 #11
Source File: DOMDocumentSerializer.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(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 #12
Source File: AttributesHolder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private final void resize() {
    final int newLength = _attributeCount * 3 / 2 + 1;

    QualifiedName[] names = new QualifiedName[newLength];
    String[] values = new String[newLength];

    String[] algorithmURIs = new String[newLength];
    int[] algorithmIds = new int[newLength];
    Object[] algorithmData = new Object[newLength];

    System.arraycopy(_names, 0, names, 0, _attributeCount);
    System.arraycopy(_values, 0, values, 0, _attributeCount);

    System.arraycopy(_algorithmURIs, 0, algorithmURIs, 0, _attributeCount);
    System.arraycopy(_algorithmIds, 0, algorithmIds, 0, _attributeCount);
    System.arraycopy(_algorithmData, 0, algorithmData, 0, _attributeCount);

    _names = names;
    _values = values;

    _algorithmURIs = algorithmURIs;
    _algorithmIds = algorithmIds;
    _algorithmData = algorithmData;
}
 
Example #13
Source File: DOMDocumentSerializer.java    From openjdk-jdk8u-backup 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 #14
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 #15
Source File: SAXDocumentSerializer.java    From jdk8u60 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 #16
Source File: AttributesHolder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private final void resize() {
    final int newLength = _attributeCount * 3 / 2 + 1;

    QualifiedName[] names = new QualifiedName[newLength];
    String[] values = new String[newLength];

    String[] algorithmURIs = new String[newLength];
    int[] algorithmIds = new int[newLength];
    Object[] algorithmData = new Object[newLength];

    System.arraycopy(_names, 0, names, 0, _attributeCount);
    System.arraycopy(_values, 0, values, 0, _attributeCount);

    System.arraycopy(_algorithmURIs, 0, algorithmURIs, 0, _attributeCount);
    System.arraycopy(_algorithmIds, 0, algorithmIds, 0, _attributeCount);
    System.arraycopy(_algorithmData, 0, algorithmData, 0, _attributeCount);

    _names = names;
    _values = values;

    _algorithmURIs = algorithmURIs;
    _algorithmIds = algorithmIds;
    _algorithmData = algorithmData;
}
 
Example #17
Source File: DOMDocumentSerializer.java    From openjdk-8 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 #18
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 #19
Source File: SAXDocumentSerializer.java    From openjdk-jdk8u 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 #20
Source File: SAXDocumentSerializer.java    From hottub 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 #21
Source File: DOMDocumentSerializer.java    From openjdk-jdk8u 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 #22
Source File: SAX2StAXWriter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void startElement(String namespaceURI, String localName,
    String qName, Attributes atts) throws SAXException
{
    try {
        int k = qName.indexOf(':');
        String prefix = (k > 0) ? qName.substring(0, k) : "";
        _writer.writeStartElement(prefix, localName, namespaceURI);

        int length = _namespaces.size();
        for (int i = 0; i < length; i++) {
            QualifiedName nsh = (QualifiedName) _namespaces.get(i);
            _writer.writeNamespace(nsh.prefix, nsh.namespaceName);
        }
        _namespaces.clear();

        length = atts.getLength();
        for (int i = 0; i < length; i++) {
            _writer.writeAttribute(atts.getURI(i),
                                   atts.getLocalName(i),
                                   atts.getValue(i));
        }
    }
    catch (XMLStreamException e) {
        throw new SAXException(e);
    }
}
 
Example #23
Source File: QualifiedNameArray.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public final void add(QualifiedName s) {
    if (_size == _array.length) {
        resize();
    }

   _array[_size++] = s;
}
 
Example #24
Source File: QualifiedNameArray.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected final void resize() {
    if (_size == _maximumCapacity) {
        throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.arrayMaxCapacity"));
    }

    int newSize = _size * 3 / 2 + 1;
    if (newSize > _maximumCapacity) {
        newSize = _maximumCapacity;
    }

    final QualifiedName[] newArray = new QualifiedName[newSize];
    System.arraycopy(_array, 0, newArray, 0, _size);
    _array = newArray;
}
 
Example #25
Source File: LocalNameQualifiedNamesMap.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void addQualifiedName(QualifiedName name) {
    if (_valueIndex < _value.length) {
        _value[_valueIndex++] = name;
    } else if (_valueIndex == _value.length) {
        QualifiedName[] newValue = new QualifiedName[_valueIndex * 3 / 2 + 1];
        System.arraycopy(_value, 0, newValue, 0, _valueIndex);
        _value = newValue;
        _value[_valueIndex++] = name;
    }
}
 
Example #26
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 #27
Source File: QualifiedNameArray.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public final void add(QualifiedName s) {
    if (_size == _array.length) {
        resize();
    }

   _array[_size++] = s;
}
 
Example #28
Source File: StAXDocumentParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected final void processEII(QualifiedName name, boolean hasAttributes) throws FastInfosetException, IOException {
    if (_prefixTable._currentInScope[name.prefixIndex] != name.namespaceNameIndex) {
        throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.qnameOfEIINotInScope"));
    }

    _eventType = START_ELEMENT;
    _qualifiedName = name;

    if (_clearAttributes) {
        _attributes.clear();
        _clearAttributes = false;
    }

    if (hasAttributes) {
        processAIIs();
    }

    // Push element holder onto the stack
    _stackCount++;
    if (_stackCount == _qNameStack.length) {
        QualifiedName[] qNameStack = new QualifiedName[_qNameStack.length * 2];
        System.arraycopy(_qNameStack, 0, qNameStack, 0, _qNameStack.length);
        _qNameStack = qNameStack;

        int[] namespaceAIIsStartStack = new int[_namespaceAIIsStartStack.length * 2];
        System.arraycopy(_namespaceAIIsStartStack, 0, namespaceAIIsStartStack, 0, _namespaceAIIsStartStack.length);
        _namespaceAIIsStartStack = namespaceAIIsStartStack;

        int[] namespaceAIIsEndStack = new int[_namespaceAIIsEndStack.length * 2];
        System.arraycopy(_namespaceAIIsEndStack, 0, namespaceAIIsEndStack, 0, _namespaceAIIsEndStack.length);
        _namespaceAIIsEndStack = namespaceAIIsEndStack;
    }
    _qNameStack[_stackCount] = _qualifiedName;
    _namespaceAIIsStartStack[_stackCount] = _currentNamespaceAIIsStart;
    _namespaceAIIsEndStack[_stackCount] = _currentNamespaceAIIsEnd;
}
 
Example #29
Source File: QualifiedNameArray.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public final QualifiedName[] getCompleteArray() {
        if (_readOnlyArray == null) {
            // Return cloned version of internal _array
            return getArray();
//            return _array;
        } else {
            final QualifiedName[] ra = _readOnlyArray.getCompleteArray();
            final QualifiedName[] a = new QualifiedName[_readOnlyArraySize + _array.length];
            System.arraycopy(ra, 0, a, 0, _readOnlyArraySize);
            return a;
        }
    }
 
Example #30
Source File: AttributesHolder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public final void addAttribute(QualifiedName name, String value) {
    if (_attributeCount == _names.length) {
        resize();
    }
    _names[_attributeCount] = name;
    _values[_attributeCount++] = value;
}