Definition
Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.XmlSyntax
Summary
Provides the well-known XML namespace URIs that XmlEssentials uses. This class cannot be inherited.Usage
XmlNamespaces holds the namespace URIs that XML itself and the serializer define. Use the constants when you compare a namespace with the reader, so that the URI text isn’t repeated in your code.
The following code finds an
xsi:nil attribute by its local name and namespace. The prefix in the document doesn’t matter.
xsi:nil is true. It is part of the namespaces sample. For namespaces with the serializer, see Use XML namespaces.
Remarks
Thexml and xmlns prefixes are bound to XmlNamespaces.Xml and XmlNamespaces.Xmlns
for the whole of every document. Do not bind them to another namespace.
Best Practices
- Compare by URI, never by prefix. A document can bind
http://www.w3.org/2001/XMLSchema-instanceto any prefix, andxsiis only the conventional one. - Use
XmlNamespaces.Xsitogether withXmlAttributes.NilorXmlAttributes.Typewhen you look forxsi:nilorxsi:type. An attribute with no prefix is never in a namespace, so an unprefixednilattribute is notxsi:nil.
Considerations
- The
xmlandxmlnsprefixes are bound for the whole of every document. The reader rejects a document that bindsxmlto another namespace, declares thexmlnsprefix, or binds either of the two reserved namespaces to another prefix. Refsis specific to XmlEssentials. Another XML library treats theidandrefattributes in that namespace as ordinary attributes.- The members are constants, so their values are compiled into your assembly.
Related APIs
- CloudNimble.Text.Xml.XmlAttributes
- CloudNimble.Text.Xml.XmlName
- CloudNimble.Text.Xml.Utf8XmlReader
- CloudNimble.Text.Xml.Utf8XmlWriter
- CloudNimble.Text.Xml.Serialization.XmlReferenceHandler