本文整理汇总了C++中QXmlAttributes::uri方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlAttributes::uri方法的具体用法?C++ QXmlAttributes::uri怎么用?C++ QXmlAttributes::uri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlAttributes
的用法示例。
在下文中一共展示了QXmlAttributes::uri方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
{
if(depth == 0) {
Parser::Event *e = new Parser::Event;
QXmlAttributes a;
for(int n = 0; n < atts.length(); ++n) {
QString uri = atts.uri(n);
QString ln = atts.localName(n);
if(a.index(uri, ln) == -1)
a.append(atts.qName(n), uri, ln, atts.value(n));
}
e->setDocumentOpen(namespaceURI, localName, qName, a, nsnames, nsvalues);
nsnames.clear();
nsvalues.clear();
e->setActualString(in->lastString());
in->resetLastData();
eventList.append(e);
in->pause(true);
}
else {
QDomElement e = doc->createElementNS(namespaceURI, qName);
for(int n = 0; n < atts.length(); ++n) {
QString uri = atts.uri(n);
QString ln = atts.localName(n);
bool have;
if(!uri.isEmpty()) {
have = e.hasAttributeNS(uri, ln);
if(qt_bug_have)
have = !have;
}
else
have = e.hasAttribute(ln);
if(!have)
e.setAttributeNS(uri, atts.qName(n), atts.value(n));
}
if(depth == 1) {
elem = e;
current = e;
}
else {
current.appendChild(e);
current = e;
}
}
++depth;
return true;
}
示例2: startElement
bool StructureParser::startElement( const QString& namespaceURI,
const QString& ,
const QString& qName,
const QXmlAttributes& attributes)
{
QTreeWidgetItem * element;
if (!stack.isEmpty())
{
QTreeWidgetItem *lastChild = stack.top().firstChild();
if ( lastChild )
{
while ( lastChild->nextSibling() )
lastChild = lastChild->nextSibling();
}
element = new QTreeWidgetItem( stack.top(), lastChild, qName, namespaceURI );
}
else
{
element = new QTreeWidgetItem( table, qName, namespaceURI );
}
stack.push( element );
element->setOpen( TRUE );
if ( attributes.length() > 0 ) {
for ( int i = 0 ; i < attributes.length(); i++ ) {
new QTreeWidgetItem( element, attributes.qName(i), attributes.uri(i) );
}
}
return TRUE;
}
示例3: formatAttributes
QString ContentHandler::formatAttributes(const QXmlAttributes &atts)
{
QString result;
for (int i = 0, cnt = atts.count(); i < cnt; ++i) {
if (i != 0) result += ", ";
result += "{localName=\"" + escapeStr(atts.localName(i))
+ "\", qName=\"" + escapeStr(atts.qName(i))
+ "\", uri=\"" + escapeStr(atts.uri(i))
+ "\", type=\"" + escapeStr(atts.type(i))
+ "\", value=\"" + escapeStr(atts.value(i)) + "\"}";
}
return result;
}
示例4: startElement
bool TrackReader::startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts)
{
Q_UNUSED(qName)
const QString eName = myQName(namespaceURI, localName);
d->currentElements << eName;
rebuildElementPath();
const QString& ePath = d->currentElementPath;
if (ePath == QString::fromLatin1("gpx:gpx/gpx:trk/gpx:trkseg/gpx:trkpt"))
{
qreal lat = 0.0;
qreal lon = 0.0;
bool haveLat = false;
bool haveLon = false;
for (int i = 0; i < atts.count(); ++i)
{
const QString attName = myQName(atts.uri(i), atts.localName(i));
const QString attValue = atts.value(i);
if (attName == QString::fromLatin1("lat"))
{
lat = attValue.toDouble(&haveLat);
}
else if (attName == QString::fromLatin1("lon"))
{
lon = attValue.toDouble(&haveLon);
}
}
if (haveLat&&haveLon)
{
d->currentDataPoint.coordinates.setLatLon(lat, lon);
}
}
else if (ePath == QString::fromLatin1("gpx:gpx"))
{
d->verifyFoundGPXElement = true;
}
return true;
}
示例5: startElement
virtual bool startElement(const QString &namespaceURI, const QString &, const QString &qName, const QXmlAttributes &attrs)
{
kdDebug(26001) << "SVGFragmentSearcher::startElement, namespaceURI " << namespaceURI << ", qName " << qName << endl;
bool parse = m_result;
if(!parse)
{
int pos = attrs.index("id");
if(pos > -1 && attrs.value(pos) == m_id)
parse = true;
}
if(parse)
{
DOM::Element impl = static_cast<DOM::Document *>(m_doc)->createElementNS(namespaceURI, qName);
SVGElementImpl *newElement = SVGDocumentImpl::createElement(qName, impl, m_doc);
newElement->setViewportElement(m_doc->rootElement());
if(m_currentNode)
m_currentNode->appendChild(*newElement);
else
m_result = newElement;
QXmlAttributes newAttrs;
for(int i = 0; i < attrs.count(); i++)
{
QString name = attrs.localName(i);
QString value = attrs.value(i);
if(name == "id")
{
value = "@[email protected]" + m_url.prettyURL() + "@" + value;
m_idMap[value] = newElement;
}
else
if(name == "href")
{
value.stripWhiteSpace();
if(value.startsWith("#"))
{
value.remove(0, 1);
// Convert the id to its mangled version.
QString id = "@[email protected]" + m_url.prettyURL() + "@" + value;
if(m_idMap.contains(id))
{
// This is a local reference to an element within the fragment.
// Just convert the href.
value = id;
}
else
{
// This is a local reference to an id outside of the fragment.
// Change it into an absolute href.
value = m_url.prettyURL() + "#" + value;
}
}
}
newAttrs.append(attrs.qName(i), attrs.uri(i), attrs.localName(i), value);
}
newElement->setAttributes(newAttrs);
m_currentNode = newElement;
}
return true;
}