AXmlElement& AXmlElement::addContent( AXmlElement *pnode, const AString& path, // = AConstant::ASTRING_EMPTY bool insertIntoFront // = false ) { if (path.isEmpty() || path.equals(AConstant::ASTRING_SLASH)) { AASSERT(this, m_Content.size() < DEBUG_MAXSIZE_AXmlElement); //Debug only limit AASSERT(this, pnode); pnode->setParent(this); if (insertIntoFront) m_Content.push_front(pnode); else m_Content.push_back(pnode); } else { LIST_AString parts; path.split(parts, '/'); if (!parts.size()) ATHROW(this, AException::InvalidParameter); AXmlElement *pNewParent = _createAndAppend(parts, this, insertIntoFront); AASSERT_EX(this, pNewParent, path); pNewParent->addContent(pnode, AConstant::ASTRING_EMPTY, insertIntoFront); } return *this; }
void AXmlElement::emitXmlContent(AXmlElement& target) const { CONTAINER::const_iterator cit = m_Content.begin(); while (cit != m_Content.end()) { target.addContent((*cit)->clone()); ++cit; } }