Documentation ¶
Overview ¶
Package xsd contains some of the tools available from libxml2 that allows you to validate your XML against an XSD
This is basically all you need to do:
schema, err := xsd.Parse(xsdsrc) if err != nil { panic(err) } defer schema.Free() if err := schema.Validate(doc); err != nil{ for _, e := range err.(SchemaValidationErr).Error() { println(e.Error()) } }
Index ¶
Constants ¶
const ValueVCCreate = 1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema represents an XML schema.
func Parse ¶
Parse is used to parse an XML Schema Document to produce a Schema instance. Make sure to call Free() on the instance when you are done with it.
func ParseFromFile ¶
ParseFromFile is used to parse an XML schema using only the file path. Make sure to call Free() on the instance when you are done with it.
type SchemaValidationError ¶
type SchemaValidationError struct {
// contains filtered or unexported fields
}
SchemaValidationError is returned when the Validate() function finds errors. When there are multiple errors, you may access them using the Errors() method
func (SchemaValidationError) Error ¶
func (sve SchemaValidationError) Error() string
Error method fulfils the error interface
func (SchemaValidationError) Errors ¶
func (sve SchemaValidationError) Errors() []error
Errors returns the list of errors found