using a schema with import fails inside devtools::test

Abierto
#344 6 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
r
Área
testing-qa

Línea de trabajo

Start with the reproduction package at github.com/shug0131/eudraCT/tree/master/R/eudract and compare validation under devtools::test() with validation after devtools::load_all(). Check how the schema import in inst/extdata/RRSUploadSchema.xsd is resolved in each context. Done means the imported schema is found and validation succeeds when run through devtools::test().

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

reprex

I have a function in a package I'm building that calls xml2::validate(). This works ok called from console.

But inside devtools::test , it comes back with errors starting

Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location '/me-filer1/groups3$/CCTU/STATISTICS/NON%20STUDY%20FOLDER/Academic%20Research/Eudract%20Tool/R/eudract/inst/extdata/RRSUploadSchema.xsd'. Skipping the import

I think the line in the schema itself is:

<xs:import 
     namespace="http://clinicaltrials.gov/rrs"
     schemaLocation="RRSUploadSchema.xsd"
  />

which is available here (https://prsinfo.clinicaltrials.gov/RRSUploadSchema.xsd)

So it seems to trying to find the other file locally . Weirdly I do have a copy of the imported schema exactly where it is looking, but that doesn't help at all...

If I do devtools::load_all(), and run the line of code again in teh console rather than devtools::test(),. it works fine.

The full error message is:

Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location '/me-filer1/groups3$/CCTU/STATISTICS/NON%20STUDY%20FOLDER/Academic%20Research/Eudract%20Tool/R/eudract/inst/extdata/RRSUploadSchema.xsd'. Skipping the import.Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://clinicaltrials.gov/rrs}result' does not resolve to a(n) element declaration.Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://clinicaltrials.gov/rrs}resultDisposition' does not resolve to a(n) element declaration.Element '{http://clinicaltrials.gov/prs}study_collection': No matching global declaration available for the validation root.
In addition: Warning message:
In xml_validate.xml_document(original, schema_output) :
  failed to load external entity "/me-filer1/groups3$/CCTU/STATISTICS/NON%20STUDY%20FOLDER/Academic%20Research/Eudract%20Tool/R/eudract/inst/extdata/RRSUploadSchema.xsd" [1549]

To reproduce see package at (https://github.com/shug0131/eudraCT/tree/master/R/eudract)

Lenguaje dominante
R
Estrellas
227
Forks
86
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de r-lib/xml2

Todos los issues de r-lib/xml2

Issues similares

Más issues de R

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.