From a491cd941493f498c320dc79f35d430e623710c8 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Tue, 7 Mar 2017 10:28:02 -0500 Subject: [PATCH] demonstrate difficulty validating DD 2.5 #3648 The DDI 2.5 test fails with this: `src-resolve: Cannot resolve the name 'xml:lang' to a(n) 'attribute declaration' component.` We should be exporting valid DDI 2.5. --- .../export/ddi/dataset-finch1-ddi-2.0.xml | 15 +++++++++++++++ .../iq/dataverse/util/xml/XmlValidatorTest.java | 14 +++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1-ddi-2.0.xml diff --git a/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1-ddi-2.0.xml b/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1-ddi-2.0.xml new file mode 100644 index 00000000000..6336bf0b0e5 --- /dev/null +++ b/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1-ddi-2.0.xml @@ -0,0 +1,15 @@ + + + + + + Darwin's Finches + 10.5072/FK2/PCA2E3 + + + Finch, Fiona + + Finch, Fiona, 2015, "Darwin's Finches", http://dx.doi.org/10.5072/FK2/PCA2E3, Root Dataverse, V1 + + + diff --git a/src/test/java/edu/harvard/iq/dataverse/util/xml/XmlValidatorTest.java b/src/test/java/edu/harvard/iq/dataverse/util/xml/XmlValidatorTest.java index 8919b580ecb..dcf6218d6e0 100644 --- a/src/test/java/edu/harvard/iq/dataverse/util/xml/XmlValidatorTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/util/xml/XmlValidatorTest.java @@ -13,9 +13,17 @@ public class XmlValidatorTest { @Test public void testValidateXml() throws IOException, SAXException { String dir = "src/test/java/edu/harvard/iq/dataverse/export/ddi/"; - //String codebookdir = "http://www.ddialliance.org/Specification/DDI-Codebook/2.5/XMLSchema/"; - // assertEquals(true, XmlValidator.validateXml(dir + "dataset-finch1.xml", dir + "codebook.xsd")); - // assertEquals(true, XmlValidator.validateXml(dir + "dataset-spruce1.xml", dir + "codebook.xsd")); + + System.out.println("Attempting to validate a DDI 2.0 file..."); + assertEquals(true, XmlValidator.validateXml(dir + "dataset-finch1-ddi-2.0.xml", dir + "Version2-0.xsd")); + + System.out.println("Attempting to validate a DDI 2.5 file..."); + // codebook.xsd comes from http://www.ddialliance.org/Specification/DDI-Codebook/2.5/XMLSchema/codebook.xsd + /** + * @todo Make the DDI 2.5 format we export pass validation. See + * https://github.com/IQSS/dataverse/issues/3648 + */ + assertEquals(true, XmlValidator.validateXml(dir + "dataset-finch1.xml", dir + "codebook.xsd")); } }