Chiranga Alwis
Chiranga Alwis

Reputation: 1111

XML Schema data type for file path

I am relatively new to work related to XML Schema and have been trying to figure out which XML Schema datatype I should use for a file path. Is it string or anyURI which is most accurate in this case?

Upvotes: 7

Views: 4369

Answers (1)

kjhughes
kjhughes

Reputation: 111630

I'd recommend xsd:anyURI

[Definition:] anyURI represents a Uniform Resource Identifier Reference (URI). An anyURI value can be absolute or relative, and may have an optional fragment identifier (i.e., it may be a URI Reference). This type should be used to specify the intention that the value fulfills the role of a URI as defined by [RFC 2396], as amended by [RFC 2732].

with no scheme component for relative paths or a file scheme component for absolute paths.

Examples:

  • ../path/to/filename.txt
  • file:///c:/path/to/filename.txt

Upvotes: 9

Related Questions