Public Member Functions | Private Attributes | Friends | List of all members
QXmlAttributes Class Reference

The QXmlAttributes class provides XML attributes. More...

#include <qxml.h>

Public Member Functions

 QXmlAttributes ()
 
virtual ~QXmlAttributes ()
 
int index (const QString &qName) const
 
int index (const QString &uri, const QString &localPart) const
 
int length () const
 
QString localName (int index) const
 
QString qName (int index) const
 
QString uri (int index) const
 
QString type (int index) const
 
QString type (const QString &qName) const
 
QString type (const QString &uri, const QString &localName) const
 
QString value (int index) const
 
QString value (const QString &qName) const
 
QString value (const QString &uri, const QString &localName) const
 

Private Attributes

QStringList qnameList
 
QStringList uriList
 
QStringList localnameList
 
QStringList valueList
 

Friends

class QXmlSimpleReader
 

Detailed Description

The QXmlAttributes class provides XML attributes.

XML

If attributes are reported by QXmlContentHandler::startElement() this class is used to pass the attribute values. It provides you with different functions to access the attribute names and values.

Definition at line 128 of file qxml.h.

Constructor & Destructor Documentation

QXmlAttributes::QXmlAttributes ( )
inline

Constructs an empty attribute list.

Definition at line 131 of file qxml.h.

131 {}
QXmlAttributes::~QXmlAttributes ( )
inlinevirtual

Destructs attributes.

Definition at line 132 of file qxml.h.

132 {}

Member Function Documentation

int QXmlAttributes::index ( const QString qName) const

Look up the index of an attribute by an XML 1.0 qualified name.

Returns the index of the attribute (starting with 0) or -1 if it wasn't found.

See also the namespace description.

Definition at line 563 of file qxml.cpp.

564 {
565  return qnameList.findIndex( qName );
566 }
QStringList qnameList
Definition: qxml.h:148
int findIndex(const T &x) const
Definition: qvaluelist.h:391
int QXmlAttributes::index ( const QString uri,
const QString localPart 
) const

Looks up the index of an attribute by a namespace name.

uri specifies the namespace URI, or the empty string if the name has no namespace URI. localPart specifies the attribute's local name.

Returns the index of the attribute (starting with 0) or -1 if it wasn't found.

See also the namespace description.

Definition at line 579 of file qxml.cpp.

580 {
581  uint count = uriList.count();
582  for ( uint i=0; i<count; i++ ) {
583  if ( uriList[i] == uri && localnameList[i] == localPart )
584  return i;
585  }
586  return -1;
587 }
QStringList localnameList
Definition: qxml.h:150
QStringList uriList
Definition: qxml.h:149
uint count() const
Definition: qvaluelist.h:394
unsigned uint
Definition: qglobal.h:351
int QXmlAttributes::length ( ) const

Returns the number of attributes in the list.

Definition at line 592 of file qxml.cpp.

593 {
594  return valueList.count();
595 }
uint count() const
Definition: qvaluelist.h:394
QStringList valueList
Definition: qxml.h:151
QString QXmlAttributes::localName ( int  index) const

Looks up an attribute's local name by index (starting with 0).

See also the namespace description.

Definition at line 602 of file qxml.cpp.

603 {
604  return localnameList[index];
605 }
QStringList localnameList
Definition: qxml.h:150
int index(const QString &qName) const
Definition: qxml.cpp:563
QString QXmlAttributes::qName ( int  index) const

Looks up an attribute's XML 1.0 qualified name by index (starting with 0).

See also the namespace description.

Definition at line 612 of file qxml.cpp.

613 {
614  return qnameList[index];
615 }
QStringList qnameList
Definition: qxml.h:148
int index(const QString &qName) const
Definition: qxml.cpp:563
QString QXmlAttributes::type ( int  index) const

Looks up an attribute's type by index (starting with 0).

At the moment only 'CDATA' is returned.

Definition at line 632 of file qxml.cpp.

633 {
634  return "CDATA";
635 }
QString QXmlAttributes::type ( const QString qName) const

Looks up an attribute's type by XML 1.0 qualified name.

At the moment only 'CDATA' is returned.

Definition at line 642 of file qxml.cpp.

643 {
644  return "CDATA";
645 }
QString QXmlAttributes::type ( const QString uri,
const QString localName 
) const

Looks up an attribute's type by namespace name.

The first parameter specifies the namespace URI, or the empty string if the name has no namespace URI. The second parameter specifies the attribute's local name.

At the moment only 'CDATA' is returned.

Definition at line 656 of file qxml.cpp.

657 {
658  return "CDATA";
659 }
QString QXmlAttributes::uri ( int  index) const

Looks up an attribute's namespace URI by index (starting with 0).

See also the namespace description.

Definition at line 622 of file qxml.cpp.

623 {
624  return uriList[index];
625 }
QStringList uriList
Definition: qxml.h:149
int index(const QString &qName) const
Definition: qxml.cpp:563
QString QXmlAttributes::value ( int  index) const

Looks up an attribute's value by index (starting with 0).

Definition at line 664 of file qxml.cpp.

665 {
666  return valueList[index];
667 }
int index(const QString &qName) const
Definition: qxml.cpp:563
QStringList valueList
Definition: qxml.h:151
QString QXmlAttributes::value ( const QString qName) const

Looks up an attribute's value by XML 1.0 qualified name.

See also the namespace description.

Definition at line 674 of file qxml.cpp.

675 {
676  int i = index( qName );
677  if ( i == -1 )
678  return QString::null;
679  return valueList[ i ];
680 }
int index(const QString &qName) const
Definition: qxml.cpp:563
static const Null null
Definition: qstring.h:376
QStringList valueList
Definition: qxml.h:151
QString QXmlAttributes::value ( const QString uri,
const QString localName 
) const

Looks up an attribute's value by namespace name.

uri specifies the namespace URI, or the empty string if the name has no namespace URI. localName specifies the attribute's local name.

See also the namespace description.

Definition at line 690 of file qxml.cpp.

691 {
692  int i = index( uri, localName );
693  if ( i == -1 )
694  return QString::null;
695  return valueList[ i ];
696 }
int index(const QString &qName) const
Definition: qxml.cpp:563
static const Null null
Definition: qstring.h:376
QStringList valueList
Definition: qxml.h:151

Friends And Related Function Documentation

friend class QXmlSimpleReader
friend

Definition at line 155 of file qxml.h.

Member Data Documentation

QStringList QXmlAttributes::localnameList
private

Definition at line 150 of file qxml.h.

QStringList QXmlAttributes::qnameList
private

Definition at line 148 of file qxml.h.

QStringList QXmlAttributes::uriList
private

Definition at line 149 of file qxml.h.

QStringList QXmlAttributes::valueList
private

Definition at line 151 of file qxml.h.


The documentation for this class was generated from the following files: