Skip to contents

La variante de schéma (avec ou sans namespace) est choisie d'après le message lui-même.

Usage

hprim_validate(x, version = NULL)

Arguments

x

Message : chaîne XML, chemin de fichier, vecteur raw ou document xml2.

version

Version du schéma ; par défaut l'attribut version du message.

Value

Vecteur des erreurs, vide si le message est conforme. Si le XSD officiel de la version est lui-même invalide (cas du XSD PMSI 1.06), une erreur de classe hprim_schema_error est levée : la validation est impossible avec cette version.

Examples

f <- system.file("extdata", "pmsi_00001.xml", package = "hprimxml")
hprim_validate(f)
#> [1] "Element '{http://www.hprim.org/hprimXML}agent': Missing child element(s). Expected is ( {http://www.hprim.org/hprimXML}code )."                                                 
#> [2] "Element '{http://www.hprim.org/hprimXML}seance': '' is not a valid value of the atomic type '{http://www.hprim.org/hprimXML}seance'."                                           
#> [3] "Element '{http://www.hprim.org/hprimXML}radiotherapie', attribute 'nombreFaisceau': '' is not a valid value of the atomic type '{http://www.hprim.org/hprimXML}attrNbFaisceau'."
#> [4] "Element '{http://www.hprim.org/hprimXML}radiotherapie', attribute 'typeDosimetrie': [facet 'enumeration'] The value '' is not an element of the set {'1', '2', '3', '4'}."      
#> [5] "Element '{http://www.hprim.org/hprimXML}radiotherapie', attribute 'typeMachine': '' is not a valid value of the atomic type '{http://www.hprim.org/hprimXML}attrTypeMachine'."  
#> [6] "Element '{http://www.hprim.org/hprimXML}seance': '' is not a valid value of the atomic type '{http://www.hprim.org/hprimXML}seance'."                                           
#> [7] "Element '{http://www.hprim.org/hprimXML}radiotherapie', attribute 'nombreFaisceau': '' is not a valid value of the atomic type '{http://www.hprim.org/hprimXML}attrNbFaisceau'."
#> [8] "Element '{http://www.hprim.org/hprimXML}radiotherapie', attribute 'typeDosimetrie': [facet 'enumeration'] The value '' is not an element of the set {'1', '2', '3', '4'}."      
#> [9] "Element '{http://www.hprim.org/hprimXML}radiotherapie', attribute 'typeMachine': '' is not a valid value of the atomic type '{http://www.hprim.org/hprimXML}attrTypeMachine'."