[graph provision] avoid to parse again the XML records, apparently the escaped XML characters get unescaped invalidating the record

This commit is contained in:
Claudio Atzori 2023-03-13 15:19:49 +01:00
parent 46d2df1c90
commit 41e00bcd07
3 changed files with 9 additions and 5 deletions

View File

@ -122,7 +122,8 @@ public class XmlRecordFactory implements Serializable {
.buildBody( .buildBody(
mainType, metadata, relations, listChildren(entity, je, templateFactory), listExtraInfo(entity)); 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) { } catch (final Throwable e) {
throw new RuntimeException(String.format("error building record '%s'", entity.getId()), e); throw new RuntimeException(String.format("error building record '%s'", entity.getId()), e);
} }

View File

@ -47,13 +47,16 @@ public class XmlRecordFactoryTest {
final String xml = xmlRecordFactory.build(new JoinedEntity<>(p)); final String xml = xmlRecordFactory.build(new JoinedEntity<>(p));
System.out.println(xml);
assertNotNull(xml); assertNotNull(xml);
final Document doc = new SAXReader().read(new StringReader(xml)); final Document doc = new SAXReader().read(new StringReader(xml));
doc.normalize();
assertNotNull(doc); 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-6638", doc.valueOf("//creator[@rank = '1']/@orcid"));
assertEquals("0000-0001-9613-6639", doc.valueOf("//creator[@rank = '1']/@orcid_pending")); assertEquals("0000-0001-9613-6639", doc.valueOf("//creator[@rank = '1']/@orcid_pending"));

View File

@ -621,7 +621,7 @@
"trust": "" "trust": ""
}, },
"key": "10|CSC_________::a2b9ce8435390bcbfc05f3cae3948747", "key": "10|CSC_________::a2b9ce8435390bcbfc05f3cae3948747",
"value": "VIRTA" "value": "Bulletin of the National Technical University \"KhPI\" A series of \"Information and Modeling\""
}, },
"instancetype": { "instancetype": {
"classid": "0001", "classid": "0001",
@ -1488,7 +1488,7 @@
"issnLinking": "", "issnLinking": "",
"issnOnline": "", "issnOnline": "",
"issnPrinted": "0018-9383", "issnPrinted": "0018-9383",
"name": "IEEE Transactions on Electron Devices", "name": "IEEE Transactions on \"Electron Devices\"",
"sp": "3884", "sp": "3884",
"vol": "65" "vol": "65"
}, },
@ -1557,7 +1557,7 @@
"schemeid": "dnet:result_typologies", "schemeid": "dnet:result_typologies",
"schemename": "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": [ "subject": [
{ {
"dataInfo": { "dataInfo": {