00001 #include "SDXDocument.h"
00002 #include "SDXNode.h"
00003 #include "SDXContentHandler.h"
00004
00005 using namespace std;
00006 using namespace SDX;
00007
00008 Document::Document(Document& other){
00009 vector<Node*> children = other.getChildren();
00010 for(vector<Node*>::iterator i = children.begin(); i != children.end(); ++i)
00011 addChild(new Node(*i));
00012 }
00013
00014 Document::Document(Document* other){
00015 vector<Node*> children = other->getChildren();
00016 for(vector<Node*>::iterator i = children.begin(); i != children.end(); ++i)
00017 addChild(new Node(*i));
00018 }
00019
00020 void Document::sendToContentHandler(ContentHandler* contentHandler, bool onlySendContents){
00021 if(!onlySendContents)
00022 contentHandler->startDocument();
00023
00024 vector<Node*> children = getChildren();
00025 for(vector<Node*>::iterator i = children.begin(); i != children.end(); ++i)
00026 (*i)->sendToContentHandler(contentHandler);
00027
00028 if(!onlySendContents)
00029 contentHandler->endDocument();
00030 }