Uses a Document Type Definition (DTD) or XML Schema to validate an XML text document or an XML document object.

XmlValidate( xmlDoc [, validator ] )

Returns: Struct

Argument Description
string, required

The XML to validate

string, optional

Any of the following:

  • A string containing a DTD or Schema.
  • The name of a DTD or Schema file.
  • The URL of a DTD or Schema file; valid protocol identifiers include http, https, ftp, and file.


validator = "
			<?xml version=""1.0""?>
			<xs:schema xmlns:xs=""http://www.w3.org/2001/XMLSchema"">
			<xs:element name=""note"">
						<xs:element name=""to"" type=""xs:string""/>
						<xs:element name=""from"" type=""xs:string""/>
						<xs:element name=""heading"" type=""xs:string""/>
						<xs:element name=""body"" type=""xs:string""/>
		xml_stream = "
			<?xml version=""1.0"" encoding=""UTF-8""?>
				<body>Here is the message you requested.</body>
		xml_document = XmlParse(xml_stream);
		dump(xmlValidate(xml_document, validator));

See also