Good day!
Attempting to parse XML to DOM from string input using QDomDocument::setContent(). However, setContent() returns true regardless of the input and it's driving me nuts.
Text is entered into QTextEdit GUI and then (theoretically) converted to XML in the following function:
void Class::getXML()
{
domDoc->clear();
//Converts text edit content to HTML and parses to DOM doc
if(!domDoc->setContent(textEdit->toHtml())) {
} else {
QMessageBox::information(this,
"Success",domDoc
->toString
(4));
//xxxTESTINGxxx }
}
void Class::getXML()
{
domDoc->clear();
//Converts text edit content to HTML and parses to DOM doc
if(!domDoc->setContent(textEdit->toHtml())) {
QMessageBox::information(this,"Error","XML invalid");
} else {
QMessageBox::information(this,"Success",domDoc->toString(4)); //xxxTESTINGxxx
}
}
To copy to clipboard, switch view to plain text mode
I understand setContent() is supposed to validate the input? Any ideas?
Thanks!
Bookmarks