ToString
doesn't skip default elements and attributes on sdf::ElementPtr
returned from ToElement
#867
Labels
ToString
doesn't skip default elements and attributes on sdf::ElementPtr
returned from ToElement
#867
Environment
sdf12
Description
When using
sdf::Element::ToString
, libsdformat currently checks to see if an element or attribute is set by the user and skips printing it if it's not. This helps avoid verbose SDFormat files with elements and attributes having default values. However, this behavior only works if thesdf::ElementPtr
was obtained from loading a file/string viasdf::readFile
/sdf::readString
or calling theElement
function on DOM objects (e.g.,sdf::Model::Element
). It does not work if thesdf::ElementPtr
is obtained form calling theToElement
function on DOM objects (e.g.,sdf::Model::ToElement
).Example:
Using
model->Element()->ToString("")
Using
model->ToElement()->ToString("")
Relates to : #575, #842
The text was updated successfully, but these errors were encountered: