Open scpeters opened 1 year ago
I think Root::Element()
would work though and maybe ToElement
should check if the DOM object was loaded from XML (i.e, has a valid Element()
) and return that.
I think
Root::Element()
would work though and maybeToElement
should check if the DOM object was loaded from XML (i.e, has a validElement()
) and return that.
but if you make changes via the DOM API, will those be reflected in the Element()
output?
but if you make changes via the DOM API, will those be reflected in the Element() output?
They would not. I guess if we want that we'd have to store the custom elements and attributes somehow and incorporate them into the output of ToElement
. It wouldn't be trivial though since each element of the DOM object might have a custom attribute or custom element.
but if you make changes via the DOM API, will those be reflected in the Element() output?
They would not. I guess if we want that we'd have to store the custom elements and attributes somehow and incorporate them into the output of
ToElement
. It wouldn't be trivial though since each element of the DOM object might have a custom attribute or custom element.
One approach would be to add CustomData
class to the SDFormat c++ classes that stores a Param_V
of custom attributes and an ElementPtr_V
of custom child elements and populates it during parsing. Drawbacks:
//joint/axis/dynamics/*
and //joint/axis/limit
that are stored within sdf::JointAxis
Based on this portion of Plugin_TEST.cc, I believe that data from custom XML namespaces in the Plugin::Contents
(child elements of <plugin/>
) will be correctly exported by Plugin::ToElement
. Exporting custom attributes of <plugin/>
is not currently supported. In order to export custom attributes from a <plugin/>
element for use in gz-sim
, in addition to modifying the sdf::Plugin
constructor in sdf/Plugin.hh
, the corresponding gz/msgs/plugin.proto message file would need to be updated as well.
Environment
Description
sdf::Root
and then write it out again withRoot::ToElement()
, the resulting Element-tree should also have the custom data fields.Steps to reproduce
Output