Visit attributes and immediate child elements in document order.
- Returns
- False if a boolean visitor stops traversal; true otherwise.
Definition at line 73 of file XmlReader.hpp.
74{
76 for (
size_t index =
m_row + 1; index < end; index +=
m_forest->subtree_size(index)) {
78 if (!source)
79 continue;
80
81 const auto kind =
source->text(
"kind");
82 if (!kind || (*kind != "attribute" && *kind != "element"))
83 continue;
84
85 const auto field_name =
source->text(
"name");
86 if (!field_name)
87 continue;
88
89 const XmlFieldView field {
91 .name = *field_name,
92 .value =
source->text(
"value").value_or(std::string_view {}),
93 .
row =
static_cast<uint64_t
>(index),
94 .element = *kind == "element"
96 : std::nullopt,
97 };
98 if constexpr (std::same_as<std::invoke_result_t<Fn&, const XmlFieldView&>, bool>) {
99 if (!std::invoke(visitor, field))
100 return false;
101 } else {
102 std::invoke(visitor, field);
103 }
104 }
105 return true;
106}
const Kakshya::CompositeArray * m_rows
XmlElementView(const Kakshya::CompositeArray &rows, const Kakshya::ForestIndex &forest, size_t row) noexcept
uint64_t row() const noexcept
const Kakshya::ForestIndex * m_forest
References MayaFlux::IO::Attribute, MayaFlux::IO::Element, m_forest, m_row, m_rows, row(), and XmlElementView().
Referenced by MayaFlux::IO::XmlRecordAccess< XmlElementView >::for_each_attribute(), MayaFlux::IO::XmlRecordAccess< XmlElementView >::for_each_child(), MayaFlux::IO::overlay_xml_attributes(), and MayaFlux::IO::overlay_xml_element().