WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
ZSchemaValidator.h
Go to the documentation of this file.
1 /*
2 * Zuble - A run-time system for QML/Javascript applications
3 * Copyright (C) 2013, 2014 Bob Dinitto
4 *
5 * Filename: ZSchemaValidator.h
6 * Created on: 11/9/2014
7 * Author: Bob Dinitto
8 *
9 * Zuble is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 */
24 
25 #ifndef ZSCHEMAVALIDATOR_H
26 #define ZSCHEMAVALIDATOR_H
27 
28 #include <QObject>
29 #include <QUrl>
30 #include <QXmlSchema>
31 #include "ZMessageHandler.h"
32 #include "zglobal.h"
33 
34 namespace Zbl
35 {
36 
44 class ZSchemaValidator : public QObject, ZxMessageListener
45 {
46  Q_OBJECT
47 public:
48  explicit ZSchemaValidator(QObject *parent = 0);
49 
54  Q_PROPERTY(QString schemaUrl READ getSchemaUrl WRITE setSchemaUrl)
55 
56 
60  Q_PROPERTY(QString xmlDocUrl READ getXmlDocUrl WRITE setXmlDocUrl)
61 
62 
63 
69  QString getSchemaUrl();
70 
79  void setSchemaUrl(const QString& schemaUrl);
80 
86  QString getXmlDocUrl();
87 
94  void setXmlDocUrl(const QString& xmlDocUrl);
95 
102  Q_INVOKABLE bool isOk();
103 
104 
109  static int registerType();
110 
111 
112 
113 signals:
114 
115  void statusMessage(QVariant message);
116 
117 public slots:
118 
126  bool validate();
127 
128 protected:
129 
131 
132  virtual void zMessage(QVariant message);
133 
140 
145  QXmlSchema m_schema;
146 
153 
159 
164  bool m_status;
165 
166 };
167 
168 } // Zbl
169 
170 #endif // ZSCHEMAVALIDATOR_H
QXmlSchema m_schema
The encapsulated QXmlSchema object.
#define ZBL_DECLARE_LOGGED_OBJECT
Definition: zglobal.h:94
QString getSchemaUrl()
Obtain the schema URI.
ZSchemaValidator(QObject *parent=0)
virtual ZBL_DECLARE_LOGGED_OBJECT void zMessage(QVariant message)
bool m_status
Most recent status. true = OK, false = failed.
Q_INVOKABLE bool isOk()
Determines the status of the most recent operation.
QString getXmlDocUrl()
Obtain the XML instance document URI.
Definition: ZAndGate.cpp:6
QUrl m_XmlDocUrl
The URI to the XML instance document that will be valudated against an XML schema.
void setSchemaUrl(const QString &schemaUrl)
Sets the URI of the XML schema to use for validating XML documents and loads the schema into memory...
Classes that listen for ZxMessageHandler messages derive from this class and override the zMessage() ...
static int registerType()
Registers this object with the QML type system.
QUrl m_schemaUrl
The URI to the schema against which the instance document will be validated.
bool validate()
Validates the current XML document against the currently loaded XML schema.
void statusMessage(QVariant message)
A class to pass parsing error messages from QXmlQuery to a listener. The message is passed as a JSON ...
ZxMessageHandler m_msgHandler
QXmlQuery.
This class wraps the QXmlSchemaValidator and QXmlSchema classes.
void setXmlDocUrl(const QString &xmlDocUrl)
Sets the URI of the XML instance Document to be validated against the XML schema. ...