Open dedickinson opened 11 years ago
I was testing an alert and changed the fix a little further:
try:
text = node.getTextTrim()
except:
try:
text = node.getValue().strip()
except:
text = node
It appears that an XPath node returns a UniCode string - the XML mapping I was using was: "concat(my:CreatorFamily,',', my:CreatorGiven)": "dc:creator.foaf:Person.0.foaf:name",
Please refer to https://groups.google.com/d/topic/redbox-dev/Z8fz8bEH5aA/discussion
(Sue @ UTas) But I tried those two ways, both are not working for my mapping. I have error as below in my main.log I can't see what is the problem. Could you please help?
2013-01-24 04:34:01,041 DEBUG namicPageServiceImpl Checking xpath: '/rif:registryObjects/rif:registryObject/rif:collection/@type' for use with field '["type","dc:type.rdf:PlainLiteral","dc:type.skos:prefLabel","redbox:submissionProcess.dc:type"]' 2013-01-24 04:34:01,042 DEBUG namicPageServiceImpl Using default namespace {"rif":"http:\/\/ands.org.au\/standards\/rif-cs\/registryObjects"} 2013-01-24 04:34:01,043 DEBUG namicPageServiceImpl Number of nodes found: 1
2013-01-24 04:34:01,044 WARN namicPageServiceImpl Failed to run script!
Traceback (most recent call last): File "default/redbox/scripts/hkjobs/alerts.py", line 48, in activate File "default/redbox/scripts/hkjobs/alerts.py", line 48, in activate File "default/redbox/scripts/hkjobs/alerts.py", line 79, in _AlertsDataprocessDir File "default/redbox/scripts/hkjobs/alerts.py", line 115, in _AlertsData__processXML File "default/redbox/scripts/hkjobs/alerts.py", line 115, in _AlertsDataprocessXML File "default/redbox/scripts/hkjobs/alerts.py", line 238, in _AlertsDataxmlToJson File "default/redbox/scripts/hkjobs/alerts.py", line 278, in _AlertsData__mapXpathToFields File "default/redbox/scripts/hkjobs/alerts.py", line 310, in _AlertsDatainsertFieldData AttributeError: 'org.dom4j.tree.DefaultAttribute' object has no attribute 'getTextTrim'
(Nigel @ JCU) I had the same issue. I changed the the code in file src/main/config/portal/default/redbox/scripts/hkjobs/alerts.py at line 308, from:
to