/**************************************************************************
 *  This file is part of QXmlEdit                                         *
 *  Copyright (C) 2011 by Luca Bellonda and individual contributors       *
 *    as indicated in the AUTHORS file                                    *
 *  lbellonda _at_ gmail.com                                              *
 *                                                                        *
 * This library is free software; you can redistribute it and/or          *
 * modify it under the terms of the GNU Library General Public            *
 * License as published by the Free Software Foundation; either           *
 * version 2 of the License, or (at your option) any later version.       *
 *                                                                        *
 * This library is distributed in the hope that it will be useful,        *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
 * Library General Public License for more details.                       *
 *                                                                        *
 * You should have received a copy of the GNU Library General Public      *
 * License along with this library; if not, write to the                  *
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,       *
 * Boston, MA  02110-1301  USA                                            *
 **************************************************************************/

#ifndef COMPAREXML_H
#define COMPAREXML_H
#include <QDomDocument>

class CompareXML
{
    bool _showMessages;

    bool comparaFigli(QDomNode &node1, QDomNode &node2);
    bool compareAttributes(QDomElement element1, QDomElement element2);
    void debug(const QString &msg);
    QString getStringData(const QString &str);
    void compareDifferentStrings(const QString &str1, const QString &str2);
    void dumpTwoNodes(QDomNodeList &childNodes1, QDomNodeList &childNodes2);
    void dumpNodes(QDomNodeList &childNodes);

public:
    CompareXML();
    bool comparePlainDocuments();
    bool compareMixedDocuments();
    bool compareMixedDocumentsFalse();
    bool comparePlainDocumentsFalse();

    bool compareDomDocuments(QDomDocument &doc1, QDomDocument &doc2);
    bool loadFileIntoDocument(QIODevice *ioDevice, QDomDocument &document);
    bool loadFileIntoDocument(const QString &filePath, QDomDocument &document);
    bool compareFiles(const QString &file1, const QString &file2);
};

#endif // COMPAREXML_H

