{"action":"created","issue":{"url":"https://api.github.com/repos/ropensci/RNeXML/issues/125","labels_url":"https://api.github.com/repos/ropensci/RNeXML/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/ropensci/RNeXML/issues/125/comments","events_url":"https://api.github.com/repos/ropensci/RNeXML/issues/125/events","html_url":"https://github.com/ropensci/RNeXML/issues/125","id":107816824,"number":125,"title":"get_characters() not detecting the matrix in nexml file","user":{"login":"xu-hong","id":1892444,"avatar_url":"https://avatars.githubusercontent.com/u/1892444?v=3","gravatar_id":"","url":"https://api.github.com/users/xu-hong","html_url":"https://github.com/xu-hong","followers_url":"https://api.github.com/users/xu-hong/followers","following_url":"https://api.github.com/users/xu-hong/following{/other_user}","gists_url":"https://api.github.com/users/xu-hong/gists{/gist_id}","starred_url":"https://api.github.com/users/xu-hong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xu-hong/subscriptions","organizations_url":"https://api.github.com/users/xu-hong/orgs","repos_url":"https://api.github.com/users/xu-hong/repos","events_url":"https://api.github.com/users/xu-hong/events{/privacy}","received_events_url":"https://api.github.com/users/xu-hong/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ropensci/RNeXML/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-09-22T22:40:27Z","updated_at":"2015-09-24T14:00:01Z","closed_at":null,"body":"I tried the following code to parse the nexml (stored as [test.xml](https://raw.githubusercontent.com/xu-hong/rphenoscape/master/inst/examples/test.xml)) returned by the [OntoTrace API] (http://docs.phenoscapekb.apiary.io/#reference/ontotrace/ontotrace/generate-matrix-of-inferred-presence/absence-associations-for-anatomical-structures-subsumed-by-the-provided-entity-class-expression,-for-any-taxa-within-the-provided-taxon-class-expression?console=1) provided by Phenoscape Knowledgebase:\r\n```r\r\nnex <- nexml_read(\"https://raw.githubusercontent.com/xu-hong/rphenoscape/master/inst/examples/test.xml\")\r\nget_characters(nex)\r\n```\r\nBut I was getting ```NULL``` as the matrix returned by ```get_characters(nex)```. The nexml file seems valid with matrix exists in it, but somehow the function was not able to correctly parse it. "},"comment":{"url":"https://api.github.com/repos/ropensci/RNeXML/issues/comments/142936676","html_url":"https://github.com/ropensci/RNeXML/issues/125#issuecomment-142936676","issue_url":"https://api.github.com/repos/ropensci/RNeXML/issues/125","id":142936676,"user":{"login":"cboettig","id":222586,"avatar_url":"https://avatars.githubusercontent.com/u/222586?v=3","gravatar_id":"","url":"https://api.github.com/users/cboettig","html_url":"https://github.com/cboettig","followers_url":"https://api.github.com/users/cboettig/followers","following_url":"https://api.github.com/users/cboettig/following{/other_user}","gists_url":"https://api.github.com/users/cboettig/gists{/gist_id}","starred_url":"https://api.github.com/users/cboettig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cboettig/subscriptions","organizations_url":"https://api.github.com/users/cboettig/orgs","repos_url":"https://api.github.com/users/cboettig/repos","events_url":"https://api.github.com/users/cboettig/events{/privacy}","received_events_url":"https://api.github.com/users/cboettig/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T14:00:01Z","updated_at":"2015-09-24T14:00:01Z","body":"Thanks Rutger!\r\n\r\n> What @hlapp suggests is basically precomputing this approach during an initial traversal so that in pre-order you read/update the mapping for 'foo' as you move towards the tips and then replace 'foo:bar' with '{ http://example.org}:bar' as you encounter it. When you look at how XML editing / processing tools internally represent namespaced elements and attributes, that's basically what they do (including the curly braces, even).\r\n\r\nRight, but I guess what I'm not clear on here is how we are supposed to handle the case where no namespace is applied, and thus there is no `:` to split upon (or otherwise the `:` is not related to a namespace).  e.g. one can have:\r\n\r\n```\r\n<characters xsi:type=\"ns:StandardCells\" ...\r\n```\r\ninstead of the more explicit:\r\n\r\n```\r\n<ns:characters xsi:type=\"ns:StandardCells\" ..\r\n```\r\n\r\nSo if we are playing by the rules of inheritance in xml, shouldn't it also be valid to have:\r\n\r\n```\r\n<characters xsi:type=\"StandardCells\" ..\r\n```\r\n\r\nWhere the `ns` is assumed for both?  Or do we always namespace attribute values?  If we can omit them, I'm not sure how to do the preprocessing, since I don't think we'd want to expand all attribute values to the default, since some of these are explicitly not namespaced, e.g. lengths, or `symbol=1` shouldn't become `symbol=http://www.nexml.org/2009:1` right?  Happy to fix this but I just haven't figured out the implementation in my head because of these details.  \r\n\r\n> That's probably going to work for 99% of all cases, at least until someone else comes up with the same name in a different namespace\r\n\r\nRight. And Scott's implementation is specific to the `xsi:type` value of the `<characters>` element, so it would have to be a namespace that defined valid for that specific location, and not just any namespace, right?  I get the value of namespaces in general but in this specific context it really feels like it is going to be much safer to treat the value of an attribute as a string. \r\n\r\nAs you commented in #51, it sounds like this case might be trouble for other NeXML parsers as well, which might hardwire a particular prefix rather than attempt to namespace the attribute values.\r\n\r\nI've merged Scott's fix to master, so feel free to close if the current fix seems to address the issue.  "}}