diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-07-24 09:45:33 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-07-27 13:04:30 (GMT) |
commit | 3643028959f0b38350e57e60ba4000435b75e592 (patch) | |
tree | c129e4dee11487abd437ab8ebd993ba261e06fa6 /examples/xmlpatterns/schema | |
parent | cf66c667a97c0079141eb3f2d9e997b7378ae792 (diff) | |
parent | c36139c665e61866aff4bf8572890a735167a7d0 (diff) | |
download | Qt-3643028959f0b38350e57e60ba4000435b75e592.zip Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.gz Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.bz2 |
Merge commit 'qt/master-stable'
Conflicts:
configure.exe
qmake/Makefile.unix
qmake/generators/makefile.cpp
src/corelib/global/qglobal.h
src/corelib/kernel/kernel.pri
src/corelib/kernel/qcoreevent.cpp
src/corelib/kernel/qsharedmemory_unix.cpp
src/gui/graphicsview/qgraphicsscene.cpp
src/gui/kernel/qaction.cpp
src/gui/kernel/qaction.h
src/gui/kernel/qaction_p.h
src/gui/kernel/qapplication.cpp
src/gui/kernel/qapplication.h
src/gui/kernel/qwidget.cpp
src/gui/kernel/qwidget.h
src/gui/kernel/qwidget_mac.mm
src/gui/painting/qgraphicssystemfactory.cpp
src/gui/styles/qwindowsstyle.cpp
src/gui/text/qfontengine_qpf.cpp
src/gui/widgets/qabstractscrollarea_p.h
src/network/access/qnetworkaccessdebugpipebackend.cpp
src/network/socket/qlocalsocket_unix.cpp
src/network/socket/qnativesocketengine_p.h
src/network/socket/qnativesocketengine_unix.cpp
src/openvg/qpaintengine_vg.cpp
tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
tests/auto/qcssparser/qcssparser.pro
tests/auto/qdir/tst_qdir.cpp
tests/auto/qfile/tst_qfile.cpp
tests/auto/qobject/tst_qobject.cpp
tests/auto/qpathclipper/qpathclipper.pro
tests/auto/qprocess/tst_qprocess.cpp
tests/auto/qsettings/tst_qsettings.cpp
tests/auto/qsharedpointer/qsharedpointer.pro
tests/auto/qsqlquerymodel/qsqlquerymodel.pro
tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
tests/auto/qsqltablemodel/qsqltablemodel.pro
tests/auto/qsqlthread/qsqlthread.pro
tests/auto/qwidget/tst_qwidget.cpp
Diffstat (limited to 'examples/xmlpatterns/schema')
-rw-r--r-- | examples/xmlpatterns/schema/files/contact.xsd | 25 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/files/invalid_contact.xml | 11 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/files/invalid_order.xml | 13 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/files/invalid_recipe.xml | 14 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/files/order.xsd | 23 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/files/recipe.xsd | 40 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/files/valid_contact.xml | 11 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/files/valid_order.xml | 18 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/files/valid_recipe.xml | 13 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/main.cpp | 54 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/mainwindow.cpp | 218 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/mainwindow.h | 68 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/schema.pro | 11 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/schema.qrc | 13 | ||||
-rw-r--r-- | examples/xmlpatterns/schema/schema.ui | 71 |
15 files changed, 603 insertions, 0 deletions
diff --git a/examples/xmlpatterns/schema/files/contact.xsd b/examples/xmlpatterns/schema/files/contact.xsd new file mode 100644 index 0000000..3e1b570 --- /dev/null +++ b/examples/xmlpatterns/schema/files/contact.xsd @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <xsd:element name="contact"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="givenName" type="xsd:string"/> + <xsd:element name="familyName" type="xsd:string"/> + <xsd:element name="birthdate" type="xsd:date" minOccurs="0"/> + <xsd:element name="homeAddress" type="address"/> + <xsd:element name="workAddress" type="address" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="address"> + <xsd:sequence> + <xsd:element name="street" type="xsd:string"/> + <xsd:element name="zipCode" type="xsd:string"/> + <xsd:element name="city" type="xsd:string"/> + <xsd:element name="country" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + +</xsd:schema> diff --git a/examples/xmlpatterns/schema/files/invalid_contact.xml b/examples/xmlpatterns/schema/files/invalid_contact.xml new file mode 100644 index 0000000..42f1edd --- /dev/null +++ b/examples/xmlpatterns/schema/files/invalid_contact.xml @@ -0,0 +1,11 @@ +<contact> + <givenName>John</givenName> + <familyName>Doe</familyName> + <title>Prof.</title> + <workAddress> + <street>Sandakerveien 116</street> + <zipCode>N-0550</zipCode> + <city>Oslo</city> + <country>Norway</country> + </workAddress> +</contact> diff --git a/examples/xmlpatterns/schema/files/invalid_order.xml b/examples/xmlpatterns/schema/files/invalid_order.xml new file mode 100644 index 0000000..8ffc5fd --- /dev/null +++ b/examples/xmlpatterns/schema/files/invalid_order.xml @@ -0,0 +1,13 @@ +<order> + <customerId>234219</customerId> + <article> + <articleId>21692</articleId> + <count>3</count> + </article> + <article> + <articleId>24749</articleId> + <count>9</count> + </article> + <deliveryDate>2009-01-23</deliveryDate> + <payed>yes</payed> +</order> diff --git a/examples/xmlpatterns/schema/files/invalid_recipe.xml b/examples/xmlpatterns/schema/files/invalid_recipe.xml new file mode 100644 index 0000000..4d75af6 --- /dev/null +++ b/examples/xmlpatterns/schema/files/invalid_recipe.xml @@ -0,0 +1,14 @@ +<recipe> + <title>Cheese on Toast</title> + <ingredient name="Bread" quantity="2" unit="slices"/> + <ingredient name="Cheese" quantity="2" unit="slices"/> + <time quantity="3" unit="days"/> + <method> + <step>1. Slice the bread and cheese.</step> + <step>2. Grill one side of each slice of bread.</step> + <step>3. Turn over the bread and place a slice of cheese on each piece.</step> + <step>4. Grill until the cheese has started to melt.</step> + <step>5. Serve and enjoy!</step> + </method> + <comment>Tell your friends about it!</comment> +</recipe> diff --git a/examples/xmlpatterns/schema/files/order.xsd b/examples/xmlpatterns/schema/files/order.xsd new file mode 100644 index 0000000..405cafe --- /dev/null +++ b/examples/xmlpatterns/schema/files/order.xsd @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <xsd:element name="order"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerId" type="xsd:positiveInteger"/> + <xsd:element name="article" type="articleType" maxOccurs="unbounded"/> + <xsd:element name="deliveryDate" type="xsd:date"/> + <xsd:element name="payed" type="xsd:boolean"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="articleType"> + <xsd:sequence> + <xsd:element name="articleId" type="xsd:positiveInteger"/> + <xsd:element name="count" type="xsd:positiveInteger"/> + <xsd:element name="comment" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + +</xsd:schema> diff --git a/examples/xmlpatterns/schema/files/recipe.xsd b/examples/xmlpatterns/schema/files/recipe.xsd new file mode 100644 index 0000000..bbbafd9 --- /dev/null +++ b/examples/xmlpatterns/schema/files/recipe.xsd @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <xsd:element name="recipe"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="title" type="xsd:string"/> + <xsd:element name="ingredient" type="ingredientType" maxOccurs="unbounded"/> + <xsd:element name="time" type="timeType"/> + <xsd:element name="method"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="step" type="xsd:string" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="ingredientType"> + <xsd:attribute name="name" type="xsd:string"/> + <xsd:attribute name="quantity" type="xsd:positiveInteger"/> + <xsd:attribute name="unit" type="xsd:string"/> + </xsd:complexType> + + <xsd:complexType name="timeType"> + <xsd:attribute name="quantity" type="xsd:positiveInteger"/> + <xsd:attribute name="unit"> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="seconds"/> + <xsd:enumeration value="minutes"/> + <xsd:enumeration value="hours"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + </xsd:complexType> + +</xsd:schema> diff --git a/examples/xmlpatterns/schema/files/valid_contact.xml b/examples/xmlpatterns/schema/files/valid_contact.xml new file mode 100644 index 0000000..53c04d4 --- /dev/null +++ b/examples/xmlpatterns/schema/files/valid_contact.xml @@ -0,0 +1,11 @@ +<contact> + <givenName>John</givenName> + <familyName>Doe</familyName> + <birthdate>1977-12-25</birthdate> + <homeAddress> + <street>Sandakerveien 116</street> + <zipCode>N-0550</zipCode> + <city>Oslo</city> + <country>Norway</country> + </homeAddress> +</contact> diff --git a/examples/xmlpatterns/schema/files/valid_order.xml b/examples/xmlpatterns/schema/files/valid_order.xml new file mode 100644 index 0000000..f83c36c --- /dev/null +++ b/examples/xmlpatterns/schema/files/valid_order.xml @@ -0,0 +1,18 @@ +<order> + <customerId>194223</customerId> + <article> + <articleId>22242</articleId> + <count>5</count> + </article> + <article> + <articleId>32372</articleId> + <count>12</count> + <comment>without stripes</comment> + </article> + <article> + <articleId>23649</articleId> + <count>2</count> + </article> + <deliveryDate>2009-01-23</deliveryDate> + <payed>true</payed> +</order> diff --git a/examples/xmlpatterns/schema/files/valid_recipe.xml b/examples/xmlpatterns/schema/files/valid_recipe.xml new file mode 100644 index 0000000..f6499ba --- /dev/null +++ b/examples/xmlpatterns/schema/files/valid_recipe.xml @@ -0,0 +1,13 @@ +<recipe> + <title>Cheese on Toast</title> + <ingredient name="Bread" quantity="2" unit="slices"/> + <ingredient name="Cheese" quantity="2" unit="slices"/> + <time quantity="3" unit="minutes"/> + <method> + <step>1. Slice the bread and cheese.</step> + <step>2. Grill one side of each slice of bread.</step> + <step>3. Turn over the bread and place a slice of cheese on each piece.</step> + <step>4. Grill until the cheese has started to melt.</step> + <step>5. Serve and enjoy!</step> + </method> +</recipe> diff --git a/examples/xmlpatterns/schema/main.cpp b/examples/xmlpatterns/schema/main.cpp new file mode 100644 index 0000000..b1ec8b0 --- /dev/null +++ b/examples/xmlpatterns/schema/main.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> +#include "mainwindow.h" + +//! [0] +int main(int argc, char* argv[]) +{ + Q_INIT_RESOURCE(schema); + QApplication app(argc, argv); + MainWindow* const window = new MainWindow; + window->show(); + return app.exec(); +} +//! [0] diff --git a/examples/xmlpatterns/schema/mainwindow.cpp b/examples/xmlpatterns/schema/mainwindow.cpp new file mode 100644 index 0000000..0bb21f5 --- /dev/null +++ b/examples/xmlpatterns/schema/mainwindow.cpp @@ -0,0 +1,218 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> +#include <QtXmlPatterns> + +#include "mainwindow.h" +#include "xmlsyntaxhighlighter.h" + +//! [4] +class MessageHandler : public QAbstractMessageHandler +{ + public: + MessageHandler() + : QAbstractMessageHandler(0) + { + } + + QString statusMessage() const + { + return m_description; + } + + int line() const + { + return m_sourceLocation.line(); + } + + int column() const + { + return m_sourceLocation.column(); + } + + protected: + virtual void handleMessage(QtMsgType type, const QString &description, + const QUrl &identifier, const QSourceLocation &sourceLocation) + { + Q_UNUSED(type); + Q_UNUSED(identifier); + + m_messageType = type; + m_description = description; + m_sourceLocation = sourceLocation; + } + + private: + QtMsgType m_messageType; + QString m_description; + QSourceLocation m_sourceLocation; +}; +//! [4] + +//! [0] +MainWindow::MainWindow() +{ + setupUi(this); + + new XmlSyntaxHighlighter(schemaView->document()); + new XmlSyntaxHighlighter(instanceEdit->document()); + + schemaSelection->addItem(tr("Contact Schema")); + schemaSelection->addItem(tr("Recipe Schema")); + schemaSelection->addItem(tr("Order Schema")); + + instanceSelection->addItem(tr("Valid Contact Instance")); + instanceSelection->addItem(tr("Invalid Contact Instance")); + + connect(schemaSelection, SIGNAL(currentIndexChanged(int)), SLOT(schemaSelected(int))); + connect(instanceSelection, SIGNAL(currentIndexChanged(int)), SLOT(instanceSelected(int))); + connect(validateButton, SIGNAL(clicked()), SLOT(validate())); + connect(instanceEdit, SIGNAL(textChanged()), SLOT(textChanged())); + + validationStatus->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); + + schemaSelected(0); + instanceSelected(0); +} +//! [0] + +//! [1] +void MainWindow::schemaSelected(int index) +{ + instanceSelection->clear(); + if (index == 0) { + instanceSelection->addItem(tr("Valid Contact Instance")); + instanceSelection->addItem(tr("Invalid Contact Instance")); + } else if (index == 1) { + instanceSelection->addItem(tr("Valid Recipe Instance")); + instanceSelection->addItem(tr("Invalid Recipe Instance")); + } else if (index == 2) { + instanceSelection->addItem(tr("Valid Order Instance")); + instanceSelection->addItem(tr("Invalid Order Instance")); + } + textChanged(); + + QFile schemaFile(QString(":/schema_%1.xsd").arg(index)); + schemaFile.open(QIODevice::ReadOnly); + const QString schemaText(QString::fromUtf8(schemaFile.readAll())); + schemaView->setPlainText(schemaText); + + validate(); +} +//! [1] + +//! [2] +void MainWindow::instanceSelected(int index) +{ + QFile instanceFile(QString(":/instance_%1.xml").arg((2*schemaSelection->currentIndex()) + index)); + instanceFile.open(QIODevice::ReadOnly); + const QString instanceText(QString::fromUtf8(instanceFile.readAll())); + instanceEdit->setPlainText(instanceText); + + validate(); +} +//! [2] + +//! [3] +void MainWindow::validate() +{ + const QByteArray schemaData = schemaView->toPlainText().toUtf8(); + const QByteArray instanceData = instanceEdit->toPlainText().toUtf8(); + + MessageHandler messageHandler; + + QXmlSchema schema; + schema.setMessageHandler(&messageHandler); + + schema.load(schemaData); + + bool errorOccurred = false; + if (!schema.isValid()) { + errorOccurred = true; + } else { + QXmlSchemaValidator validator(schema); + if (!validator.validate(instanceData)) + errorOccurred = true; + } + + if (errorOccurred) { + validationStatus->setText(messageHandler.statusMessage()); + moveCursor(messageHandler.line(), messageHandler.column()); + } else { + validationStatus->setText(tr("validation successful")); + } + + const QString styleSheet = QString("QLabel {background: %1; padding: 3px}") + .arg(errorOccurred ? QColor(Qt::red).lighter(160).name() : + QColor(Qt::green).lighter(160).name()); + validationStatus->setStyleSheet(styleSheet); +} +//! [3] + +void MainWindow::textChanged() +{ + instanceEdit->setExtraSelections(QList<QTextEdit::ExtraSelection>()); +} + +void MainWindow::moveCursor(int line, int column) +{ + instanceEdit->moveCursor(QTextCursor::Start); + for (int i = 1; i < line; ++i) + instanceEdit->moveCursor(QTextCursor::Down); + + for (int i = 1; i < column; ++i) + instanceEdit->moveCursor(QTextCursor::Right); + + QList<QTextEdit::ExtraSelection> extraSelections; + QTextEdit::ExtraSelection selection; + + const QColor lineColor = QColor(Qt::red).lighter(160); + selection.format.setBackground(lineColor); + selection.format.setProperty(QTextFormat::FullWidthSelection, true); + selection.cursor = instanceEdit->textCursor(); + selection.cursor.clearSelection(); + extraSelections.append(selection); + + instanceEdit->setExtraSelections(extraSelections); + + instanceEdit->setFocus(); +} diff --git a/examples/xmlpatterns/schema/mainwindow.h b/examples/xmlpatterns/schema/mainwindow.h new file mode 100644 index 0000000..420c627 --- /dev/null +++ b/examples/xmlpatterns/schema/mainwindow.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> + +#include "ui_schema.h" + +//! [0] +class MainWindow : public QMainWindow, + private Ui::SchemaMainWindow +{ + Q_OBJECT + + public: + MainWindow(); + + private Q_SLOTS: + void schemaSelected(int index); + void instanceSelected(int index); + void validate(); + void textChanged(); + + private: + void moveCursor(int line, int column); +}; +//! [0] +#endif diff --git a/examples/xmlpatterns/schema/schema.pro b/examples/xmlpatterns/schema/schema.pro new file mode 100644 index 0000000..af32e0a --- /dev/null +++ b/examples/xmlpatterns/schema/schema.pro @@ -0,0 +1,11 @@ +QT += xmlpatterns +FORMS += schema.ui +HEADERS = mainwindow.h ../shared/xmlsyntaxhighlighter.h +RESOURCES = schema.qrc +SOURCES = main.cpp mainwindow.cpp ../shared/xmlsyntaxhighlighter.cpp +INCLUDEPATH += ../shared/ + +target.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/schema +sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xq *.html files +sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/schema +INSTALLS += target sources diff --git a/examples/xmlpatterns/schema/schema.qrc b/examples/xmlpatterns/schema/schema.qrc new file mode 100644 index 0000000..eb7ddfd --- /dev/null +++ b/examples/xmlpatterns/schema/schema.qrc @@ -0,0 +1,13 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file alias="schema_0.xsd">files/contact.xsd</file> + <file alias="schema_1.xsd">files/recipe.xsd</file> + <file alias="schema_2.xsd">files/order.xsd</file> + <file alias="instance_0.xml">files/valid_contact.xml</file> + <file alias="instance_1.xml">files/invalid_contact.xml</file> + <file alias="instance_2.xml">files/valid_recipe.xml</file> + <file alias="instance_3.xml">files/invalid_recipe.xml</file> + <file alias="instance_4.xml">files/valid_order.xml</file> + <file alias="instance_5.xml">files/invalid_order.xml</file> +</qresource> +</RCC> diff --git a/examples/xmlpatterns/schema/schema.ui b/examples/xmlpatterns/schema/schema.ui new file mode 100644 index 0000000..b67f444 --- /dev/null +++ b/examples/xmlpatterns/schema/schema.ui @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SchemaMainWindow</class> + <widget class="QMainWindow" name="SchemaMainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>417</width> + <height>594</height> + </rect> + </property> + <property name="windowTitle"> + <string>XML Schema Validation</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="schemaLabel"> + <property name="text"> + <string>XML Schema Document:</string> + </property> + </widget> + </item> + <item row="0" column="2" colspan="2"> + <widget class="QComboBox" name="schemaSelection"/> + </item> + <item row="1" column="0" colspan="4"> + <widget class="QTextBrowser" name="schemaView"/> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="instanceLabel"> + <property name="text"> + <string>XML Instance Document:</string> + </property> + </widget> + </item> + <item row="2" column="2" colspan="2"> + <widget class="QComboBox" name="instanceSelection"/> + </item> + <item row="3" column="0" colspan="4"> + <widget class="QTextEdit" name="instanceEdit"/> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Status:</string> + </property> + </widget> + </item> + <item row="4" column="1" colspan="2"> + <widget class="QLabel" name="validationStatus"> + <property name="text"> + <string>not validated</string> + </property> + </widget> + </item> + <item row="4" column="3"> + <widget class="QPushButton" name="validateButton"> + <property name="text"> + <string>Validate</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QStatusBar" name="statusbar"/> + </widget> + <resources/> + <connections/> +</ui> |