Class XmlSpecsHelper
Static Helper Class which contains a set of Functions which model Name and Character validations as laid out in the W3C XML and XML Namespaces specification.
Inherited Members
Namespace: VDS.RDF.Parsing
Assembly: dotNetRdf.dll
Syntax
public static class XmlSpecsHelper
Remarks
These are needed in the XML/RDF Parser
Also contains the Date Time format string used to format .Net's DateTime type into a String whose format conforms to the XML Schema Datatypes specification.
Fields
| Edit this page View SourceNamespaceXml
Namespace for XML.
Declaration
public const string NamespaceXml = "http://www.w3.org/XML/1998/namespace"
Field Value
| Type | Description |
|---|---|
| string |
NamespaceXmlNamespaces
Namespace for XML Namespaces.
Declaration
public const string NamespaceXmlNamespaces = "http://www.w3.org/2000/xmlns/"
Field Value
| Type | Description |
|---|---|
| string |
NamespaceXmlSchema
Namespace for XML Schema.
Declaration
public const string NamespaceXmlSchema = "http://www.w3.org/2001/XMLSchema#"
Field Value
| Type | Description |
|---|---|
| string |
SupportedTypes
Array of Constants for Data Types that are supported by the Literal Node CompareTo method.
Declaration
public static string[] SupportedTypes
Field Value
| Type | Description |
|---|---|
| string[] |
XmlSchemaDataTypeAnyUri
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeAnyUri = "http://www.w3.org/2001/XMLSchema#anyURI"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeBase64Binary
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeBase64Binary = "http://www.w3.org/2001/XMLSchema#base64Binary"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeBoolean
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeBoolean = "http://www.w3.org/2001/XMLSchema#boolean"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeByte
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeByte = "http://www.w3.org/2001/XMLSchema#byte"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeDate
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeDate = "http://www.w3.org/2001/XMLSchema#date"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeDateTime
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeDateTime = "http://www.w3.org/2001/XMLSchema#dateTime"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeDayTimeDuration
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeDayTimeDuration = "http://www.w3.org/2001/XMLSchema#dayTimeDuration"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeDecimal
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeDecimal = "http://www.w3.org/2001/XMLSchema#decimal"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeDouble
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeDouble = "http://www.w3.org/2001/XMLSchema#double"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeDuration
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeDuration = "http://www.w3.org/2001/XMLSchema#duration"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeFloat
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeFloat = "http://www.w3.org/2001/XMLSchema#float"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeHexBinary
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeHexBinary = "http://www.w3.org/2001/XMLSchema#hexBinary"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeInt
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeInt = "http://www.w3.org/2001/XMLSchema#int"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeInteger
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeInteger = "http://www.w3.org/2001/XMLSchema#integer"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeLong
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeLong = "http://www.w3.org/2001/XMLSchema#long"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeNegativeInteger
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeNegativeInteger = "http://www.w3.org/2001/XMLSchema#negativeInteger"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeNonNegativeInteger
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeNonNegativeInteger = "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeNonPositiveInteger
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeNonPositiveInteger = "http://www.w3.org/2001/XMLSchema#nonPositiveInteger"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypePositiveInteger
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypePositiveInteger = "http://www.w3.org/2001/XMLSchema#positiveInteger"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeShort
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeShort = "http://www.w3.org/2001/XMLSchema#short"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeString
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeString = "http://www.w3.org/2001/XMLSchema#string"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeTime
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeTime = "http://www.w3.org/2001/XMLSchema#time"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeUnsignedByte
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeUnsignedByte = "http://www.w3.org/2001/XMLSchema#unsignedByte"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeUnsignedInt
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeUnsignedInt = "http://www.w3.org/2001/XMLSchema#unsignedInt"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeUnsignedLong
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeUnsignedLong = "http://www.w3.org/2001/XMLSchema#unsignedLong"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeUnsignedShort
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeUnsignedShort = "http://www.w3.org/2001/XMLSchema#unsignedShort"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeYear
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeYear = "http://www.w3.org/2001/XMLSchema#gYear"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDataTypeYearMonth
Data Type Uri Constants for XML Schema Data Types.
Declaration
public const string XmlSchemaDataTypeYearMonth = "http://www.w3.org/2001/XMLSchema#gYearMonth"
Field Value
| Type | Description |
|---|---|
| string |
XmlSchemaDateFormat
Date Time Formatting string which meets the specified format for xsd:date.
Declaration
public const string XmlSchemaDateFormat = "yyyy-MM-ddK"
Field Value
| Type | Description |
|---|---|
| string |
Remarks
Use with the DateTime.ToString() method to format a DateTime into appropriate string format.
XmlSchemaDateRegex
A permissive regular expression that matches the structure of xsd:date.
Declaration
public static Regex XmlSchemaDateRegex
Field Value
| Type | Description |
|---|---|
| Regex |
Remarks
This regular expression does not catch out-of-range errors on any of the date components.
XmlSchemaDateTimeFormat
Date Time Formatting string which meets the specified format for xsd:dateTime.
Declaration
public const string XmlSchemaDateTimeFormat = "yyyy-MM-dd\\THH:mm:ss.ffffffK"
Field Value
| Type | Description |
|---|---|
| string |
Remarks
Use with the DateTime.ToString() method to format a DateTime into appropriate string format.
XmlSchemaDateTimeFormatImprecise
Date Time Formatting string which meets the specified format for xsd:dateTime, this formatting string is imprecise in the sense that it does not preserve the fractional seconds.
Declaration
public const string XmlSchemaDateTimeFormatImprecise = "yyyy-MM-dd\\THH:mm:ssK"
Field Value
| Type | Description |
|---|---|
| string |
Remarks
Use with the DateTime.ToString() method to format a DateTime into appropriate string format.
XmlSchemaDateTimeRegex
A permissive regular expression that matches the structure of xsd:dateTime.
Declaration
public static Regex XmlSchemaDateTimeRegex
Field Value
| Type | Description |
|---|---|
| Regex |
Remarks
This regular expression does not catch out-of-range errors on any of the date or time components.
XmlSchemaDurationRegex
A permissive regular expression that matches the structure of the lexical space for an XML Schema Duration.
Declaration
public static Regex XmlSchemaDurationRegex
Field Value
| Type | Description |
|---|---|
| Regex |
Remarks
This regular expression will match certain invalid constructs, in particular a duration with a T followed by no time components.
XmlSchemaTimeFormat
Date Time Formatting string which meets the the specified format for xsd:time.
Declaration
public const string XmlSchemaTimeFormat = "HH:mm:ss.ffffffK"
Field Value
| Type | Description |
|---|---|
| string |
Remarks
Use with the DateTime.ToString() method to format a DateTime into appropriate string format.
XmlSchemaTimeFormatImprecise
Date Time Formatting string which meets the the specified format for xsd:time, this formatting string is imprecise in the sense that it does not preserve the fractional seconds.
Declaration
public const string XmlSchemaTimeFormatImprecise = "HH:mm:ssK"
Field Value
| Type | Description |
|---|---|
| string |
Remarks
Use with the DateTime.ToString() method to format a DateTime into appropriate string format.
XmlSchemaTimeRegex
A permissive regular expression that matches the structure of xsd:time.
Declaration
public static Regex XmlSchemaTimeRegex
Field Value
| Type | Description |
|---|---|
| Regex |
Remarks
This regular expression does not catch out-of-range errors on any of the time components.
XmlSchemaYearMonthRegex
A permissive regular expression that matches the structure of xsd:gMonthYear.
Declaration
public static Regex XmlSchemaYearMonthRegex
Field Value
| Type | Description |
|---|---|
| Regex |
XmlSchemaYearRegex
A permissive regular expression that matches the structure of xsd:gYear.
Declaration
public static Regex XmlSchemaYearRegex
Field Value
| Type | Description |
|---|---|
| Regex |
Methods
| Edit this page View SourceGetCompatibleSupportedDataType(string, string)
Gets the Compatible Supported Data Type for the two Data Types.
Declaration
public static string GetCompatibleSupportedDataType(string type1, string type2)
Parameters
| Type | Name | Description |
|---|---|---|
| string | type1 | A Data Type. |
| string | type2 | A Data Type. |
Returns
| Type | Description |
|---|---|
| string |
Remarks
Currently this is only immplemented sufficiently for the types it needs to know are compatible for implementing SPARQL equality and ordering semantics.
GetCompatibleSupportedDataType(string, string, bool)
Gets the Compatible Supported Data Type for the two Data Types.
Declaration
public static string GetCompatibleSupportedDataType(string type1, string type2, bool widen)
Parameters
| Type | Name | Description |
|---|---|---|
| string | type1 | A Data Type. |
| string | type2 | A Data Type. |
| bool | widen | Whether the compatible type should be the wider type. |
Returns
| Type | Description |
|---|---|
| string |
Remarks
Currently this is only immplemented sufficiently for the types it needs to know are compatible for implementing SPARQL equality and ordering semantics.
GetCompatibleSupportedDataType(INode, INode)
Gets the Compatible Supported Data Type assuming the two Nodes are Literals with support types and that those types are compatible.
Declaration
public static string GetCompatibleSupportedDataType(INode x, INode y)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | x | A Node. |
| INode | y | A Node. |
Returns
| Type | Description |
|---|---|
| string |
Remarks
Currently this is only immplemented sufficiently for the types it needs to know are compatible for implementing SPARQL equality and ordering semantics.
GetCompatibleSupportedDataType(INode, INode, bool)
Gets the Compatible Supported Data Type assuming the two Nodes are Literals with support types and that those types are compatible.
Declaration
public static string GetCompatibleSupportedDataType(INode x, INode y, bool widen)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | x | A Node. |
| INode | y | A Node. |
| bool | widen | Whether the compatible type should be the wider type. |
Returns
| Type | Description |
|---|---|
| string |
Remarks
Currently this is only immplemented sufficiently for the types it needs to know are compatible for implementing SPARQL equality and ordering semantics.
GetSupportedDataType(INode)
Gets the Data Type Uri of the given Node if it has a supported type.
Declaration
public static string GetSupportedDataType(INode n)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | n | Node. |
Returns
| Type | Description |
|---|---|
| string |
Remarks
Only ILiteralNode's can have a Data Type.
The function only returns the Data Type Uri (as a String) if the Data Type of the Literal is one of the supported Data Types.
IsNCName(string)
Returns whether a String is a NCName as defined by the W3C XML Namespaces Specification.
Declaration
public static bool IsNCName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | String to test. |
Returns
| Type | Description |
|---|---|
| bool |
IsName(string)
Returns whether a String is a Name as defined by the W3C XML Specification.
Declaration
public static bool IsName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | String to test. |
Returns
| Type | Description |
|---|---|
| bool |
IsNameChar(char)
Returns whether a Character is a NameChar as defined by the W3C XML Specification.
Declaration
public static bool IsNameChar(char c)
Parameters
| Type | Name | Description |
|---|---|---|
| char | c | Character to Test. |
Returns
| Type | Description |
|---|---|
| bool |
IsNameStartChar(char)
Returns whether a Character is a NameChar as defined by the W3C XML Specification.
Declaration
public static bool IsNameStartChar(char c)
Parameters
| Type | Name | Description |
|---|---|---|
| char | c | Character to test. |
Returns
| Type | Description |
|---|---|
| bool |
IsSupportedType(string)
Returns whether the given Type refers to one of the types supported by the LiteralNode CompareTo method.
Declaration
public static bool IsSupportedType(string type)
Parameters
| Type | Name | Description |
|---|---|---|
| string | type | Data Type Uri. |
Returns
| Type | Description |
|---|---|
| bool |
IsSupportedType(Uri)
Returns whether the given Type refers to one of the types supported by the LiteralNode CompareTo method.
Declaration
public static bool IsSupportedType(Uri type)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | type | Data Type Uri. |
Returns
| Type | Description |
|---|---|
| bool |
TryGetCompatibleSupportedDataType(string, string, bool, out string)
Attempts to get the compatible datatype for the two specified data types.
Declaration
public static bool TryGetCompatibleSupportedDataType(string type1, string type2, bool widen, out string compatibleDataType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | type1 | A data type IRI string. |
| string | type2 | A data type IRI string. |
| bool | widen | Whether the compatible data type should be the wider type. |
| string | compatibleDataType | Receives the IRI of the compatible data type, if any. |
Returns
| Type | Description |
|---|---|
| bool | True if a compatible datatype could be found for the two data types, false otherwise. |
TryGetCompatibleSupportedDataType(string, string, out string)
Attempts to get the compatible datatype for the two specified data types.
Declaration
public static bool TryGetCompatibleSupportedDataType(string type1, string type2, out string compatibleDataType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | type1 | A data type IRI string. |
| string | type2 | A data type IRI string. |
| string | compatibleDataType | Receives the IRI of the compatible data type, if any. |
Returns
| Type | Description |
|---|---|
| bool | True if a compatible datatype could be found for the two data types, false otherwise. |