Skip to main content

Definition

Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.Xml

Syntax

Summary

Provides the namespace declarations of well-known XML formats, each as the prefixes the format is customarily written with and the namespace URIs they are bound to.

Usage

KnownNamespaces holds the namespace declarations of well-known XML formats, each as the prefixes the format is customarily written with and the namespace URIs they’re bound to. Assign one to XmlSerializerOptions.Namespaces, and the serializer declares every namespace of the set on the document element and writes each element and attribute in one of them with the set’s prefix. In the sample, PodcastShow is written as rss, and its Author property is an element in the iTunes namespace:
View the complete sample on GitHub What to know:
  • Every declaration of the set is written, whether or not the document uses it. The sample uses only itunes.
  • A set holds the namespaces a format adds to its own. A format whose own elements have no namespace, such as RSS, or are customarily in the default namespace, such as a sitemap, isn’t in its set.
  • The sets are read-only, and their declarations are in alphabetical order of prefix.
  • The prefixes matter only when the serializer writes. When it reads, it compares namespace URIs, so a document that uses other prefixes reads the same.
  • To use the prefixes of a particular document instead, pass it to XmlDocument.DiscoverNamespaces and assign the result to XmlSerializerOptions.Namespaces.
For the other ways to choose prefixes, see Use XML namespaces.

Remarks

Assign one of these to XmlSerializerOptions.Namespaces to have the serializer declare the namespaces on the document element and write the customary prefixes. Every declaration of a set is written, whether or not the document uses it. The sets are read-only, and their declarations are in alphabetical order of prefix. A set holds the namespaces a format adds to its own. A format whose own elements have no namespace, such as RSS, or are customarily written in the default namespace, such as a sitemap, is not in its set. To use the prefixes of a particular document instead, see XmlDocument.DiscoverNamespaces.

Examples

Properties

Edmx

Gets the namespace of an OData version 4 metadata document (CSDL in XML), which is customarily written with the edmx prefix.

Syntax

Property Value

Type: System.Collections.Generic.IReadOnlyDictionary<string, string> edmx. The Entity Data Model namespace of the Schema element is not in the set: it is customarily the default namespace of that element.

Podcast

Gets the namespaces of a podcast feed: the iTunes and Podcasting 2.0 extensions to RSS, and the modules that podcast hosts add.

Syntax

Property Value

Type: System.Collections.Generic.IReadOnlyDictionary<string, string> atom, content, dc, googleplay, itunes, media, podcast (Podcasting 2.0, the Podcast Index namespace), psc (Podlove Simple Chapters) and sy.

Rss

Gets the namespaces of the modules that RSS 2.0 feeds commonly use.

Syntax

Property Value

Type: System.Collections.Generic.IReadOnlyDictionary<string, string> atom, content, dc, georss, media, slash, sy and wfw.

Sitemap

Gets the namespaces of the extensions to a sitemap.

Syntax

Property Value

Type: System.Collections.Generic.IReadOnlyDictionary<string, string> image, news, video and xhtml.

Soap11

Gets the namespaces of a SOAP 1.1 message.

Syntax

Property Value

Type: System.Collections.Generic.IReadOnlyDictionary<string, string> soap, xsd and xsi.

Remarks

The soap prefix is the one .NET and most toolkits write. The specification’s own examples use SOAP-ENV.

Soap12

Gets the namespaces of a SOAP 1.2 message.

Syntax

Property Value

Type: System.Collections.Generic.IReadOnlyDictionary<string, string> soap, xsd and xsi.

Remarks

The soap prefix is the one .NET and most toolkits write. The specification’s own examples use env.

Svg

Gets the namespaces of an SVG picture.

Syntax

Property Value

Type: System.Collections.Generic.IReadOnlyDictionary<string, string> svg and xlink.

XmlSchema

Gets the namespaces of XML Schema: the schema language, and the attributes an instance document takes from it.

Syntax

Property Value

Type: System.Collections.Generic.IReadOnlyDictionary<string, string> xsd and xsi.
  • CloudNimble.Text.Xml.XmlSerializerOptions
  • CloudNimble.Text.Xml.XmlNamespaces
  • CloudNimble.Text.Xml.XmlDocument