Skip to content

Unable to parse xsd schemaΒ #33

@JasonDictos

Description

@JasonDictos

This schema can be parsed by libxml2's xmllint utility however using the browser demo shows some errors:

<?xml version="1.0" encoding="utf-8"?>
<!--
	Copyright (c) Nucleuz Inc.  All rights reserved.
	Schema to validate Nucleuz Policy XML files.
	Revision: 8838
	Set attribute xmlns="http://schemas.nucleuz.com/2013/dlp_policy" for non-namespaced references to
	assume the target namespace.
-->
<xs:schema
	id="NucleuzPolicySchema"
	version="8838"
	targetNamespace="http://schemas.nucleuz.com/2013/dlp_policy"
	xmlns:tns="http://schemas.nucleuz.com/2013/dlp_policy"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	elementFormDefault="qualified"
>
	<xs:element name="DlpPolicyTemplate" type="tns:DlpPolicyTemplateType"/>
	<xs:complexType name="DlpPolicyTemplateType">
		<xs:sequence>
			<xs:element ref="tns:Metadata"/>
			<xs:element ref="tns:Rules"/>
		</xs:sequence>
	</xs:complexType>
	<xs:element name="Metadata">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Name" type="tns:PolicyNameDescriptionType" maxOccurs="unbounded"/>
				<xs:element name="Description" type="tns:PolicyNameDescriptionType" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="Version" type="tns:PolicyVersionType" minOccurs="1" maxOccurs="1"/>
				<xs:element name="Publisher" type="tns:BasicStringContentType" minOccurs="0" maxOccurs="1"/>
			</xs:sequence>
			<xs:attribute name="id" type="xs:string" use="required"/>
			<xs:attribute name="formatVersion" type="xs:integer" use="required"/>
		</xs:complexType>
		<xs:key name="MetadataNameUniqueLangCode">
			<xs:selector xpath="tns:Name"/>
			<xs:field xpath="@langcode"/>
		</xs:key>
		<xs:key name="MetadataDescriptionUniqueLangCode">
			<xs:selector xpath="tns:Description"/>
			<xs:field xpath="@langcode"/>
		</xs:key>
	</xs:element>
	<xs:complexType name="PolicyNameDescriptionType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="default" type="xs:boolean" use="optional" default="false"/>
				<xs:attribute name="langcode" type="xs:language" use="required"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="PolicyVersionType">
		<xs:attribute name="major" type="xs:unsignedShort" use="required"/>
		<xs:attribute name="minor" type="xs:unsignedShort" use="required"/>
		<xs:attribute name="build" type="xs:unsignedShort" use="required"/>
		<xs:attribute name="revision" type="xs:unsignedShort" use="required"/>
	</xs:complexType>
	<xs:complexType name="BasicStringContentType">
		<xs:simpleContent>
			<xs:extension base="xs:string"/>
		</xs:simpleContent>
	</xs:complexType>
	<xs:element name="Rules">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Rule" type="tns:RuleType" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
		<xs:key name="UniqueRuleId">
			<xs:selector xpath="tns:Rule"/>
			<xs:field xpath="@id"/>
		</xs:key>
	</xs:element>
	<xs:complexType name="RuleType">
		<xs:sequence>
			<xs:element name="FormatVersion" type="tns:FormatVersionType"/>
		</xs:sequence>
		<xs:attribute name="id" type="xs:string" use="required"/>
	</xs:complexType>
	<xs:complexType name="FormatVersionType">
		<xs:sequence>
			<xs:element name="Condition" type="tns:SingleChildContainerType"/>
			<xs:element ref="tns:Actions"/>
		</xs:sequence>
		<xs:attribute name="version" type="xs:unsignedShort" use="required"/>
	</xs:complexType>
	<xs:complexType name="SingleChildContainerType">
		<xs:choice minOccurs="1" maxOccurs="1">
			<xs:element name="And" type="tns:MultipleChildContainerType"/>
			<xs:element ref="tns:Or"/>
			<xs:element name="Not" type="tns:SingleChildContainerType"/>
			<xs:element ref="tns:ClassificationRule"/>
			<xs:element ref="tns:Date"/>
			<xs:element ref="tns:DateTime"/>
			<xs:element ref="tns:Number"/>
			<xs:element ref="tns:Recipient"/>
			<xs:element ref="tns:Sender"/>
			<xs:element ref="tns:String"/>
			<xs:element ref="tns:Time"/>
		</xs:choice>
	</xs:complexType>
	<xs:complexType name="MultipleChildContainerType">
		<xs:choice minOccurs="1" maxOccurs="unbounded">
			<xs:element name="And" type="tns:MultipleChildContainerType"/>
			<xs:element ref="tns:Or"/>
			<xs:element name="Not" type="tns:SingleChildContainerType"/>
			<xs:element ref="tns:ClassificationRule"/>
			<xs:element ref="tns:Date"/>
			<xs:element ref="tns:DateTime"/>
			<xs:element ref="tns:Number"/>
			<xs:element ref="tns:Recipient"/>
			<xs:element ref="tns:Sender"/>
			<xs:element ref="tns:String"/>
			<xs:element ref="tns:Time"/>
		</xs:choice>
	</xs:complexType>
	<xs:element name="Or">
		<xs:complexType>
			<xs:complexContent>
				<xs:extension base="tns:MultipleChildContainerType">
					<xs:attribute name="earlyOut" type="xs:boolean" use="optional" default="false"/>
					<xs:attribute name="min" type="xs:nonNegativeInteger" use="optional" default="1"/>
				</xs:extension>
			</xs:complexContent>
		</xs:complexType>
	</xs:element>
	<xs:element name="ClassificationRule">
		<xs:complexType>
			<xs:attribute name="idRef" type="xs:string" use="required"/>
			<xs:attribute name="minCount" type="xs:nonNegativeInteger" use="optional" default="1" />
			<xs:attribute name="maxCount" type="xs:nonNegativeInteger" use="optional"/>
			<xs:attribute name="minUniqueCount" type="xs:nonNegativeInteger" use="optional" default="1"/>
			<xs:attribute name="maxUniqueCount" type="xs:nonNegativeInteger" use="optional"/>
			<xs:attribute name="minConfidence" type="tns:ProbabilityType" use="optional"/>
			<xs:attribute name="maxConfidence" type="tns:ProbabilityType" use="optional"/>
			<xs:attribute name="patternMode" type="tns:PatternModeType" use="optional" default="all"/>
			<xs:attribute name="target" type="xs:string" use="optional" default="{{DATA BUFFER}}"/>
		</xs:complexType>
	</xs:element>
	<xs:simpleType name="ProbabilityType">
		<xs:restriction base="xs:nonNegativeInteger">
			<xs:minInclusive value="1"/>
			<xs:maxInclusive value="100"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="PatternModeType">
		<xs:restriction base="xs:string">
			<xs:enumeration value="all" />
			<xs:enumeration value="withinConfidenceRange" />
		</xs:restriction>
	</xs:simpleType>
	<xs:element name="Date">
		<xs:complexType>
			<xs:attribute name="elementRef" type="xs:string" use="required"/>
			<xs:attribute name="min" type="xs:date" use="optional" default="1970-01-01" />
			<xs:attribute name="max" type="xs:date" use="optional" default="9999-12-31" />
		</xs:complexType>
		<!-- Ideally validate min or max (or both) attribute(s) specified.  Code does it anyway. -->
	</xs:element>
	<xs:element name="DateTime">
		<xs:complexType>
			<xs:attribute name="elementRef" type="xs:string" use="required"/>
			<xs:attribute name="min" type="xs:dateTime" use="optional" default="1970-01-01T00:00:00" />
			<xs:attribute name="max" type="xs:dateTime" use="optional" default="9999-12-31T24:00:00" />
		</xs:complexType>
		<!-- Ideally validate min or max (or both) attribute(s) specified.  Code does it anyway. -->
	</xs:element>
	<xs:element name="Number">
		<xs:complexType>
			<xs:attribute name="elementRef" type="xs:string" use="required"/>
			<xs:attribute name="min" type="xs:long" use="optional" default="-9223372036854775808" />
			<xs:attribute name="max" type="xs:long" use="optional" default="9223372036854775807" />
		</xs:complexType>
		<!-- Ideally validate min or max (or both) attribute(s) specified.  Code does it anyway. -->
	</xs:element>
	<xs:element name="Recipient">
		<xs:complexType>
			<xs:attribute name="address" type="xs:string" use="optional" />
			<xs:attribute name="domain" type="xs:string" use="optional" />
		</xs:complexType>
		<!-- Validate either address or domain attribute(s) specified (but not both). -->
		<xs:key name="RecipientAttributeAddressOrDomainPresent">
			<xs:selector xpath="." />
			<xs:field xpath="@address | @domain" />
		</xs:key>
	</xs:element>
	<xs:element name="Sender">
		<xs:complexType>
			<xs:attribute name="address" type="xs:string" use="required" />
		</xs:complexType>
	</xs:element>
	<xs:element name="String">
		<xs:complexType mixed="true">
			<xs:attribute name="elementRef" type="xs:string" use="required" />
			<xs:attribute name="matchStyle" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="BeginsWith" />
						<xs:enumeration value="Contains" />
						<xs:enumeration value="EndsWith" />
						<xs:enumeration value="Full" />
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="caseSensitive" type="xs:boolean" use="optional" default="false"/>
		</xs:complexType>
	</xs:element>
	<xs:element name="Time">
		<xs:complexType>
			<xs:attribute name="elementRef" type="xs:string" use="required"/>
			<xs:attribute name="min" type="xs:time" use="optional" default="00:00:00.000000+14:00" />
			<xs:attribute name="max" type="xs:time" use="optional" default="24:00:00.000000-12:00" />
		</xs:complexType>
		<!-- Ideally validate min or max (or both) attribute(s) specified.  Code does it anyway. -->
	</xs:element>
	<xs:element name="Actions">
		<!-- Content of Actions element can be almost anything. -->
		<xs:complexType mixed="true">
			<xs:sequence>
				<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

Errors:

file.xsd:164: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': '1970-12-31T24:00:00' is not a valid value of the atomic type 'xs:dateTime'.
file.xsd:164: element attribute: Schemas parser error : attribute decl. 'max': The value of the value constraint is not valid.
file.xsd:211: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': '00:00:00.000000+14:00' is not a valid value of the atomic type 'xs:time'.
file.xsd:211: element attribute: Schemas parser error : attribute decl. 'min': The value of the value constraint is not valid.
file.xsd:212: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': '24:00:00.000000-12:00' is not a valid value of the atomic type 'xs:time'.
file.xsd:212: element attribute: Schemas parser error : attribute decl. 'max': The value of the value constraint is not valid.
WXS schema file.xsd failed to compile
file.xml:1: parser error : String not started expecting ' or "
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<DlpPolicyTemplat
              ^
file.xml:1: parser error : Malformed declaration expecting version
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<DlpPolicyTemplat
              ^
file.xml:1: parser error : Blank needed here
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<DlpPolicyTemplat
              ^
file.xml:1: parser error : parsing XML declaration: '?>' expected
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<DlpPolicyTemplat
              ^
file.xml:1: parser error : Start tag expected, '<' not found
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<DlpPolicyTemplat
                                                           ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions