31KoStore* XmlParser::_in = NULL;
32TQString XmlParser::_filename =
"";
34XmlParser::XmlParser(
Config* config, TQString filename):_config(config)
39 if(!f.open(IO_ReadOnly))
41 if(!_document.setContent(&f))
51XmlParser::XmlParser(
Config* config, TQByteArray in): _config(config)
53 _document.setContent(in);
56XmlParser::XmlParser(
Config* config,
const KoStore* in): _config(config)
58 _in =
const_cast<KoStore*
>(in);
59 if(!_in->open(
"root"))
61 kdError(30503) <<
"Unable to open input file!" << endl;
65 TQByteArray array = _in->read(_in->size());
66 _document.setContent(array);
69 kdError(30522) <<
"unable to close input file" << endl;
76 _config = Config::instance();
84XmlParser::~XmlParser()
90TQDomNode XmlParser::getChild(TQDomNode balise, TQString name)
92 TQDomNode node = getChild(balise, name, 0);
93 kdDebug(30522) << node.nodeName() << endl;
97bool XmlParser::isChild(TQDomNode balise, TQString name)
99 if(balise.isElement())
100 return balise.toElement().elementsByTagName(name).count();
104TQDomNode XmlParser::getChild(TQDomNode balise, TQString name,
int index)
106 if(balise.isElement()) {
107 TQDomNodeList children = balise.toElement().elementsByTagName(name);
108 if ( children.count() )
109 return children.item(index);
114TQDomNode XmlParser::getChild(TQDomNode balise,
int index)
116 TQDomNodeList children = balise.childNodes();
117 if ( children.count() )
118 return children.item(index);
122TQString XmlParser::getData(TQDomNode balise,
int index)
124 return getChild(getChild(balise, index), 0).nodeValue();
127int XmlParser::getNbChild(TQDomNode balise)
129 return balise.childNodes().count();
132int XmlParser::getNbChild(TQDomNode balise, TQString name)
134 if(balise.isElement())
135 return balise.toElement().elementsByTagName(name).count();
139TQString XmlParser::getChildName(TQDomNode balise,
int index)
141 return balise.childNodes().item(index).nodeName();
144TQString XmlParser::getAttr(TQDomNode balise, TQString name)
const
146 if(balise.isElement())
147 return balise.toElement().attributeNode(name).value();
This class hold all parameters and configuration from a file or from the filter configuration dialog ...
This class hold a whole document with its headers, footers, footnotes, endnotes, content,...