C# Class System.Xml.ValidateNames

Contains various static functions and methods for parsing and validating: NCName (not namespace-aware, no colons allowed) QName (prefix:local-name)
Afficher le fichier Open project: dotnet/corefx Class Usage Examples

Private Methods

Méthode Description
CreateName ( string prefix, string localName ) : string

Creates a colon-delimited qname from prefix and local name parts.

GetInvalidNameException ( string s, int offsetStartChar, int offsetBadChar ) : Exception
IsNameNoNamespaces ( string s ) : bool
IsNmtokenNoNamespaces ( string s ) : bool
IsReservedNamespace ( string s ) : bool

Returns true if "s" is a namespace that is reserved by Xml 1.0 or Namespace 1.0.

ParseNCName ( string s ) : int
ParseNCName ( string s, int offset ) : int
ParseNCNameInternal ( string s, bool throwOnError ) : bool

Calls parseName and returns false or throws exception if the resulting name is not a valid NCName. Returns the input string if there is no error.

ParseNCNameThrow ( string s ) : string

Calls parseName and throws exception if the resulting name is not a valid NCName. Returns the input string if there is no error.

ParseNameNoNamespaces ( string s, int offset ) : int
ParseNameTestThrow ( string s, string &prefix, string &localName ) : void

Parses the input string as a NameTest (see the XPath spec), returning the prefix and local name parts. Throws an exception if the given string is not a valid NameTest. If the NameTest contains a star, null values for localName (case NCName':*'), or for both localName and prefix (case '*') are returned.

ParseNmtoken ( string s, int offset ) : int

Attempts to parse the input string as an Nmtoken (see the XML spec production [7] && XML Namespaces spec). Quits parsing when an invalid Nmtoken char is reached or the end of string is reached. Returns the number of valid Nmtoken chars that were parsed.

ParseNmtokenNoNamespaces ( string s, int offset ) : int
ParseQName ( string s, int offset, int &colonOffset ) : int

Attempts to parse the input string as a QName (see the XML Namespace spec). Quits parsing when an invalid QName char is reached or the end of string is reached. Returns the number of valid QName chars that were parsed. Sets colonOffset to the offset of a colon character if it exists, or 0 otherwise.

ParseQNameThrow ( string s, string &prefix, string &localName ) : void

Calls parseQName and throws exception if the resulting name is not a valid QName. Returns the prefix and local name parts.

SplitQName ( string name, string &prefix, string &lname ) : void

Split a QualifiedName into prefix and localname, w/o any checking. (Used for XmlReader/XPathNavigator MoveTo(name) methods)

StartsWithXml ( string s ) : bool

Returns true if "prefix" starts with the characters 'x', 'm', 'l' (case-insensitive).

ThrowInvalidName ( string s, int offsetStartChar, int offsetBadChar ) : void

Throws an invalid name exception.

ValidateName ( string prefix, string localName, string ns, XPathNodeType nodeKind, Flags flags ) : bool

Return false if the specified name parts are not valid according to the rules of "nodeKind". Check only rules that are specified by the Flags. NOTE: Namespaces should be passed using a prefix, ns pair. "localName" is always string.Empty.

ValidateNameInternal ( string prefix, string localName, string ns, XPathNodeType nodeKind, Flags flags, bool throwOnError ) : bool

Return false or throw if the specified name parts are not valid according to the rules of "nodeKind". Check only rules that are specified by the Flags. NOTE: Namespaces should be passed using a prefix, ns pair. "localName" is always string.Empty.

ValidateNameThrow ( string prefix, string localName, string ns, XPathNodeType nodeKind, Flags flags ) : void

Throw if the specified name parts are not valid according to the rules of "nodeKind". Check only rules that are specified by the Flags. NOTE: Namespaces should be passed using a prefix, ns pair. "localName" is always string.Empty.