17 : myRegistry_(myreg), attributes_(), text_(), autoClear_(clearme) {}
24 const std::vector<std::string>&
names,
25 const std::vector<std::string>&
values,
32 for (
size_t i = 0;
i <
names.size(); ++
i) {
64 if (defaultNS ==
"!") {
69 size_t foundColon =
name.find(
':');
70 if (foundColon != std::string::npos) {
71 ns =
name.substr(0, foundColon);
72 rn =
name.substr(foundColon + 1);
76 std::string msg =
"DDXMLElement:getDDName failed. It was asked to make ";
77 msg +=
"a DDName using attribute: " + attname;
81 return DDName(
"justToCompile",
"justToCompile");
108 std::vector<std::string> tv;
136 if (!
text_.empty()) {
140 std::string msg =
"DDXMLElement::appendText could not append to non-existent text.";
146 if (tindex >
text_.size()) {
147 std::string msg =
"DDXMLElement::getText tindex is greater than text_.size()).";
150 return text_[tindex];
165 os <<
"Output of current element attributes:" << std::endl;
167 for (DDXMLAttribute::const_iterator it = attribute.begin(); it != attribute.end(); ++it)
168 os << it->first <<
" = " << it->second <<
"\t";
177 tv.emplace_back(itnv->second);
std::string parentElement_
std::vector< DDXMLAttribute >::const_iterator & operator++(int inc)
Allow the elements of this type to be iterated over using ++ operator.
virtual const std::string & get(const std::string &name, size_t aIndex=0) const
Returns a specific value from the aIndex set of attributes.
void appendText(const std::string &inText)
append to the current (i.e. most recently added)
void setParent(const std::string &pename)
Set parent element name to central list of names.
DDName is used to identify DDD entities uniquely.
virtual void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Processing the element.
virtual bool gotText(void) const
gotText()? kind of like gotMilk? Yes = text has already been encountered.
void appendAttributes(std::vector< std::string > &tv, const std::string &name)
behind the scenes appending to pAttributes...
virtual bool isEmpty(void) const
Have any elements of this type been encountered but not processed?
Compact representation of the geometrical detector hierarchy.
virtual size_t size(void) const
Number of elements accumulated.
const std::string names[nVars_]
std::map< std::string, std::string > DDXMLAttribute
static std::string to_string(const XMLCh *ch)
virtual void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Called by loadAttributes AFTER attributes are loaded.
std::ostream & operator<<(std::ostream &os, const DDXMLElement &element)
void loadText(const std::string &inText)
Used to load both text and XML comments into this object.
virtual void stream(std::ostream &os) const
Allow for the elements to have their own streaming method, but also provide a default.
void setSelf(const std::string &sename)
Set self element name to central list of names.
virtual std::vector< DDXMLAttribute >::const_iterator end(void)
void loadAttributes(const std::string &elemName, const std::vector< std::string > &names, const std::vector< std::string > &values, const std::string &nmspace, DDCompactView &cpv)
Load the element attributes.
std::vector< DDXMLAttribute >::const_iterator myIter_
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
std::vector< DDXMLAttribute > attributes_
virtual std::vector< std::string > getVectorAttribute(const std::string &name)
Returns a set of values as a std::vector of strings, given the attribute name.
AttrAccumType attributeAccumulator_
This is a base class for processing XML elements in the DDD.
virtual std::vector< DDXMLAttribute >::const_iterator begin(void)
const std::string & parent(void) const
access to parent element name
The main class for processing parsed elements.
virtual void clear(void)
clear this element's contents.
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
virtual const std::string & getAttribute(const std::string &name) const
Access to attributes by name.
DDXMLElement(DDLElementRegistry *myreg)
Constructor.
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
const std::string getText(size_t tindex=0) const
retrieve the text blob.
std::vector< std::string > text_