xml/schema/lib/types/windows.xsd

67 lines
2.3 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:include schemaLocation="./std.xsd"/>
<!-- ABSOLUTE directory path -->
<!-- Getting this regex right for Windows is a nightmare. This is just intended to check in a very basic manner. -->
<xs:simpleType name="t_windows_dirpath">
<xs:restriction base="xs:string">
<xs:pattern value="\s*(~|[A-Za-z]+:)(\\[^\\]*)+\\?\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<!-- RELATIVE directory path -->
<!-- Don't trust this. XML patterns don't support lookahead/lookbehind, so we can't negate a char sequence. -->
<xs:simpleType name="t_windows_reldirpath">
<xs:restriction base="xs:string">
<xs:pattern value="\s*[^\\](([^\\]*)+\\?)+\s*"/>
</xs:restriction>
</xs:simpleType>
<!-- ABSOLUTE file path -->
<xs:simpleType name="t_windows_filepath">
<xs:restriction base="xs:string">
<xs:pattern value="\s*(~|[A-Za-z]+:)?(\\[^\\]+)+\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<!-- RELATIVE file path -->
<xs:simpleType name="t_windows_relfilepath">
<xs:restriction base="xs:string">
<xs:pattern value="\s*([^\\]+)(\\[^\\]+)*([^\\])*\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<!-- ABSOLUTE path (file or directory) -->
<xs:simpleType name="t_windows_path">
<xs:union memberTypes="t_windows_dirpath t_windows_filepath"/>
</xs:simpleType>
<!-- RELATIVE path (file or directory) -->
<xs:simpleType name="t_windows_relpath">
<xs:union memberTypes="t_windows_reldirpath t_windows_relfilepath"/>
</xs:simpleType>
<!-- ANY valid value for the above types. -->
<xs:simpleType name="t_windows_anypath">
<xs:union memberTypes="t_windows_path t_windows_relpath"/>
</xs:simpleType>
<!-- RELATIVE or ABSOLUTE file path -->
<xs:simpleType name="t_windows_anyfile">
<xs:union memberTypes="t_windows_filepath t_windows_relfilepath"/>
</xs:simpleType>
<!-- RELATIVE or ABSOLUTE dir path -->
<xs:simpleType name="t_windows_anydir">
<xs:union memberTypes="t_windows_dirpath t_windows_reldirpath"/>
</xs:simpleType>
</xs:schema>