Share via


QName.ValueOf(String) Method

Definition

QName derived from parsing the formatted String.

[Android.Runtime.Register("valueOf", "(Ljava/lang/String;)Ljavax/xml/namespace/QName;", "")]
public static Javax.Xml.Namespace.QName? ValueOf (string? qNameAsString);
[<Android.Runtime.Register("valueOf", "(Ljava/lang/String;)Ljavax/xml/namespace/QName;", "")>]
static member ValueOf : string -> Javax.Xml.Namespace.QName

Parameters

qNameAsString
String

String representation of the QName

Returns

QName corresponding to the given String

Attributes

Remarks

QName derived from parsing the formatted String.

If the String is null or does not conform to #toString() QName.toString() formatting, an IllegalArgumentException is thrown.

<em>The String<strong>MUST</strong> be in the form returned by #toString() QName.toString().</em>

The commonly accepted way of representing a QName as a String was defined by James Clark. Although this is not a <em>standard</em> specification, it is in common use, e.g. javax.xml.transform.Transformer#setParameter(String name, Object value). This implementation parses a String formatted as: "{" + Namespace URI + "}" + local part. If the Namespace URI .equals(XMLConstants.NULL_NS_URI), only the local part should be provided.

The prefix value <strong><em>CANNOT</em></strong> be represented in the String and will be set to javax.xml.XMLConstants#DEFAULT_NS_PREFIX XMLConstants.DEFAULT_NS_PREFIX.

This method does not do full validation of the resulting QName.

The Namespace URI is not validated as a URI reference. The local part is not validated as a NCName as specified in Namespaces in XML.

Java documentation for javax.xml.namespace.QName.valueOf(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to