From 41e00bcd0707f45092cfe80186294f36560f4508 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Mon, 13 Mar 2023 15:19:49 +0100 Subject: [PATCH] [graph provision] avoid to parse again the XML records, apparently the escaped XML characters get unescaped invalidating the record --- .../eu/dnetlib/dhp/oa/provision/utils/XmlRecordFactory.java | 3 ++- .../eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java | 5 ++++- .../resources/eu/dnetlib/dhp/oa/provision/publication.json | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/XmlRecordFactory.java b/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/XmlRecordFactory.java index 45ba840c9..a34db67db 100644 --- a/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/XmlRecordFactory.java +++ b/dhp-workflows/dhp-graph-provision/src/main/java/eu/dnetlib/dhp/oa/provision/utils/XmlRecordFactory.java @@ -122,7 +122,8 @@ public class XmlRecordFactory implements Serializable { .buildBody( mainType, metadata, relations, listChildren(entity, je, templateFactory), listExtraInfo(entity)); - return printXML(templateFactory.buildRecord(entity, schemaLocation, body), indent); + return templateFactory.buildRecord(entity, schemaLocation, body); + // return printXML(templateFactory.buildRecord(entity, schemaLocation, body), indent); } catch (final Throwable e) { throw new RuntimeException(String.format("error building record '%s'", entity.getId()), e); } diff --git a/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java b/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java index 77d1f9fdb..4d93138f4 100644 --- a/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java +++ b/dhp-workflows/dhp-graph-provision/src/test/java/eu/dnetlib/dhp/oa/provision/XmlRecordFactoryTest.java @@ -47,13 +47,16 @@ public class XmlRecordFactoryTest { final String xml = xmlRecordFactory.build(new JoinedEntity<>(p)); + System.out.println(xml); + assertNotNull(xml); final Document doc = new SAXReader().read(new StringReader(xml)); + doc.normalize(); assertNotNull(doc); - System.out.println(doc.asXML()); + //System.out.println(doc.asXML()); assertEquals("0000-0001-9613-6638", doc.valueOf("//creator[@rank = '1']/@orcid")); assertEquals("0000-0001-9613-6639", doc.valueOf("//creator[@rank = '1']/@orcid_pending")); diff --git a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/publication.json b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/publication.json index 5e3f19bd7..901e6d579 100644 --- a/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/publication.json +++ b/dhp-workflows/dhp-graph-provision/src/test/resources/eu/dnetlib/dhp/oa/provision/publication.json @@ -621,7 +621,7 @@ "trust": "" }, "key": "10|CSC_________::a2b9ce8435390bcbfc05f3cae3948747", - "value": "VIRTA" + "value": "Bulletin of the National Technical University \"KhPI\" A series of \"Information and Modeling\"" }, "instancetype": { "classid": "0001", @@ -1488,7 +1488,7 @@ "issnLinking": "", "issnOnline": "", "issnPrinted": "0018-9383", - "name": "IEEE Transactions on Electron Devices", + "name": "IEEE Transactions on \"Electron Devices\"", "sp": "3884", "vol": "65" }, @@ -1557,7 +1557,7 @@ "schemeid": "dnet:result_typologies", "schemename": "dnet:result_typologies" }, - "source": [], + "source": [ { "value" : "Bulletin of the National Technical University \"KhPI\" A series of \"Information and Modeling\"; № 1 (3) (2020):" } ], "subject": [ { "dataInfo": {