{"action":"opened","issue":{"url":"https://api.github.com/repos/NCEAS/mdqengine/issues/6","repository_url":"https://api.github.com/repos/NCEAS/mdqengine","labels_url":"https://api.github.com/repos/NCEAS/mdqengine/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/NCEAS/mdqengine/issues/6/comments","events_url":"https://api.github.com/repos/NCEAS/mdqengine/issues/6/events","html_url":"https://github.com/NCEAS/mdqengine/issues/6","id":164145875,"number":6,"title":"selectPath() doesn't use subSelector if result node list == 1","user":{"login":"gothub","id":6412946,"avatar_url":"https://avatars.githubusercontent.com/u/6412946?v=3","gravatar_id":"","url":"https://api.github.com/users/gothub","html_url":"https://github.com/gothub","followers_url":"https://api.github.com/users/gothub/followers","following_url":"https://api.github.com/users/gothub/following{/other_user}","gists_url":"https://api.github.com/users/gothub/gists{/gist_id}","starred_url":"https://api.github.com/users/gothub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gothub/subscriptions","organizations_url":"https://api.github.com/users/gothub/orgs","repos_url":"https://api.github.com/users/gothub/repos","events_url":"https://api.github.com/users/gothub/events{/privacy}","received_events_url":"https://api.github.com/users/gothub/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-06T18:42:52Z","updated_at":"2016-07-06T18:42:52Z","closed_at":null,"body":"The following selector works correctly for a metadata document that has > 1 dataTables (e.g. knb-lter-sbc-1001-7.xml) but does not work if the result of the 'main' selector == 1, i.e. for a metadata document has 1 dataTable (e.g. knb-lter-sbc.18.18.xml):\r\n\r\n```\r\n\t\t<selector>\r\n\t\t\t<name>attributeNames</name>\r\n\t\t\t<xpath>/eml/dataset/dataTable</xpath>\r\n\t\t\t<subSelector>\r\n\t\t\t\t<name>attributeNamesSubSelector</name>\r\n\t\t\t\t<xpath>./attributeList/attribute/attributeName</xpath>\r\n\t\t\t</subSelector>\r\n\t\t</selector>\r\n```\r\n\r\nIt looks like XMLDialect.selectPath() checks the number of nodes returned from the 'main' \r\nxpath and if that is 1 then the text value is returned and the subSelector is not considered.\r\nFor this example selector, this node is not a leaf node, but there is only one of them in the metadata document \"knb-lter-sbc.18.18.xml\", so maybe a better check for selectPath() to make is to see if a subSelector is defined, and apply that to the result from the 'main' selector, regardless of result count."}}
{"actor":{"display_login":"gothub"}}