Revision 58494
Added by Argiro Kokogiannaki about 4 years ago
ExternalRecordParser.java | ||
---|---|---|
136 | 136 |
return result; |
137 | 137 |
} |
138 | 138 |
String orcidwork = orcidworkid.substring(20, orcidworkid.length()); |
139 |
|
|
139 |
System.out.println(); |
|
140 | 140 |
try { |
141 | 141 |
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); |
142 | 142 |
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); |
... | ... | |
147 | 147 |
|
148 | 148 |
NodeList nl; |
149 | 149 |
System.out.println(orcidwork); |
150 |
NodeList worknl = (NodeList) xpath.compile("//*[name()='work:work-summary'][@put-code='"+orcidwork+"']").evaluate(document,XPathConstants.NODESET);
|
|
150 |
NodeList worknl = (NodeList) xpath.compile("//*[name()='work:work'][@put-code='"+orcidwork+"']").evaluate(document,XPathConstants.NODESET); |
|
151 | 151 |
for( int n = 0; n<worknl.getLength(); n++){ |
152 |
String code = (String) xpath.compile("//*[name()='work:work-summary'][@put-code='"+orcidwork+"']/@put-code").evaluate(worknl.item(n), XPathConstants.STRING);
|
|
152 |
String code = (String) xpath.compile("//*[name()='work:work'][@put-code='"+orcidwork+"']/@put-code").evaluate(worknl.item(n), XPathConstants.STRING); |
|
153 | 153 |
result = new Result(); |
154 | 154 |
result.setResultType(ClaimUtils.PUBLICATION); |
155 |
nl = (NodeList) xpath.compile("//*[name()='work:work-summary'][@put-code='"+orcidwork+"']/*[name()='work:title']/*[name()='common:title']/text()").evaluate(worknl.item(n), XPathConstants.NODESET);
|
|
155 |
nl = (NodeList) xpath.compile("//*[name()='work:work'][@put-code='"+orcidwork+"']/*[name()='work:title']/*[name()='common:title']/text()").evaluate(worknl.item(n), XPathConstants.NODESET); |
|
156 | 156 |
if (nl.getLength() > 0) { |
157 | 157 |
result.setTitle(nl.item(0).getNodeValue()); |
158 | 158 |
} |
159 | 159 |
|
160 |
nl = (NodeList) xpath.compile("//*[name()='work:work-summary'][@put-code='"+orcidwork+"']//*[name()='common:external-id']").evaluate(worknl.item(n), XPathConstants.NODESET);
|
|
160 |
nl = (NodeList) xpath.compile("//*[name()='work:work'][@put-code='"+orcidwork+"']//*[name()='common:external-id']").evaluate(worknl.item(n), XPathConstants.NODESET); |
|
161 | 161 |
for (int i = 0; i < nl.getLength(); i++) { |
162 | 162 |
NodeList identifiersNl; |
163 | 163 |
String type=null; |
164 | 164 |
String id=null; |
165 |
identifiersNl = (NodeList) xpath.compile("//*[name()='work:work-summary'][@put-code='"+orcidwork+"']//*[name()='common:external-id-type']/text()").evaluate(nl.item(i), XPathConstants.NODESET);
|
|
165 |
identifiersNl = (NodeList) xpath.compile("//*[name()='work:work'][@put-code='"+orcidwork+"']//*[name()='common:external-id-type']/text()").evaluate(nl.item(i), XPathConstants.NODESET); |
|
166 | 166 |
if (identifiersNl.getLength() > 0) { |
167 | 167 |
type=identifiersNl.item(0).getNodeValue(); |
168 | 168 |
} |
169 |
identifiersNl = (NodeList) xpath.compile("//*[name()='work:work-summary'][@put-code='"+orcidwork+"']//*[name()='common:external-id-value']/text()").evaluate(nl.item(i), XPathConstants.NODESET);
|
|
169 |
identifiersNl = (NodeList) xpath.compile("//*[name()='work:work'][@put-code='"+orcidwork+"']//*[name()='common:external-id-value']/text()").evaluate(nl.item(i), XPathConstants.NODESET); |
|
170 | 170 |
if (identifiersNl.getLength() > 0) { |
171 | 171 |
id=identifiersNl.item(0).getNodeValue(); |
172 | 172 |
} |
... | ... | |
178 | 178 |
|
179 | 179 |
} |
180 | 180 |
if(result.getExternalUrl()==null) { |
181 |
nl = (NodeList) xpath.compile("//*[name()='work:work-summary'][@put-code='"+orcidwork+"']//*[name()='common:source']/*[name()='common:source-client-id']/*[name()='common:uri']/text()").evaluate(document, XPathConstants.NODESET);
|
|
181 |
nl = (NodeList) xpath.compile("//*[name()='work:work'][@put-code='"+orcidwork+"']//*[name()='common:source']/*[name()='common:source-client-id']/*[name()='common:uri']/text()").evaluate(document, XPathConstants.NODESET); |
|
182 | 182 |
if (nl.getLength() > 0) { |
183 | 183 |
result.setExternalUrl(nl.item(0).getNodeValue()); |
184 | 184 |
} |
... | ... | |
212 | 212 |
return result; |
213 | 213 |
} |
214 | 214 |
|
215 |
|
|
215 | 216 |
/** |
216 | 217 |
* |
217 | 218 |
* @param xml |
Also available in: Unified diff
Fix1: set type after parsing response from external sources - this fix puts the record in the proper file path
Fix2: Update orcid parser, use single orcid work response
update ExternalParserTest