What Is PSVI in XML Schema Validation?
The Post-Schema-Validation Infoset (PSVI) is an augmented version of the standard XML Information Set (Infoset) that is generated after an XML document undergoes validation against an XML Schema (XSD). While a standard XML Infoset only contains the raw structural data of an XML document—such as element names, attribute values, and hierarchical relationships—the PSVI enriches this data by attaching schema-derived metadata, including data types, validation states, and default values.
Core Components of the PSVI
During the validation process, an XML Schema processor evaluates the document and adds validation-specific properties to the existing information items. The resulting PSVI contains several key additions:
- Type Annotations: Elements and attributes are
associated with their specific schema-defined data types (e.g.,
xs:integer,xs:dateTime, or user-defined complex types) rather than just being treated as generic text strings. - Validity Assessment: The processor tags items with validation outcomes, categorizing them as valid, invalid, or notKnown (if validation was skipped or could not be determined).
- Default and Fixed Values: If an element or attribute has a default or fixed value declared in the schema and is omitted in the XML instance, the PSVI supplies this value to the application.
- Normalized Values: Schema validation applies
whitespace facet rules (such as
preserve,replace, orcollapse), providing normalized scalar values alongside the original lexical representations. - Schema Error Indicators: For invalid components, the PSVI provides references to the specific constraints and schema components that failed validation.
The Role of PSVI in XML Processing
The PSVI serves as a bridge between structural XML markup and strongly typed application environments. Its primary use cases include:
- Schema-Aware Querying and Transformation: Technologies like XPath 2.0+, XQuery, and XSLT 2.0+ rely on PSVI type annotations to perform operations based on data types—such as sorting dates chronologically or computing arithmetic sums directly on element values without manual casting.
- Data Binding: Frameworks that map XML to
object-oriented programming structures (such as JAXB in Java or
System.Xml.Serializationin .NET) use PSVI data to instantiate strongly typed classes and properties directly from XML nodes. - Application Logic and Integration: Downstream systems can inspect the PSVI to verify that data meets specific business rules before processing, ensuring that only fully validated, typed data is accepted.
Nature and Access of the PSVI
The PSVI is a conceptual data model rather than a distinct physical file format. Although there are standardized ways to serialize it (such as using specialized XML vocabularies), the PSVI typically exists in-memory during processing. XML parsers and processors expose PSVI properties through dedicated application programming interfaces (APIs), allowing developers to inspect validation results and type definitions programmatically.