Java Code Examples for com.sun.org.apache.xerces.internal.xni.QName#setValues()
The following examples show how to use
com.sun.org.apache.xerces.internal.xni.QName#setValues() .
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: XMLStreamWriterImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Set the specified URI as default namespace in the current namespace context. * * @param uri Namespace URI */ public void setDefaultNamespace(String uri) throws XMLStreamException { if (uri != null) { uri = fSymbolTable.addSymbol(uri); } if (fIsRepairingNamespace) { if (isDefaultNamespace(uri)) { return; } QName qname = new QName(); qname.setValues(DEFAULT_PREFIX, "xmlns", null, uri); fNamespaceDecls.add(qname); } else { fInternalNamespaceContext.declarePrefix(DEFAULT_PREFIX, uri); } }
Example 2
Source File: ValidatorHandlerImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** Fills in a QName object. */ private void fillQName(QName toFill, String uri, String localpart, String raw) { if (!fStringsInternalized) { uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null; localpart = (localpart != null) ? fSymbolTable.addSymbol(localpart) : XMLSymbols.EMPTY_STRING; raw = (raw != null) ? fSymbolTable.addSymbol(raw) : XMLSymbols.EMPTY_STRING; } else { if (uri != null && uri.length() == 0) { uri = null; } if (localpart == null) { localpart = XMLSymbols.EMPTY_STRING; } if (raw == null) { raw = XMLSymbols.EMPTY_STRING; } } String prefix = XMLSymbols.EMPTY_STRING; int prefixIdx = raw.indexOf(':'); if (prefixIdx != -1) { prefix = fSymbolTable.addSymbol(raw.substring(0, prefixIdx)); } toFill.setValues(prefix, localpart, raw, uri); }
Example 3
Source File: ValidatorHandlerImpl.java From Bytecoder with Apache License 2.0 | 6 votes |
/** Fills in a QName object. */ private void fillQName(QName toFill, String uri, String localpart, String raw) { if (!fStringsInternalized) { uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null; localpart = (localpart != null) ? fSymbolTable.addSymbol(localpart) : XMLSymbols.EMPTY_STRING; raw = (raw != null) ? fSymbolTable.addSymbol(raw) : XMLSymbols.EMPTY_STRING; } else { if (uri != null && uri.length() == 0) { uri = null; } if (localpart == null) { localpart = XMLSymbols.EMPTY_STRING; } if (raw == null) { raw = XMLSymbols.EMPTY_STRING; } } String prefix = XMLSymbols.EMPTY_STRING; int prefixIdx = raw.indexOf(':'); if (prefixIdx != -1) { prefix = fSymbolTable.addSymbol(raw.substring(0, prefixIdx)); } toFill.setValues(prefix, localpart, raw, uri); }
Example 4
Source File: ValidatorHandlerImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
/** Fills in a QName object. */ private void fillQName(QName toFill, String uri, String localpart, String raw) { if (!fStringsInternalized) { uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null; localpart = (localpart != null) ? fSymbolTable.addSymbol(localpart) : XMLSymbols.EMPTY_STRING; raw = (raw != null) ? fSymbolTable.addSymbol(raw) : XMLSymbols.EMPTY_STRING; } else { if (uri != null && uri.length() == 0) { uri = null; } if (localpart == null) { localpart = XMLSymbols.EMPTY_STRING; } if (raw == null) { raw = XMLSymbols.EMPTY_STRING; } } String prefix = XMLSymbols.EMPTY_STRING; int prefixIdx = raw.indexOf(':'); if (prefixIdx != -1) { prefix = fSymbolTable.addSymbol(raw.substring(0, prefixIdx)); } toFill.setValues(prefix, localpart, raw, uri); }
Example 5
Source File: ValidatorHandlerImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** Fills in a QName object. */ private void fillQName(QName toFill, String uri, String localpart, String raw) { if (!fStringsInternalized) { uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null; localpart = (localpart != null) ? fSymbolTable.addSymbol(localpart) : XMLSymbols.EMPTY_STRING; raw = (raw != null) ? fSymbolTable.addSymbol(raw) : XMLSymbols.EMPTY_STRING; } else { if (uri != null && uri.length() == 0) { uri = null; } if (localpart == null) { localpart = XMLSymbols.EMPTY_STRING; } if (raw == null) { raw = XMLSymbols.EMPTY_STRING; } } String prefix = XMLSymbols.EMPTY_STRING; int prefixIdx = raw.indexOf(':'); if (prefixIdx != -1) { prefix = fSymbolTable.addSymbol(raw.substring(0, prefixIdx)); } toFill.setValues(prefix, localpart, raw, uri); }
Example 6
Source File: XMLStreamWriterImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Set the specified URI as default namespace in the current namespace context. * * @param uri Namespace URI */ public void setDefaultNamespace(String uri) throws XMLStreamException { if (uri != null) { uri = fSymbolTable.addSymbol(uri); } if (fIsRepairingNamespace) { if (isDefaultNamespace(uri)) { return; } QName qname = new QName(); qname.setValues(DEFAULT_PREFIX, "xmlns", null, uri); fNamespaceDecls.add(qname); } else { fInternalNamespaceContext.declarePrefix(DEFAULT_PREFIX, uri); } }
Example 7
Source File: StAXSchemaParser.java From hottub with GNU General Public License v2.0 | 5 votes |
/** Fills in a QName object. */ final void fillQName(QName toFill, String uri, String localpart, String prefix) { uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null; localpart = (localpart != null) ? fSymbolTable.addSymbol(localpart) : XMLSymbols.EMPTY_STRING; prefix = (prefix != null && prefix.length() > 0) ? fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING; String raw = localpart; if (prefix != XMLSymbols.EMPTY_STRING) { fStringBuffer.clear(); fStringBuffer.append(prefix); fStringBuffer.append(':'); fStringBuffer.append(localpart); raw = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length); } toFill.setValues(prefix, localpart, raw, uri); }
Example 8
Source File: XMLStreamWriterImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Sets the prefix the uri is bound to. This prefix is bound in the scope of * the current START_ELEMENT / END_ELEMENT pair. If this method is called before * a START_ELEMENT has been written the prefix is bound in the root scope. * * @param prefix * @param uri * @throws XMLStreamException */ @Override public void setPrefix(String prefix, String uri) throws XMLStreamException { if (prefix == null) { throw new XMLStreamException("Prefix cannot be null"); } if (uri == null) { throw new XMLStreamException("URI cannot be null"); } prefix = fSymbolTable.addSymbol(prefix); uri = fSymbolTable.addSymbol(uri); if (fIsRepairingNamespace) { String tmpURI = fInternalNamespaceContext.getURI(prefix); if ((tmpURI != null) && (tmpURI == uri)) { return; } if(checkUserNamespaceContext(prefix,uri)) return; QName qname = new QName(); qname.setValues(prefix,XMLConstants.XMLNS_ATTRIBUTE, null,uri); fNamespaceDecls.add(qname); return; } fInternalNamespaceContext.declarePrefix(prefix, uri); }
Example 9
Source File: XMLStreamWriterImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Sets the prefix the uri is bound to. This prefix is bound in the scope of * the current START_ELEMENT / END_ELEMENT pair. If this method is called before * a START_ELEMENT has been written the prefix is bound in the root scope. * * @param prefix * @param uri * @throws XMLStreamException */ public void setPrefix(String prefix, String uri) throws XMLStreamException { if (prefix == null) { throw new XMLStreamException("Prefix cannot be null"); } if (uri == null) { throw new XMLStreamException("URI cannot be null"); } prefix = fSymbolTable.addSymbol(prefix); uri = fSymbolTable.addSymbol(uri); if (fIsRepairingNamespace) { String tmpURI = fInternalNamespaceContext.getURI(prefix); if ((tmpURI != null) && (tmpURI == uri)) { return; } if(checkUserNamespaceContext(prefix,uri)) return; QName qname = new QName(); qname.setValues(prefix,XMLConstants.XMLNS_ATTRIBUTE, null,uri); fNamespaceDecls.add(qname); return; } fInternalNamespaceContext.declarePrefix(prefix, uri); }
Example 10
Source File: XMLStreamWriterImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Sets the prefix the uri is bound to. This prefix is bound in the scope of * the current START_ELEMENT / END_ELEMENT pair. If this method is called before * a START_ELEMENT has been written the prefix is bound in the root scope. * * @param prefix * @param uri * @throws XMLStreamException */ public void setPrefix(String prefix, String uri) throws XMLStreamException { if (prefix == null) { throw new XMLStreamException("Prefix cannot be null"); } if (uri == null) { throw new XMLStreamException("URI cannot be null"); } prefix = fSymbolTable.addSymbol(prefix); uri = fSymbolTable.addSymbol(uri); if (fIsRepairingNamespace) { String tmpURI = fInternalNamespaceContext.getURI(prefix); if ((tmpURI != null) && (tmpURI == uri)) { return; } if(checkUserNamespaceContext(prefix,uri)) return; QName qname = new QName(); qname.setValues(prefix,XMLConstants.XMLNS_ATTRIBUTE, null,uri); fNamespaceDecls.add(qname); return; } fInternalNamespaceContext.declarePrefix(prefix, uri); }
Example 11
Source File: XMLStreamWriterImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Sets the prefix the uri is bound to. This prefix is bound in the scope of * the current START_ELEMENT / END_ELEMENT pair. If this method is called before * a START_ELEMENT has been written the prefix is bound in the root scope. * * @param prefix * @param uri * @throws XMLStreamException */ public void setPrefix(String prefix, String uri) throws XMLStreamException { if (prefix == null) { throw new XMLStreamException("Prefix cannot be null"); } if (uri == null) { throw new XMLStreamException("URI cannot be null"); } prefix = fSymbolTable.addSymbol(prefix); uri = fSymbolTable.addSymbol(uri); if (fIsRepairingNamespace) { String tmpURI = fInternalNamespaceContext.getURI(prefix); if ((tmpURI != null) && (tmpURI == uri)) { return; } if(checkUserNamespaceContext(prefix,uri)) return; QName qname = new QName(); qname.setValues(prefix,XMLConstants.XMLNS_ATTRIBUTE, null,uri); fNamespaceDecls.add(qname); return; } fInternalNamespaceContext.declarePrefix(prefix, uri); }
Example 12
Source File: SchemaContentHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void fillQName(QName toFill, String uri, String localpart, String rawname) { if (!fStringsInternalized) { uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null; localpart = (localpart != null) ? fSymbolTable.addSymbol(localpart) : XMLSymbols.EMPTY_STRING; rawname = (rawname != null) ? fSymbolTable.addSymbol(rawname) : XMLSymbols.EMPTY_STRING; } else { if (uri != null && uri.length() == 0) { uri = null; } if (localpart == null) { localpart = XMLSymbols.EMPTY_STRING; } if (rawname == null) { rawname = XMLSymbols.EMPTY_STRING; } } String prefix = XMLSymbols.EMPTY_STRING; int prefixIdx = rawname.indexOf(':'); if (prefixIdx != -1) { prefix = fSymbolTable.addSymbol(rawname.substring(0, prefixIdx)); // local part may be an empty string if this is a namespace declaration if (localpart == XMLSymbols.EMPTY_STRING) { localpart = fSymbolTable.addSymbol(rawname.substring(prefixIdx + 1)); } } // local part may be an empty string if this is a namespace declaration else if (localpart == XMLSymbols.EMPTY_STRING) { localpart = rawname; } toFill.setValues(prefix, localpart, rawname, uri); }
Example 13
Source File: StAXSchemaParser.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** Fills in a QName object. */ final void fillQName(QName toFill, String uri, String localpart, String prefix) { uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null; localpart = (localpart != null) ? fSymbolTable.addSymbol(localpart) : XMLSymbols.EMPTY_STRING; prefix = (prefix != null && prefix.length() > 0) ? fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING; String raw = localpart; if (prefix != XMLSymbols.EMPTY_STRING) { fStringBuffer.clear(); fStringBuffer.append(prefix); fStringBuffer.append(':'); fStringBuffer.append(localpart); raw = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length); } toFill.setValues(prefix, localpart, raw, uri); }
Example 14
Source File: XMLStreamWriterImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Sets the prefix the uri is bound to. This prefix is bound in the scope of * the current START_ELEMENT / END_ELEMENT pair. If this method is called before * a START_ELEMENT has been written the prefix is bound in the root scope. * * @param prefix * @param uri * @throws XMLStreamException */ public void setPrefix(String prefix, String uri) throws XMLStreamException { if (prefix == null) { throw new XMLStreamException("Prefix cannot be null"); } if (uri == null) { throw new XMLStreamException("URI cannot be null"); } prefix = fSymbolTable.addSymbol(prefix); uri = fSymbolTable.addSymbol(uri); if (fIsRepairingNamespace) { String tmpURI = fInternalNamespaceContext.getURI(prefix); if ((tmpURI != null) && (tmpURI == uri)) { return; } if(checkUserNamespaceContext(prefix,uri)) return; QName qname = new QName(); qname.setValues(prefix,XMLConstants.XMLNS_ATTRIBUTE, null,uri); fNamespaceDecls.add(qname); return; } fInternalNamespaceContext.declarePrefix(prefix, uri); }
Example 15
Source File: XMLStreamWriterImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Sets the prefix the uri is bound to. This prefix is bound in the scope of * the current START_ELEMENT / END_ELEMENT pair. If this method is called before * a START_ELEMENT has been written the prefix is bound in the root scope. * * @param prefix * @param uri * @throws XMLStreamException */ public void setPrefix(String prefix, String uri) throws XMLStreamException { if (prefix == null) { throw new XMLStreamException("Prefix cannot be null"); } if (uri == null) { throw new XMLStreamException("URI cannot be null"); } prefix = fSymbolTable.addSymbol(prefix); uri = fSymbolTable.addSymbol(uri); if (fIsRepairingNamespace) { String tmpURI = fInternalNamespaceContext.getURI(prefix); if ((tmpURI != null) && (tmpURI == uri)) { return; } if(checkUserNamespaceContext(prefix,uri)) return; QName qname = new QName(); qname.setValues(prefix,XMLConstants.XMLNS_ATTRIBUTE, null,uri); fNamespaceDecls.add(qname); return; } fInternalNamespaceContext.declarePrefix(prefix, uri); }
Example 16
Source File: XMLStreamWriterImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * @param prefix * @param localName * @param namespaceURI * @throws XMLStreamException */ public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { try { if (localName == null) { throw new XMLStreamException("Local Name cannot be null"); } if (namespaceURI == null) { throw new XMLStreamException("NamespaceURI cannot be null"); } if (!fIsRepairingNamespace) { if (prefix == null) { throw new XMLStreamException("Prefix cannot be null"); } } if (fStartTagOpened) { closeStartTag(); } openStartTag(); namespaceURI = fSymbolTable.addSymbol(namespaceURI); if (prefix != null) { prefix = fSymbolTable.addSymbol(prefix); } fElementStack.push(prefix, localName, null, namespaceURI, false); fInternalNamespaceContext.pushContext(); String tmpPrefix = fNamespaceContext.getPrefix(namespaceURI); if ((prefix != null) && ((tmpPrefix == null) || !prefix.equals(tmpPrefix))) { fInternalNamespaceContext.declarePrefix(prefix, namespaceURI); } if (fIsRepairingNamespace) { if ((prefix == null) || ((tmpPrefix != null) && prefix.equals(tmpPrefix))) { return; } QName qname = new QName(); qname.setValues(prefix, XMLConstants.XMLNS_ATTRIBUTE, null, namespaceURI); fNamespaceDecls.add(qname); return; } if ((prefix != null) && (prefix != XMLConstants.DEFAULT_NS_PREFIX)) { fWriter.write(prefix); fWriter.write(":"); } fWriter.write(localName); } catch (IOException ex) { throw new XMLStreamException(ex); } }
Example 17
Source File: XMLStreamWriterImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * @param prefix * @param localName * @param namespaceURI * @throws XMLStreamException */ public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { try { if (localName == null) { throw new XMLStreamException("Local Name cannot be null"); } if (namespaceURI == null) { throw new XMLStreamException("NamespaceURI cannot be null"); } if (!fIsRepairingNamespace) { if (prefix == null) { throw new XMLStreamException("Prefix cannot be null"); } } if (fStartTagOpened) { closeStartTag(); } openStartTag(); namespaceURI = fSymbolTable.addSymbol(namespaceURI); if (prefix != null) { prefix = fSymbolTable.addSymbol(prefix); } fElementStack.push(prefix, localName, null, namespaceURI, false); fInternalNamespaceContext.pushContext(); String tmpPrefix = fNamespaceContext.getPrefix(namespaceURI); if ((prefix != null) && ((tmpPrefix == null) || !prefix.equals(tmpPrefix))) { fInternalNamespaceContext.declarePrefix(prefix, namespaceURI); } if (fIsRepairingNamespace) { if ((prefix == null) || ((tmpPrefix != null) && prefix.equals(tmpPrefix))) { return; } QName qname = new QName(); qname.setValues(prefix, XMLConstants.XMLNS_ATTRIBUTE, null, namespaceURI); fNamespaceDecls.add(qname); return; } if ((prefix != null) && (prefix != XMLConstants.DEFAULT_NS_PREFIX)) { fWriter.write(prefix); fWriter.write(":"); } fWriter.write(localName); } catch (IOException ex) { throw new XMLStreamException(ex); } }
Example 18
Source File: XMLStreamWriterImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException { // normalize namespaceURI String namespaceURINormalized = null; if (namespaceURI == null) { namespaceURINormalized = ""; // XMLConstants.NULL_NS_URI } else { namespaceURINormalized = namespaceURI; } try { if (!fStartTagOpened) { throw new IllegalStateException( "Namespace Attribute not associated with any element"); } if (fIsRepairingNamespace) { QName qname = new QName(); qname.setValues(XMLConstants.DEFAULT_NS_PREFIX, XMLConstants.XMLNS_ATTRIBUTE, null, namespaceURINormalized); fNamespaceDecls.add(qname); return; } namespaceURINormalized = fSymbolTable.addSymbol(namespaceURINormalized); if (fInternalNamespaceContext.containsPrefixInCurrentContext("")){ String tmp = fInternalNamespaceContext.getURI(""); if (tmp != null && tmp != namespaceURINormalized) { throw new XMLStreamException( "xmlns has been already bound to " +tmp + ". Rebinding it to "+ namespaceURINormalized + " is an error"); } } fInternalNamespaceContext.declarePrefix("", namespaceURINormalized); // use common namespace code with a prefix == null for xmlns="..." writenamespace(null, namespaceURINormalized); } catch (IOException e) { throw new XMLStreamException(e); } }
Example 19
Source File: XMLAttributesImpl.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * Sets the fields in the given QName structure with the values * of the attribute name at the specified index. * * @param attrIndex The attribute index. * @param attrName The attribute name structure to fill in. */ public void getName(int attrIndex, QName attrName) { attrName.setValues(fAttributes[attrIndex].name); }
Example 20
Source File: XMLAttributesImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Sets the fields in the given QName structure with the values * of the attribute name at the specified index. * * @param attrIndex The attribute index. * @param attrName The attribute name structure to fill in. */ public void getName(int attrIndex, QName attrName) { attrName.setValues(fAttributes[attrIndex].name); }