my RSS feed is not validating properly and i cannot see why.. i get the following errors:
This feed does not validate.
line 2, column 0: Undefined root element: xml [help]
<xml version='1.0' encoding='UTF-8'>
line 16, column 2: XML parsing error: <unknown>:16:2: mismatched tag [help]
</item>
^
I see the errors but i dont get why the are there since i dont see the issue within the code. But i am a newbie with this so..
<xml version='1.0' encoding='UTF-8'>
<rss version='2.0'>
<channel>
<title>Uppladdade bilder</title>
<description>Uppladdade bilder</description>
<br>
<link>http://douglaspettersson.se/moment5/rss.php</link>
<hr>
<br>
<item>
<description>Uppladdad av: doggepe</description>
<br><img src="uploads/thumb_laferrari.jpg"/>
<br><description> Bildbeskrivning: Ferrari LaFerrari</description>
<br><link> http://douglaspettersson.se/moment55/uploads/thumb_laferrari.jpg</link><br><pubdate> Uppladdad: 2016-02-14 22:21:19</pubdate>
</item>
<hr><br><item>
<description>Uppladdad av: doggepe</description>
<br><img src="uploads/thumb_porsche991.jpg"/>
<br><description> Bildbeskrivning: 2014 Porsche 911 Carrera</description>
<br><link> http://douglaspettersson.se/moment55/uploads/thumb_porsche991.jpg</link><br><pubdate> Uppladdad: 2016-02-14 22:23:55</pubdate>
</item>
<hr><br><item>
<description>Uppladdad av: mattias</description>
<br><img src="uploads/thumb_DSC_0050.JPG"/>
<br><description> Bildbeskrivning: Höga kusten</description>
<br><link> http://douglaspettersson.se/moment55/uploads/thumb_DSC_0050.JPG</link><br><pubdate> Uppladdad: 2016-02-17 07:24:00</pubdate>
</item>
<hr><br><item>
<description>Uppladdad av: doggepe</description>
<br><img src="uploads/thumb_etihad.jpg"/>
<br><description> Bildbeskrivning: Etihad A330-300</description>
<br><link> http://douglaspettersson.se/moment55/uploads/thumb_etihad.jpg</link><br><pubdate> Uppladdad: 2016-03-02 19:30:54</pubdate>
</item>
<hr><br><item>
<description>Uppladdad av: doggepe</description>
<br><img src="uploads/thumb_s105.jpg"/>
<br><description> Bildbeskrivning: Saab 105</description>
<br><link> http://douglaspettersson.se/moment55/uploads/thumb_s105.jpg</link><br><pubdate> Uppladdad: 2016-03-02 19:31:26</pubdate>
</item>
<hr><br><item>
<description>Uppladdad av: doggepe</description>
<br><img src="uploads/thumb_italia.jpg"/>
<br><description> Bildbeskrivning: Disko</description>
<br><link> http://douglaspettersson.se/moment55/uploads/thumb_italia.jpg</link><br><pubdate> Uppladdad: 2016-03-08 13:20:43</pubdate>
</item>
<hr><br><item>
<description>Uppladdad av: doggepe</description>
<br><img src="uploads/thumb_porscheLogin.jpg"/>
<br><description> Bildbeskrivning: pratzny</description>
<br><link> http://douglaspettersson.se/moment55/uploads/thumb_porscheLogin.jpg</link><br><pubdate> Uppladdad: 2016-03-08 13:21:08</pubdate>
</item>
<hr><br>Tillbaka till webbplatsen
</channel>
</rss>
What qre the br tags? They don`t belong in RSS feeds!
Related
I'm trying to port my project from Qt5 to Qt6.
My problem is that UIC generated code looks like this:
QObject::connect(SelectHome, &QToolButton::clicked, toQPSQLSettingUI, qOverload<>(&QWidget::selectHome));
MSVC2019 compilations fails with:
ui_toqpsqlsettingui.h(74,101): error C2039: 'selectHome': is not a member of 'QWidget'
C:\Qt\6.0.4\msvc2019_64\include\QtWidgets\qcompleter.h(57): message : see declaration of 'QWidget'
C:\Users\I542264\source\repos\tora\src\ui_toqpsqlsettingui.h(74,1): error C2065: 'selectHome': undeclared identifier
See the target is method is QWidget::selectHome, so IMHO MSVC is right: QWidget does not have method selectHome. But target should be sub-class method toQPSQLSettingUI::selectHome
Complete source is here. Initially created for Qt2, migrated to Qt3=>Qt4=>Q5.
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>toQPSQLSettingUI</class>
<widget class="QWidget" name="toQPSQLSettingUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>517</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Form1</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="PGSQL_HOME"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="TextLabel6_2_2_2">
<property name="toolTip">
<string>The default dateformat to use when querying the database.</string>
</property>
<property name="text">
<string>PgSQL home</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>PGSQL_HOME</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QToolButton" name="SelectHome">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>PGSQL_HOME</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>SelectHome</sender>
<signal>clicked()</signal>
<receiver>toQPSQLSettingUI</receiver>
<slot>selectHome()</slot>
<hints>
<hint type="sourcelabel">
<x>606</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>314</x>
<y>258</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<signal>signal1()</signal>
</slots>
</ui>
How can I change the grid position of the labels "Bottom left" and "bottom right" within the QTDesigner?
In this case, I would like edit the column number of "Bottom left" (from 1 to 0) and "bottom right" (from 0 to 1) without changing the XML manually, as shown in the snippet from the *.ui file.
If I'm using drag and drop, I'am facing some issues with additional columns or rows and in the end, I have to change the *.ui file manually again.
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="top_left">
<property name="text">
<string>Top left</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="top_right">
<property name="text">
<string>Top right</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="bottom_right">
<property name="text">
<string>bottom right</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="bottom_left">
<property name="text">
<string>bottom left</string>
</property>
</widget>
</item>
</layout>
</widget>
I am designing a simple GUI to do something and at a very early stage I find that QT is not behaving as I am expecting it to. I designed the ui file in QT Design and it looks like this:
However when I execute the python code and call the application, the object positions are all changed. I have tried converting the ui file to python file and the importing the ui file directly as well. But this has not changed the behavior.
Here is the code:
from __future__ import (
unicode_literals,
print_function,
division,
absolute_import
)
from PyQt4 import QtGui, QtCore, uic
from PyQt4.QtCore import QTime
from PyQt4.QtGui import QApplication
import main_gui
# class MyGUI(QtGui.QMainWindow, main_gui.Ui_MainWindow):
class MyGUI(QtGui.QMainWindow):
"""
The main class to execute the application
"""
def __init__(self, parent=None):
super(MyGUI, self).__init__(parent)
uic.loadUi('main_gui.ui', self)
# self.setupUi(self)
# self.showMaximized()
def main():
"""
But first we'll need to initialize that class on our code startup,
we'll handle the class instance creation and other stuff in our main()
function:
:return: Nothing
"""
app = QtGui.QApplication([])
form = MyGUI()
form.show()
app.exec()
if __name__ == '__main__':
main()
The output looks like this:
Here is a screen shot of my designer:
What am I doing wrong?
EDIT:
Upon request, I am attaching main.ui file. Here it is:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1143</width>
<height>865</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="Line" name="line_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="title">
<property name="minimumSize">
<size>
<width>200</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<pointsize>20</pointsize>
</font>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="text">
<string>Title</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item alignment="Qt::AlignLeft|Qt::AlignVCenter">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>24</pointsize>
</font>
</property>
<property name="text">
<string>SN</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QLabel" name="sn">
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="text">
<string>PPPPPPPPPPPPPPGSDB1YYDDDHHMMSS</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item alignment="Qt::AlignLeft|Qt::AlignVCenter">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="text">
<string>Part Status</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QLabel" name="part_status">
<property name="font">
<font>
<pointsize>26</pointsize>
</font>
</property>
<property name="text">
<string>NA</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item alignment="Qt::AlignLeft|Qt::AlignVCenter">
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="text">
<string>Tester Status</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QLabel" name="tester_status">
<property name="font">
<font>
<pointsize>28</pointsize>
</font>
</property>
<property name="text">
<string>DOWN</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item alignment="Qt::AlignLeft|Qt::AlignVCenter">
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="text">
<string>IP Address</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QLabel" name="ip_address">
<property name="font">
<font>
<pointsize>24</pointsize>
</font>
</property>
<property name="text">
<string>NA</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="test_box"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1143</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
Consider the following XML file:
<?xml version="1.0" encoding="utf-8"?>
<warehouse>
<cat id="computer">
<item>
<SN>1</SN>
<name>Toshiba</name>
<quantity>12</quantity>
<description>CPU: CORE I5 RAM: 3 GB HD: 512 GB</description>
<price>400 USD</price>
</item>
<item>
<SN>2</SN>
<name>Dell</name>
<quantity>14</quantity>
<description>CPU: CORE I5 RAM: 3 GB HD: 512 GB</description>
<price>300 USD</price>
</item>
<item>
<SN>3</SN>
<name>Dell</name>
<quantity>14</quantity>
<description>CPU: CORE I5 RAM: 3 GB HD: 512 GB</description>
<price>300 USD</price>
</item>
<item>
<SN>5</SN>
<name>Dell</name>
<quantity>14</quantity>
<description>CPU: CORE I5 RAM: 3 GB HD: 512 GB</description>
<price>300 USD</price>
</item>
<item>
<SN>6</SN>
<name>Dell</name>
<quantity>14</quantity>
<description>CPU: CORE I5 RAM: 3 GB HD: 512 GB</description>
<price>300 USD</price>
</item>
<item>
<SN>8</SN>
<name>Toshiba</name>
<quantity>13</quantity>
<description>CPU: CORE I5 RAM: 5 GB HD: 512 GB3</description>
<price>400 USD</price>
</item>
<item>
<SN>9</SN>
<name>Toshiba</name>
<quantity>13</quantity>
<description>CPU: CORE I5 RAM: 5 GB HD: 512 GB3</description>
<price>400 USD</price>
</item>
<item>
<SN>dsfdSF</SN>
<name>fsdfsD</name>
<quantity>dsfdSFS</quantity>
<description>FSDFS</description>
<price>FSDFSD</price>
</item>
<item>
<SN>dsfdSF</SN>
<name>fsdfsD</name>
<quantity>dsfdSFS</quantity>
<description>FSDFS</description>
<price>FSDFSD</price>
</item>
<item>
<SN>alia</SN>
<name>alia</name>
<quantity>alia</quantity>
<description>alia</description>
<price>alia</price>
</item>
</cat>
<cat id="Stationery">
<item>
<SN> 1 </SN>
<name>note books</name>
<quantity>250</quantity>
<description>Caterpiller</description>
<price>5 USD</price>
</item>
<item>
<SN> 2 </SN>
<name> pencils </name>
<quantity> 300 </quantity>
<description> Caterpiller </description>
<price> 2 USD </price>
</item>
<item>
<SN> 3 </SN>
<name> note books </name>
<quantity> 250 </quantity>
<description> Caterpiller </description>
<price> 5 USD </price>
</item>
<item>
<SN>4</SN>
<name>pencils</name>
<quantity>45</quantity>
<description>Pilot</description>
<price>4 USD</price>
</item>
<item>
<SN>5</SN>
<name>pencils</name>
<quantity>45</quantity>
<description>Pilot</description>
<price>4 USD</price>
</item>
<item>
<SN>6</SN>
<name>pencils</name>
<quantity>45</quantity>
<description>Pilot</description>
<price>4 USD</price>
</item>
<item>
<SN>7</SN>
<name>sdfsdfsdfsdfsd</name>
<quantity>sdfsdf</quantity>
<description>dsfsdfs</description>
<price>sdfsdf</price>
</item>
<item>
<SN>8</SN>
<name>pencils</name>
<quantity>45</quantity>
<description>Pilot</description>
<price>4 USD</price>
</item>
<item>
<SN>9</SN>
<name>books</name>
<quantity>250</quantity>
<description>chinses</description>
<price>3 USD</price>
</item>
<item>
<SN>alia</SN>
<name>alia</name>
<quantity>alia</quantity>
<description>alia</description>
<price>alia</price>
</item>
</cat>
<cat id="Furniture">
<item>
<SN> 1 </SN>
<name>dasd</name>
<quantity>asdasd</quantity>
<description>das</description>
<price>dasd</price>
</item>
<item>
<SN> 2 </SN>
<name> chairs </name>
<quantity> 18 </quantity>
<description> European Type</description>
<price> 150 USD </price>
</item>
<item>
<SN>3</SN>
<name>Tabels</name>
<quantity>12</quantity>
<description>European Type</description>
<price>50 USD</price>
</item>
<item>
<SN>4</SN>
<name>Tabels</name>
<quantity>12</quantity>
<description>European Type</description>
<price>50 USD</price>
</item>
<item>
<SN>5</SN>
<name>Tabels</name>
<quantity>12</quantity>
<description>European Type</description>
<price>50 USD</price>
</item>
<item>
<SN>6</SN>
<name>Tabels</name>
<quantity>12</quantity>
<description>European Type</description>
<price>50 USD</price>
</item>
<item>
<SN>7</SN>
<name>Tabels</name>
<quantity>12</quantity>
<description>European Type</description>
<price>50 USD</price>
</item>
<item>
<SN>8</SN>
<name>Tabels</name>
<quantity>12</quantity>
<description>European Type</description>
<price>50 USD</price>
</item>
<item>
<SN>alia</SN>
<name>alia</name>
<quantity>alia</quantity>
<description>alia</description>
<price>alia</price>
</item>
</cat>
</warehouse>
I need to create a drop down list. The drop down list has to display all the values of <SN> where <cat id="computer"> only.
How can this be done using LINQ or DataView or Xpath?
How about this?
XmlDocument doc = new XmlDocument();
doc.Load(#"~/XML/XML.xml");
var nodes = doc.SelectNodes("warehouse/cat[#id='computer']/item/SN");
myDropDown.DataTextField = "InnerText";
myDropDown.DataValueField = "InnerText";
//now bind the dropdownlist to the dataview
myDropDown.DataSource = nodes;
myDropDown.DataBind();
Load the xml into an XElement:
var xml = XElement.Load("test.xml");
Execute XPath to select the SN elements in the cats with id computer: (+ put them in a list)
var snValues = xml.XPathSelectElements("//cat[#id='computer']/item/SN")
.Select(x => x.Value).ToList();
Required usings:
using System.Linq;
using System.Xml.Linq;
using System.Xml.XPath;
I'm trying to make a mapping with this xml:
<rootxml>
<documents>
<document>
<iddoc>1</iddoc>
<total_price>1000</total_price>
</document>
</documents>
<items>
<item>
<iddoc>1</iddoc>
<iditem>1</iditem>
<quantity>1</quantity>
<price>800</price>
</item>
<item>
<iddoc>1</iddoc>
<iditem>2</iditem>
<quantity>1</quantity>
<price>200</price>
</item>
</items>
<taxes>
<tax>
<iddoc>1</iddoc>
<iditem>1</iditem>
<idtax>1000</idtax>
<value>123.90</value>
<tax>
<tax>
<iddoc>1</iddoc>
<iditem>2</iditem>
<idtax>1000</idtax>
<value>34.13</value>
<tax>
</taxes>
</rootxml>
to this one:
<resultxml>
<documento>
<iddoc>1</iddoc>
<total_price>1000</total_price>
<items>
<item>
<iddoc>1</iddoc>
<iditem>1</iditem>
<quantity>1</quantity>
<price>800</price>
<taxes>
<idtax>1000</idtax>
<value>123.90</value>
</taxes>
</item>
<item>
<iddoc>1</iddoc>
<iditem>2</iditem>
<quantity>1</quantity>
<price>200</price>
<taxes>
<tax>
<idtax>1000</idtax>
<value>34.13</value>
<tax>
</taxes>
</item>
</items>
</documento>
</resultxml>
I can't find out how to solve this. Although the original xml document can have several documents it will always have one, so I have to merge the items into it and taxes into its respective item.
Thank you
I think you'll have to write a chunk of custom-XSLT. Loop through items/item and then build an xpath to taxes/tax[where iditem=$itemId]. The trick is to get the first itemId into the variable.
Sorry, I have limited time right now, cannot create a full working demo for you.
Here's the related issue I had a while back:
http://www.stylusstudio.com/ssdn/default.asp?action=9&fid=48&read=7896
Neal Walters