Java Code Examples for javax.xml.XMLConstants#NULL_NS_URI

The following examples show how to use javax.xml.XMLConstants#NULL_NS_URI . 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: HandlerChainsStringQNameAdapter.java    From tomee with Apache License 2.0 7 votes vote down vote up
@Override
public QName unmarshal(final String value) throws Exception {
    if (value == null || value.isEmpty()) {
        return new QName(XMLConstants.NULL_NS_URI, "");
    }
    final int colonIndex = value.indexOf(':');
    if (colonIndex == -1) {
        return new QName(XMLConstants.NULL_NS_URI, value);
    }
    final String prefix = value.substring(0, colonIndex);
    final String localPart = (colonIndex == (value.length() - 1)) ? "" : value.substring(colonIndex + 1);

    String nameSpaceURI = "";
    if (xmlFilter != null) {
        nameSpaceURI = xmlFilter.lookupNamespaceURI(prefix);
    } else if (namespaceContext != null) {
        nameSpaceURI = namespaceContext.getNamespaceURI(prefix);
    }

    if (nameSpaceURI == null) {
        nameSpaceURI = XMLConstants.NULL_NS_URI;
    }
    return new QName(nameSpaceURI, localPart, prefix);
}
 
Example 2
Source File: OutTransformWriter.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Override
public void writeAttribute(String local, String value) throws XMLStreamException {
    if (matchesDropped(false)) {
        return;
    }
    String uri = XMLConstants.NULL_NS_URI;
    QName expected = attributesMap.get(new QName("", local));
    if (expected != null) {
        if (TransformUtils.isEmptyQName(expected)) {
            return;
        }
        uri = expected.getNamespaceURI();
        local = expected.getLocalPart();
    }
    if (!attributesToElements) {
        if (!uri.isEmpty()) {
            super.writeAttribute(uri, local, value);
        } else {
            super.writeAttribute(local, value);
        }
    } else {
        writeAttributeAsElement(uri, local, value);
    }
}
 
Example 3
Source File: AbstractNamespaceContext.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Nonnull
public final String getNamespaceURI (@Nonnull final String sPrefix)
{
  // According to JavaDoc
  if (sPrefix == null)
    throw new IllegalArgumentException ("null prefix is not allowed!");

  // special "xml:" namespace handling
  if (sPrefix.equals (XMLConstants.XML_NS_PREFIX))
    return XMLConstants.XML_NS_URI;
  // special "xmlns:" namespace handling
  if (sPrefix.equals (XMLConstants.XMLNS_ATTRIBUTE))
    return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;

  // special "" namespace handling
  if (sPrefix.equals (XMLConstants.DEFAULT_NS_PREFIX))
  {
    final String sDefNSURI = getDefaultNamespaceURI ();
    return sDefNSURI != null ? sDefNSURI : XMLConstants.NULL_NS_URI;
  }

  final String ret = getCustomNamespaceURI (sPrefix);
  return ret != null ? ret : XMLConstants.NULL_NS_URI;
}
 
Example 4
Source File: PlutoWebXmlRewriter.java    From portals-pluto with Apache License 2.0 6 votes vote down vote up
public String getNamespaceURI(String prefix)
{
    if (prefix == null)
    {
        throw new NullPointerException("Null prefix");
    }
    else if (this.prefix.equals(prefix))
    {
        return namespaceURI;
    }
    else if ("xml".equals(prefix))
    {
        return XMLConstants.XML_NS_URI;
    }
    return XMLConstants.NULL_NS_URI;
}
 
Example 5
Source File: JAXPNamespaceContextWrapper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public String getPrefix(String uri) {
    if (fNamespaceContext != null) {
        if (uri == null) {
            uri = XMLConstants.NULL_NS_URI;
        }
        String prefix = fNamespaceContext.getPrefix(uri);
        if (prefix == null) {
            prefix = XMLConstants.DEFAULT_NS_PREFIX;
        }
        return (fSymbolTable != null) ? fSymbolTable.addSymbol(prefix) : prefix.intern();
    }
    return null;
}
 
Example 6
Source File: JAXPNamespaceContextWrapper.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public String getPrefix(String uri) {
    if (fNamespaceContext != null) {
        if (uri == null) {
            uri = XMLConstants.NULL_NS_URI;
        }
        String prefix = fNamespaceContext.getPrefix(uri);
        if (prefix == null) {
            prefix = XMLConstants.DEFAULT_NS_PREFIX;
        }
        return (fSymbolTable != null) ? fSymbolTable.addSymbol(prefix) : prefix.intern();
    }
    return null;
}
 
Example 7
Source File: HardcodedPageNamespaceResolver.java    From TranskribusCore with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method returns the uri for all prefixes needed. Wherever possible it
 * uses XMLConstants.
 * 
 * @param prefix
 * @return uri
 */
public String getNamespaceURI(String prefix) {
	if (prefix == null) {
		throw new IllegalArgumentException("No namespace prefix provided!");
	} else if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) {
		return defaultNamespace;
	} else if (prefix.equals("xsi")) {
		return xsiNamespace;
	}
	// add additonal else if clauses for more hardcoded namespaces here...
	else {
		return XMLConstants.NULL_NS_URI;
	}
}
 
Example 8
Source File: JAXPNamespaceContextWrapper.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public String getPrefix(String uri) {
    if (fNamespaceContext != null) {
        if (uri == null) {
            uri = XMLConstants.NULL_NS_URI;
        }
        String prefix = fNamespaceContext.getPrefix(uri);
        if (prefix == null) {
            prefix = XMLConstants.DEFAULT_NS_PREFIX;
        }
        return (fSymbolTable != null) ? fSymbolTable.addSymbol(prefix) : prefix.intern();
    }
    return null;
}
 
Example 9
Source File: XMLUnitNamespaceContext2Jaxp13.java    From xmlunit with Apache License 2.0 5 votes vote down vote up
public String getNamespaceURI(String prefix) {
    if (prefix == null) {
        throw new IllegalArgumentException("prefix must not be null");
    }
    String uri = nsMap.get(prefix);
    if (uri == null) {
        uri = XMLConstants.NULL_NS_URI;
    }
    return uri;
}
 
Example 10
Source File: WctNamespaceContext.java    From webcurator with Apache License 2.0 5 votes vote down vote up
public String getNamespaceURI(String prefix) {
    if (prefix == null) throw new NullPointerException("Null prefix");
    else if ("mets".equals(prefix)) return "http://www.loc.gov/METS/";
    else if ("dc".equals(prefix)) return "http://purl.org/dc/elements/1.1/";
    else if ("wct".equals(prefix)) return "http://dia-nz.github.io/webcurator/schemata/webcuratortool-1.0.dtd";
    else if ("xlink".equals(prefix)) return "http://www.w3.org/1999/xlink";
    else if ("xml".equals(prefix)) return XMLConstants.XML_NS_URI;
    return XMLConstants.NULL_NS_URI;
}
 
Example 11
Source File: QName.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * <p><code>QName</code> derived from parsing the formatted
 * <code>String</code>.</p>
 *
 * <p>If the <code>String</code> is <code>null</code> or does not conform to
 * {@link #toString() QName.toString()} formatting, an
 * <code>IllegalArgumentException</code> is thrown.</p>
 *
 * <p><em>The <code>String</code> <strong>MUST</strong> be in the
 * form returned by {@link #toString() QName.toString()}.</em></p>
 *
 * <p>The commonly accepted way of representing a <code>QName</code>
 * as a <code>String</code> was <a href="http://jclark.com/xml/xmlns.htm">defined</a>
 * by James Clark.  Although this is not a <em>standard</em>
 * specification, it is in common use,  e.g. {@link javax.xml.transform.Transformer#setParameter(String name, Object value)}.
 * This implementation parses a <code>String</code> formatted
 * as: "{" + Namespace URI + "}" + local part.  If the Namespace
 * URI <code>.equals(XMLConstants.NULL_NS_URI)</code>, only the
 * local part should be provided.</p>
 *
 * <p>The prefix value <strong><em>CANNOT</em></strong> be
 * represented in the <code>String</code> and will be set to
 * {@link javax.xml.XMLConstants#DEFAULT_NS_PREFIX
 * XMLConstants.DEFAULT_NS_PREFIX}.</p>
 *
 * <p>This method does not do full validation of the resulting
 * <code>QName</code>.
 * <p>The Namespace URI is not validated as a
 * <a href="http://www.ietf.org/rfc/rfc2396.txt">URI reference</a>.
 * The local part is not validated as a
 * <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>
 * as specified in
 * <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</a>.</p>
 *
 * @param qNameAsString <code>String</code> representation
 * of the <code>QName</code>
 * @return <code>QName</code> corresponding to the given <code>String</code>
 * @see #toString() QName.toString()
 */
public static QName valueOf(String qNameAsString) {

    // null is not valid
    if (qNameAsString == null) {
        throw new IllegalArgumentException("cannot create QName from \"null\" or \"\" String");
    }

    // "" local part is valid to preserve compatible behavior with QName 1.0
    if (qNameAsString.length() == 0) {
        return new QName(
            XMLConstants.NULL_NS_URI,
            qNameAsString,
            XMLConstants.DEFAULT_NS_PREFIX);
    }

    // local part only?
    if (qNameAsString.charAt(0) != '{') {
        return new QName(
            XMLConstants.NULL_NS_URI,
            qNameAsString,
            XMLConstants.DEFAULT_NS_PREFIX);
    }

    // Namespace URI improperly specified?
    if (qNameAsString.startsWith("{" + XMLConstants.NULL_NS_URI + "}")) {
        throw new IllegalArgumentException(
            "Namespace URI .equals(XMLConstants.NULL_NS_URI), "
            + ".equals(\"" + XMLConstants.NULL_NS_URI + "\"), "
            + "only the local part, "
            + "\"" + qNameAsString.substring(2 + XMLConstants.NULL_NS_URI.length()) + "\", "
            + "should be provided.");
    }

    // Namespace URI and local part specified
    int endOfNamespaceURI = qNameAsString.indexOf('}');
    if (endOfNamespaceURI == -1) {
        throw new IllegalArgumentException(
            "cannot create QName from \""
                + qNameAsString
                + "\", missing closing \"}\"");
    }
    return new QName(
        qNameAsString.substring(1, endOfNamespaceURI),
        qNameAsString.substring(endOfNamespaceURI + 1),
        XMLConstants.DEFAULT_NS_PREFIX);
}
 
Example 12
Source File: QName.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p><code>QName</code> constructor specifying the Namespace URI,
 * local part and prefix.</p>
 *
 * <p>If the Namespace URI is <code>null</code>, it is set to
 * {@link javax.xml.XMLConstants#NULL_NS_URI
 * XMLConstants.NULL_NS_URI}.  This value represents no
 * explicitly defined Namespace as defined by the <a
 * href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">Namespaces
 * in XML</a> specification.  This action preserves compatible
 * behavior with QName 1.0.  Explicitly providing the {@link
 * javax.xml.XMLConstants#NULL_NS_URI
 * XMLConstants.NULL_NS_URI} value is the preferred coding
 * style.</p>
 *
 * <p>If the local part is <code>null</code> an
 * <code>IllegalArgumentException</code> is thrown.
 * A local part of "" is allowed to preserve
 * compatible behavior with QName 1.0. </p>
 *
 * <p>If the prefix is <code>null</code>, an
 * <code>IllegalArgumentException</code> is thrown.  Use {@link
 * javax.xml.XMLConstants#DEFAULT_NS_PREFIX
 * XMLConstants.DEFAULT_NS_PREFIX} to explicitly indicate that no
 * prefix is present or the prefix is not relevant.</p>
 *
 * <p>The Namespace URI is not validated as a
 * <a href="http://www.ietf.org/rfc/rfc2396.txt">URI reference</a>.
 * The local part and prefix are not validated as a
 * <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>
 * as specified in <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces
 * in XML</a>.</p>
 *
 * @param namespaceURI Namespace URI of the <code>QName</code>
 * @param localPart    local part of the <code>QName</code>
 * @param prefix       prefix of the <code>QName</code>
 *
 * @throws IllegalArgumentException When <code>localPart</code>
 *   or <code>prefix</code> is <code>null</code>
 */
public QName(String namespaceURI, String localPart, String prefix) {

    // map null Namespace URI to default
    // to preserve compatibility with QName 1.0
    if (namespaceURI == null) {
        this.namespaceURI = XMLConstants.NULL_NS_URI;
    } else {
        this.namespaceURI = namespaceURI;
    }

    // local part is required.
    // "" is allowed to preserve compatibility with QName 1.0
    if (localPart == null) {
        throw new IllegalArgumentException(
                "local part cannot be \"null\" when creating a QName");
    }
    this.localPart = localPart;

    // prefix is required
    if (prefix == null) {
        throw new IllegalArgumentException(
                "prefix cannot be \"null\" when creating a QName");
    }
    this.prefix = prefix;
}
 
Example 13
Source File: SimplePortletPostProcessor.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public String getDefaultNamespace() {
	return XMLConstants.NULL_NS_URI;
}
 
Example 14
Source File: QName.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * <p><code>QName</code> constructor specifying the Namespace URI,
 * local part and prefix.</p>
 *
 * <p>If the Namespace URI is <code>null</code>, it is set to
 * {@link javax.xml.XMLConstants#NULL_NS_URI
 * XMLConstants.NULL_NS_URI}.  This value represents no
 * explicitly defined Namespace as defined by the <a
 * href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">Namespaces
 * in XML</a> specification.  This action preserves compatible
 * behavior with QName 1.0.  Explicitly providing the {@link
 * javax.xml.XMLConstants#NULL_NS_URI
 * XMLConstants.NULL_NS_URI} value is the preferred coding
 * style.</p>
 *
 * <p>If the local part is <code>null</code> an
 * <code>IllegalArgumentException</code> is thrown.
 * A local part of "" is allowed to preserve
 * compatible behavior with QName 1.0. </p>
 *
 * <p>If the prefix is <code>null</code>, an
 * <code>IllegalArgumentException</code> is thrown.  Use {@link
 * javax.xml.XMLConstants#DEFAULT_NS_PREFIX
 * XMLConstants.DEFAULT_NS_PREFIX} to explicitly indicate that no
 * prefix is present or the prefix is not relevant.</p>
 *
 * <p>The Namespace URI is not validated as a
 * <a href="http://www.ietf.org/rfc/rfc2396.txt">URI reference</a>.
 * The local part and prefix are not validated as a
 * <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>
 * as specified in <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces
 * in XML</a>.</p>
 *
 * @param namespaceURI Namespace URI of the <code>QName</code>
 * @param localPart    local part of the <code>QName</code>
 * @param prefix       prefix of the <code>QName</code>
 *
 * @throws IllegalArgumentException When <code>localPart</code>
 *   or <code>prefix</code> is <code>null</code>
 */
public QName(String namespaceURI, String localPart, String prefix) {

    // map null Namespace URI to default
    // to preserve compatibility with QName 1.0
    if (namespaceURI == null) {
        this.namespaceURI = XMLConstants.NULL_NS_URI;
    } else {
        this.namespaceURI = namespaceURI;
    }

    // local part is required.
    // "" is allowed to preserve compatibility with QName 1.0
    if (localPart == null) {
        throw new IllegalArgumentException(
                "local part cannot be \"null\" when creating a QName");
    }
    this.localPart = localPart;

    // prefix is required
    if (prefix == null) {
        throw new IllegalArgumentException(
                "prefix cannot be \"null\" when creating a QName");
    }
    this.prefix = prefix;
}
 
Example 15
Source File: QName.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * <p><code>QName</code> derived from parsing the formatted
 * <code>String</code>.</p>
 *
 * <p>If the <code>String</code> is <code>null</code> or does not conform to
 * {@link #toString() QName.toString()} formatting, an
 * <code>IllegalArgumentException</code> is thrown.</p>
 *
 * <p><em>The <code>String</code> <strong>MUST</strong> be in the
 * form returned by {@link #toString() QName.toString()}.</em></p>
 *
 * <p>The commonly accepted way of representing a <code>QName</code>
 * as a <code>String</code> was
 * <a href="http://jclark.com/xml/xmlns.htm">defined</a>
 * by James Clark.  Although this is not a <em>standard</em>
 * specification, it is in common use, e.g. {@link
 * javax.xml.transform.Transformer#setParameter(String name, Object value)}.
 * This implementation parses a <code>String</code> formatted
 * as: "{" + Namespace URI + "}" + local part.  If the Namespace
 * URI <code>.equals(XMLConstants.NULL_NS_URI)</code>, only the
 * local part should be provided.</p>
 *
 * <p>The prefix value <strong><em>CANNOT</em></strong> be
 * represented in the <code>String</code> and will be set to
 * {@link javax.xml.XMLConstants#DEFAULT_NS_PREFIX
 * XMLConstants.DEFAULT_NS_PREFIX}.</p>
 *
 * <p>This method does not do full validation of the resulting
 * <code>QName</code>.
 * <p>The Namespace URI is not validated as a
 * <a href="http://www.ietf.org/rfc/rfc2396.txt">URI reference</a>.
 * The local part is not validated as a
 * <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>
 * as specified in
 * <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</a>.</p>
 *
 * @param qNameAsString <code>String</code> representation
 * of the <code>QName</code>
 *
 * @throws IllegalArgumentException When <code>qNameAsString</code> is
 *   <code>null</code> or malformed
 *
 * @return <code>QName</code> corresponding to the given <code>String</code>
 * @see #toString() QName.toString()
 */
public static QName valueOf(String qNameAsString) {

    // null is not valid
    if (qNameAsString == null) {
        throw new IllegalArgumentException(
                "cannot create QName from \"null\" or \"\" String");
    }

    // "" local part is valid to preserve compatible behavior with QName 1.0
    if (qNameAsString.length() == 0) {
        return new QName(
            XMLConstants.NULL_NS_URI,
            qNameAsString,
            XMLConstants.DEFAULT_NS_PREFIX);
    }

    // local part only?
    if (qNameAsString.charAt(0) != '{') {
        return new QName(
            XMLConstants.NULL_NS_URI,
            qNameAsString,
            XMLConstants.DEFAULT_NS_PREFIX);
    }

    // Namespace URI improperly specified?
    if (qNameAsString.startsWith("{" + XMLConstants.NULL_NS_URI + "}")) {
        throw new IllegalArgumentException(
            "Namespace URI .equals(XMLConstants.NULL_NS_URI), "
            + ".equals(\"" + XMLConstants.NULL_NS_URI + "\"), "
            + "only the local part, "
            + "\""
            + qNameAsString.substring(2 + XMLConstants.NULL_NS_URI.length())
            + "\", "
            + "should be provided.");
    }

    // Namespace URI and local part specified
    int endOfNamespaceURI = qNameAsString.indexOf('}');
    if (endOfNamespaceURI == -1) {
        throw new IllegalArgumentException(
            "cannot create QName from \""
                + qNameAsString
                + "\", missing closing \"}\"");
    }
    return new QName(
        qNameAsString.substring(1, endOfNamespaceURI),
        qNameAsString.substring(endOfNamespaceURI + 1),
        XMLConstants.DEFAULT_NS_PREFIX);
}
 
Example 16
Source File: QName.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * <p><code>QName</code> derived from parsing the formatted
 * <code>String</code>.</p>
 *
 * <p>If the <code>String</code> is <code>null</code> or does not conform to
 * {@link #toString() QName.toString()} formatting, an
 * <code>IllegalArgumentException</code> is thrown.</p>
 *
 * <p><em>The <code>String</code> <strong>MUST</strong> be in the
 * form returned by {@link #toString() QName.toString()}.</em></p>
 *
 * <p>The commonly accepted way of representing a <code>QName</code>
 * as a <code>String</code> was
 * <a href="http://jclark.com/xml/xmlns.htm">defined</a>
 * by James Clark.  Although this is not a <em>standard</em>
 * specification, it is in common use, e.g. {@link
 * javax.xml.transform.Transformer#setParameter(String name, Object value)}.
 * This implementation parses a <code>String</code> formatted
 * as: "{" + Namespace URI + "}" + local part.  If the Namespace
 * URI <code>.equals(XMLConstants.NULL_NS_URI)</code>, only the
 * local part should be provided.</p>
 *
 * <p>The prefix value <strong><em>CANNOT</em></strong> be
 * represented in the <code>String</code> and will be set to
 * {@link javax.xml.XMLConstants#DEFAULT_NS_PREFIX
 * XMLConstants.DEFAULT_NS_PREFIX}.</p>
 *
 * <p>This method does not do full validation of the resulting
 * <code>QName</code>.
 * <p>The Namespace URI is not validated as a
 * <a href="http://www.ietf.org/rfc/rfc2396.txt">URI reference</a>.
 * The local part is not validated as a
 * <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>
 * as specified in
 * <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</a>.</p>
 *
 * @param qNameAsString <code>String</code> representation
 * of the <code>QName</code>
 *
 * @throws IllegalArgumentException When <code>qNameAsString</code> is
 *   <code>null</code> or malformed
 *
 * @return <code>QName</code> corresponding to the given <code>String</code>
 * @see #toString() QName.toString()
 */
public static QName valueOf(String qNameAsString) {

    // null is not valid
    if (qNameAsString == null) {
        throw new IllegalArgumentException(
                "cannot create QName from \"null\" or \"\" String");
    }

    // "" local part is valid to preserve compatible behavior with QName 1.0
    if (qNameAsString.length() == 0) {
        return new QName(
            XMLConstants.NULL_NS_URI,
            qNameAsString,
            XMLConstants.DEFAULT_NS_PREFIX);
    }

    // local part only?
    if (qNameAsString.charAt(0) != '{') {
        return new QName(
            XMLConstants.NULL_NS_URI,
            qNameAsString,
            XMLConstants.DEFAULT_NS_PREFIX);
    }

    // Namespace URI improperly specified?
    if (qNameAsString.startsWith("{" + XMLConstants.NULL_NS_URI + "}")) {
        throw new IllegalArgumentException(
            "Namespace URI .equals(XMLConstants.NULL_NS_URI), "
            + ".equals(\"" + XMLConstants.NULL_NS_URI + "\"), "
            + "only the local part, "
            + "\""
            + qNameAsString.substring(2 + XMLConstants.NULL_NS_URI.length())
            + "\", "
            + "should be provided.");
    }

    // Namespace URI and local part specified
    int endOfNamespaceURI = qNameAsString.indexOf('}');
    if (endOfNamespaceURI == -1) {
        throw new IllegalArgumentException(
            "cannot create QName from \""
                + qNameAsString
                + "\", missing closing \"}\"");
    }
    return new QName(
        qNameAsString.substring(1, endOfNamespaceURI),
        qNameAsString.substring(endOfNamespaceURI + 1),
        XMLConstants.DEFAULT_NS_PREFIX);
}
 
Example 17
Source File: QName.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p><code>QName</code> constructor specifying the local part.</p>
 *
 * <p>If the local part is <code>null</code> an
 * <code>IllegalArgumentException</code> is thrown.
 * A local part of "" is allowed to preserve
 * compatible behavior with QName 1.0. </p>
 *
 * <p>When using this constructor, the Namespace URI is set to
 * {@link javax.xml.XMLConstants#NULL_NS_URI
 * XMLConstants.NULL_NS_URI} and the prefix is set to {@link
 * javax.xml.XMLConstants#DEFAULT_NS_PREFIX
 * XMLConstants.DEFAULT_NS_PREFIX}.</p>
 *
 * <p><em>In an XML context, all Element and Attribute names exist
 * in the context of a Namespace.  Making this explicit during the
 * construction of a <code>QName</code> helps prevent hard to
 * diagnosis XML validity errors.  The constructors {@link
 * #QName(String namespaceURI, String localPart) QName(String
 * namespaceURI, String localPart)} and
 * {@link #QName(String namespaceURI, String localPart, String prefix)}
 * are preferred.</em></p>
 *
 * <p>The local part is not validated as a
 * <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>
 * as specified in <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces
 * in XML</a>.</p>
 *
 * @param localPart local part of the <code>QName</code>
 *
 * @throws IllegalArgumentException When <code>localPart</code> is
 *   <code>null</code>
 *
 * @see #QName(String namespaceURI, String localPart) QName(String
 * namespaceURI, String localPart)
 * @see #QName(String namespaceURI, String localPart, String
 * prefix) QName(String namespaceURI, String localPart, String
 * prefix)
 */
public QName(String localPart) {
    this(
        XMLConstants.NULL_NS_URI,
        localPart,
        XMLConstants.DEFAULT_NS_PREFIX);
}
 
Example 18
Source File: QName.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p><code>QName</code> constructor specifying the local part.</p>
 *
 * <p>If the local part is <code>null</code> an
 * <code>IllegalArgumentException</code> is thrown.
 * A local part of "" is allowed to preserve
 * compatible behavior with QName 1.0. </p>
 *
 * <p>When using this constructor, the Namespace URI is set to
 * {@link javax.xml.XMLConstants#NULL_NS_URI
 * XMLConstants.NULL_NS_URI} and the prefix is set to {@link
 * javax.xml.XMLConstants#DEFAULT_NS_PREFIX
 * XMLConstants.DEFAULT_NS_PREFIX}.</p>
 *
 * <p><em>In an XML context, all Element and Attribute names exist
 * in the context of a Namespace.  Making this explicit during the
 * construction of a <code>QName</code> helps prevent hard to
 * diagnosis XML validity errors.  The constructors {@link
 * #QName(String namespaceURI, String localPart) QName(String
 * namespaceURI, String localPart)} and
 * {@link #QName(String namespaceURI, String localPart, String prefix)}
 * are preferred.</em></p>
 *
 * <p>The local part is not validated as a
 * <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>
 * as specified in <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces
 * in XML</a>.</p>
 *
 * @param localPart local part of the <code>QName</code>
 *
 * @throws IllegalArgumentException When <code>localPart</code> is
 *   <code>null</code>
 *
 * @see #QName(String namespaceURI, String localPart) QName(String
 * namespaceURI, String localPart)
 * @see #QName(String namespaceURI, String localPart, String
 * prefix) QName(String namespaceURI, String localPart, String
 * prefix)
 */
public QName(String localPart) {
    this(
        XMLConstants.NULL_NS_URI,
        localPart,
        XMLConstants.DEFAULT_NS_PREFIX);
}
 
Example 19
Source File: QName.java    From j2objc with Apache License 2.0 3 votes vote down vote up
/**
 * <p><code>QName</code> constructor specifying the local part.</p>
 *
 * <p>If the local part is <code>null</code> an
 * <code>IllegalArgumentException</code> is thrown.
 * A local part of "" is allowed to preserve
 * compatible behavior with QName 1.0. </p>
 *
 * <p>When using this constructor, the Namespace URI is set to
 * {@link javax.xml.XMLConstants#NULL_NS_URI
 * XMLConstants.NULL_NS_URI} and the prefix is set to {@link
 * javax.xml.XMLConstants#DEFAULT_NS_PREFIX
 * XMLConstants.DEFAULT_NS_PREFIX}.</p>
 *
 * <p><em>In an XML context, all Element and Attribute names exist
 * in the context of a Namespace.  Making this explicit during the
 * construction of a <code>QName</code> helps prevent hard to
 * diagnosis XML validity errors.  The constructors {@link
 * #QName(String namespaceURI, String localPart) QName(String
 * namespaceURI, String localPart)} and
 * {@link #QName(String namespaceURI, String localPart, String prefix)}
 * are preferred.</em></p>
 *
 * <p>The local part is not validated as a
 * <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>
 * as specified in <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces
 * in XML</a>.</p>
 *
 * @param localPart local part of the <code>QName</code>
 * @see #QName(String namespaceURI, String localPart) QName(String
 * namespaceURI, String localPart)
 * @see #QName(String namespaceURI, String localPart, String
 * prefix) QName(String namespaceURI, String localPart, String
 * prefix)
 */
public QName(String localPart) {
    this(
        XMLConstants.NULL_NS_URI,
        localPart,
        XMLConstants.DEFAULT_NS_PREFIX);
}
 
Example 20
Source File: QName.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * <p><code>QName</code> constructor specifying the local part.</p>
 *
 * <p>If the local part is <code>null</code> an
 * <code>IllegalArgumentException</code> is thrown.
 * A local part of "" is allowed to preserve
 * compatible behavior with QName 1.0. </p>
 *
 * <p>When using this constructor, the Namespace URI is set to
 * {@link javax.xml.XMLConstants#NULL_NS_URI
 * XMLConstants.NULL_NS_URI} and the prefix is set to {@link
 * javax.xml.XMLConstants#DEFAULT_NS_PREFIX
 * XMLConstants.DEFAULT_NS_PREFIX}.</p>
 *
 * <p><em>In an XML context, all Element and Attribute names exist
 * in the context of a Namespace.  Making this explicit during the
 * construction of a <code>QName</code> helps prevent hard to
 * diagnosis XML validity errors.  The constructors {@link
 * #QName(String namespaceURI, String localPart) QName(String
 * namespaceURI, String localPart)} and
 * {@link #QName(String namespaceURI, String localPart, String prefix)}
 * are preferred.</em></p>
 *
 * <p>The local part is not validated as a
 * <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>
 * as specified in <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces
 * in XML</a>.</p>
 *
 * @param localPart local part of the <code>QName</code>
 *
 * @throws IllegalArgumentException When <code>localPart</code> is
 *   <code>null</code>
 *
 * @see #QName(String namespaceURI, String localPart) QName(String
 * namespaceURI, String localPart)
 * @see #QName(String namespaceURI, String localPart, String
 * prefix) QName(String namespaceURI, String localPart, String
 * prefix)
 */
public QName(String localPart) {
    this(
        XMLConstants.NULL_NS_URI,
        localPart,
        XMLConstants.DEFAULT_NS_PREFIX);
}