1 #include "SimpleDOM.hxx"
9 for( Children_t::const_iterator it = _children.begin(); it != _children.end(); ++it )
13 string DOMNode::render() const
16 reply.append( "<" ).append( _name );
17 for( Attributes_t::const_iterator it = _attributes.begin(); it != _attributes.end(); ++it ) {
19 reply.append( it->first );
20 reply.append( "=\"" );
21 reply.append( it->second );
25 if( _children.empty() ) {
26 reply.append( " />\r" );
32 for( Children_t::const_iterator it = _children.begin(); it != _children.end(); ++it ) {
33 reply.append( (*it)->render() );
36 reply.append( "</" ).append( _name ).append( ">\r" );
41 DOMNode * DOMNode::addChild( DOMElement * child )
43 _children.push_back( child );
44 return dynamic_cast<DOMNode*>(child);
47 DOMNode * DOMNode::setAttribute( const string & name, const string & value )
49 _attributes[name] = value;