Validating PXML
PndTools validates PXML against the official OpenPandora XSD schema and a set of additional rules that the schema cannot express, such as locale requirements and FreeDesktop.org category/subcategory pairings. Both layers run in a single Validate call.
PxmlValidator implements IPxmlValidator — use it directly, or inject it via DI in ASP.NET Core projects (see ASP.NET Core integration).
Validate a PXML string
Section titled “Validate a PXML string”using PndTools.Validation;
var xmlString = File.ReadAllText("/tmp/PXML.xml");var validator = new PxmlValidator();var result = validator.Validate(xmlString);
if (!result.IsValid){ foreach (var error in result.Errors) { Console.WriteLine(error); }}ValidationResult
Section titled “ValidationResult”ValidationResult exposes two members:
IsValid—truewhen there are no errorsErrors— a read-only list of error message strings