
Originally Posted by
wysota
Because it is read only... That's why it's called a
browser and not an
editor.
Could be. Others have read the docs

Me to and i found only one to display html page + link css image and open link on firefox . 
How you projekt a Wysiwyg xhtml editor without QTextBrowser ? 
To make a preview inside you need this QTextBrowser.
QTextEdit dont dispay href link and open it. Boring event maybe? and make clickable.
Otherwise you must open a new window to display and test links...
Now i found a way to emulate XPath ....
Now the problem is to contruct a new QDomNodeList and append note to return on public code...
QDomNodeList not having append(node) !
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <iostream>
#include <QtCore>
#include <QDomDocument>
class List_Tag
{
public:
{
t = FindTagName;
a = AttributeName;
std::cout << "Start Job search tag ->" << qPrintable(FindTagName) << std::endl;
if (n.hasChildNodes()) {
Grep_Tag(n);
}
}
protected:
private:
{
for (int i = 0; i < list.length(); ++i) {
node = list.item(i);
tagname = node.nodeName();
std::cout << "Found tag loop->" << qPrintable(tagname) << std::endl;
if (tagname == t && node.hasAttributes()) {
value = node.toElement().attributeNode(a).value();
if (!value.isEmpty()) {
std::cout << "Result->" << qPrintable(tagname) << " attribute->" << qPrintable(value) << std::endl;
}
} else if (tagname == t && a.isEmpty()) {
std::cout << "Result->" << qPrintable(tagname) << " and Empty attribute." << std::endl;
}
if (node.hasChildNodes()) {
Grep_Tag(list.item(i));
}
}
}
};
int main(int argc, char *argv[]) {
const char *xml = "<test><tag>content 1</tag><tag>content 2</tag> "
"<othertag>wrongcontent<p>text line <a href=\"/somelink\">link1</a></p></othertag>"
"<tag>content 3 <div><p>text other <a href=\"/otherlink\">link2</a></p></div></tag></test>";
bool ok
= doc.
setContent(QString(xml
));
if (ok) {
List_Tag links(doc,"a","href");
List_Tag paras(doc,"p","");
}
std::cout << "Main end..................." << std::endl;
return a.exec();
}
////////#include "main.moc"
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <iostream>
#include <QtCore>
#include <QDomDocument>
class List_Tag
{
public:
List_Tag( QDomDocument doc , const QString FindTagName , const QString AttributeName )
{
t = FindTagName;
a = AttributeName;
std::cout << "Start Job search tag ->" << qPrintable(FindTagName) << std::endl;
QDomNode n = doc.firstChild();
if (n.hasChildNodes()) {
Grep_Tag(n);
}
}
protected:
QString t;
QString a;
QString value;
QString tagname;
QDomNode node;
private:
void Grep_Tag( QDomNode n )
{
QDomNodeList list = n.childNodes();
for (int i = 0; i < list.length(); ++i) {
node = list.item(i);
tagname = node.nodeName();
std::cout << "Found tag loop->" << qPrintable(tagname) << std::endl;
if (tagname == t && node.hasAttributes()) {
value = node.toElement().attributeNode(a).value();
if (!value.isEmpty()) {
std::cout << "Result->" << qPrintable(tagname) << " attribute->" << qPrintable(value) << std::endl;
}
} else if (tagname == t && a.isEmpty()) {
std::cout << "Result->" << qPrintable(tagname) << " and Empty attribute." << std::endl;
}
if (node.hasChildNodes()) {
Grep_Tag(list.item(i));
}
}
}
};
int main(int argc, char *argv[]) {
QCoreApplication a( argc, argv );
const char *xml = "<test><tag>content 1</tag><tag>content 2</tag> "
"<othertag>wrongcontent<p>text line <a href=\"/somelink\">link1</a></p></othertag>"
"<tag>content 3 <div><p>text other <a href=\"/otherlink\">link2</a></p></div></tag></test>";
QDomDocument doc;
bool ok = doc.setContent(QString(xml));
if (ok) {
List_Tag links(doc,"a","href");
List_Tag paras(doc,"p","");
}
std::cout << "Main end..................." << std::endl;
return a.exec();
}
////////#include "main.moc"
To copy to clipboard, switch view to plain text mode
Bookmarks