xmerl_xsd
Description
Interface module for XML Schema validation. It handles the W3.org specifications of XML Schema second edition 28 october 2004. For an introduction to XML Schema study part 0. An XML structure is validated by xmerl_xsd:validate/[2,3]. -------------------------------------------------------------------
DATA TYPES
- filename() = string()
- global_state() = #xsd_state{}
- option_list() = [{xsdbase, filename()} | {atom(), term()}]
Equivalent to process_schema(Schema, []).
Types
Equivalent to process_schema(Schemas, []).
Types
Equivalent to process_validate(Schema, Xml, []).
Types
Validates a parsed well-formed XML element towards an XML schema.
Validates in two steps. First it processes the schema, saves the type and structure info in an ets table and then validates the element towards the schema.
Usage example:
1>{E,_} = xmerl_scan:file("my_XML_document.xml").
2>{E2,_} = xmerl_xsd:validate("my_XML_Schema.xsd",E).
Observe that E2 may differ from E if for instance there are default values defined in my_XML_Schema.xsd.
Equivalent to validate(Element, State, []).
Types
Validates a parsed well-formed XML element (Element).
A call to validate/2 or validate/3 must provide a well formed parsed XML element #xmlElement{} and a State, global_state(), which holds necessary information from an already processed schema. Thus validate enables reuse of the schema information and therefore if one shall validate several times towards the same schema it reduces time consumption.
The result, ValidElement, is the valid element that conforms to the post-schema-validation infoset. When the validator finds an error it tries to continue and reports a list of all errors found. In those cases an unexpected error is found it may cause a single error reason.
Usage example:
1>{E,_} = xmerl_scan:file("my_XML_document.xml").
2>{ok,S} = xmerl_xsd:process_schema("my_XML_Schema.xsd").
3>{E2,_} = xmerl_xsd:validate(E,S).
Observe that E2 may differ from E if for instance there are default values defined in my_XML_Schema.xsd.