#include <cppdom.h>
Inheritance diagram for cppdom::XMLDocument:
Public Methods | |
XMLDocument () | |
XMLDocument (XMLContextPtr context) | |
constructor taking xml context pointer. More... | |
XMLNodeList & | getPiList () |
returns a list of processing instruction nodes. More... | |
XMLNodeList & | getDtdList () |
returns a list of document type definition rules to check the xml file. More... | |
void | load (std::istream &in, XMLContextPtr &context) |
loads xml Document (node) from input stream. More... | |
void | save (std::ostream &out) |
saves node to xml output stream. More... | |
void | loadFile (const std::string &filename) throw (XMLError) |
void | saveFile (const std::string &filename) |
Protected Attributes | |
XMLNodeList | mProcInstructions |
node list of parsed processing instructions. More... | |
XMLNodeList | mDtdRules |
node list of document type definition rules. More... | |
Friends | |
class | XMLParser |
Definition at line 503 of file cppdom.h.
|
Definition at line 545 of file cppdom.cpp. References cppdom::XMLNode::mNodeType, and cppdom::xml_nt_document.
00546 { 00547 mNodeType = xml_nt_document; 00548 } |
|
constructor taking xml context pointer.
Definition at line 550 of file cppdom.cpp. References cppdom::XMLNode::mNodeType, and cppdom::xml_nt_document.
00551 : XMLNode(context) 00552 { 00553 mNodeType = xml_nt_document; 00554 } |
|
returns a list of document type definition rules to check the xml file.
Definition at line 561 of file cppdom.cpp. References mDtdRules, and cppdom::XMLNodeList.
00562 { 00563 return mDtdRules; 00564 } |
|
returns a list of processing instruction nodes.
Definition at line 556 of file cppdom.cpp. References mProcInstructions, and cppdom::XMLNodeList.
00557 { 00558 return mProcInstructions; 00559 } |
|
loads xml Document (node) from input stream.
Reimplemented from cppdom::XMLNode. Definition at line 567 of file cppdom.cpp. References cppdom::XMLParser::parseDocument().
00568 { 00569 XMLParser parser(in, context->getLocation()); 00570 parser.parseDocument(*this, context); 00571 } |
|
Definition at line 613 of file cppdom.cpp. References cppdom::xml_filename_invalid.
00614 { 00615 std::ifstream in; 00616 in.open(filename.c_str(), std::ios::in); 00617 00618 if (! in.good()) 00619 { 00620 throw XMLError(xml_filename_invalid); 00621 } 00622 00623 load(in, mContext); 00624 in.close(); 00625 } |
|
saves node to xml output stream.
Definition at line 576 of file cppdom.cpp. References cppdom::XMLNode::mAttributes, cppdom::XMLNode::mNodeList, and mProcInstructions. Referenced by saveFile().
00577 { 00578 // output all processing instructions 00579 XMLNodeList::const_iterator iter, stop; 00580 iter = mProcInstructions.begin(); 00581 stop = mProcInstructions.end(); 00582 00583 for(; iter!=stop; ++iter) 00584 { 00585 XMLNodePtr np = *iter; 00586 00587 // output pi tag 00588 out << "<?" << np->getName(); 00589 00590 // output all attributes 00591 XMLAttributes::const_iterator aiter, astop; 00592 aiter = mAttributes.begin(); 00593 astop = mAttributes.end(); 00594 00595 for(; aiter!=astop; ++aiter) 00596 { 00597 XMLAttributes::value_type attr = *aiter; 00598 out << ' ' << attr.first << '=' << '\"' << attr.second << '\"'; 00599 } 00600 // output closing brace 00601 out << "?>" << std::endl; 00602 } 00603 00604 // output <!doctype> tag 00605 00606 // left to do ... 00607 00608 00609 // call save() method of the first (and hopefully only) node in XMLDocument 00610 (*mNodeList.begin())->save(out, 0); 00611 } |
|
Definition at line 627 of file cppdom.cpp. References save().
00628 { 00629 std::ofstream out; 00630 out.open(filename.c_str(), std::ios::in | std::ios::out); 00631 this->save(out); 00632 out.close(); 00633 } |
|
Reimplemented from cppdom::XMLNode. |
|
node list of document type definition rules.
Definition at line 537 of file cppdom.h. Referenced by getDtdList(). |
|
node list of parsed processing instructions.
|