Design for xml writer #8872
Replies: 4 comments 7 replies
-
I'd prefer defaulting to being child nodes rather than attributes and liked the idea of using We should have the option of a "value column" as well. So you could have attributes and text as an output. What will we do if a column is invalid XML node name - normalise? |
Beta Was this translation helpful? Give feedback.
-
I'm not sure if this is right to control a warning through a parameter called |
Beta Was this translation helpful? Give feedback.
-
There are two behaviors here that are implicitly set by the values of
A column is included if it is explicitly mentioned, or if only one (but not both) of I worry that this might be tricky to understand. A simpler model might be: a column is only included if it is specified in one of the two column lists. Also, we default |
Beta Was this translation helpful? Give feedback.
-
Latest API design element_columns defaults to all columns as per @GregoryTravis's suggestion. I feel like there was feedback on what the parameter names should be, but I can't see it now. |
Beta Was this translation helpful? Give feedback.
-
Some initial design ideas for a simple XML writer.
These mock ups show a to_xml method on Table, but the same API could be applied to a file writer with some additional design.
to_xml takes 5 parameters (all optional)
In the default case where nothing is set we get an XML document where each row of data is an xml element called row and all columns become attributes.
If you specify a column to be an attribute, all unspecified columns become elements
Likewise if you specify a column to be an attribute, all unspecified columns become attributes
If you specify attributes and elements then you will only get those specified columns in the xml. Plus a warning that you have fields you are not using. (The warning can be hushed via the error_on_missing_columns parameter)
The root_element_name and row_element_name parameters allow customising of the respective element names
Beta Was this translation helpful? Give feedback.
All reactions