using a schema with import fails inside devtools::test

Aperta
#344 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
r
Ambito
testing-qa

Direzione di ricerca

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().

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)

Lingua principale
R
Stelle
227
Fork
86
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di r-lib/xml2

Tutte le issue di r-lib/xml2

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.