[core] Add xml tree renderer#2216
Conversation
Fixes the tests
Generated by 🚫 Danger |
|
That would be an additional experimental API. In order to get feedback about possible use cases (which I don't know), we probably should add a short page in our documentation. For ease of use, we definitely need to provide the simple CLI as you suggested. For the XML format: Should we add at the toplevel element attributes like "exportedTimestamp", "pmdVersion", "language"? We could also simply add a xml comment with that information. This information might be helpful later on. |
|
I added a small API to describe tree renderers and register them. I imagine the designer can use this.
If this XML renderer is meant to be as close as possible as the representation we use for XPath then we should keep it free of that. It would be possible though to add another renderer that has this additional metadata. I imagine it could also add some nodes to the tree, eg types for java nodes, references to nodes, etc. This would be useful for testing. |
Refs #2215. This renderer matches our Node -> DOM mapping. The output is eg
Use it like
One problem is that it causes warnings for deprecated attributes...
The next step would be to build a small CLI program, eg something to use like
run.sh ast-dump --format xml --to-file out.xml --language java some/Class.javaThe designer could also use this API to have a GUI for those exports.