Unicorn XML Toolkit
Version 1.50.00

Namespace Sax
Class CAttributes

class CAttributes: public CInterface {
public:
    CAttributes();
    virtual ~CAttributes();
public:
    virtual int GetLength() = 0;
    virtual const WCHAR *GetUri(int nIndex) = 0;
    virtual const WCHAR *GetLocalName(int nIndex) = 0;
    virtual const WCHAR *GetQName(int nIndex) = 0;
    virtual const WCHAR *GetType(int nIndex) = 0;
    virtual const WCHAR *GetValue(int nIndex) = 0;
    virtual int GetIndex(
        const WCHAR *pszUri, 
        const WCHAR *pszLocalName) = 0;
    virtual int GetIndex(const WCHAR *pszQName) = 0;
    virtual const WCHAR *GetType(
        const WCHAR *pszUri,
        const WCHAR *pszLocalName) = 0;
    virtual const WCHAR *GetType(const WCHAR *pszQName) = 0;
    virtual const WCHAR *GetValue(
        const WCHAR *pszUri,
        const WCHAR *pszLocalName) = 0;
    virtual const WCHAR *GetValue(const WCHAR *pszQName) = 0;
    };
typedef XInterface<CAttributes> XAttributes;

The abstract interface for lists of XML attributes.

This interface allows access to a list of attributes in three different ways:

The list will not contain attributes that were declared #IMPLIED but not specified in the start tag. It will also not contain attributes used as namespace declarations ( xmlns* ) unless the http://xml.org/sax/features/namespace-prefixes feature is set to true (it is false by default).

If the namespace-prefixes feature (see above) is false , access by qualified name may not be available; if the http://xml.org/sax/features/namespaces feature is false , access by namespace-qualified names may not be available.

The order of attributes in the list is unspecified, and will vary from implementation to implementation.

Since:
1.00.00
Version:
1.50.00
Author:
C++ interfaces by Alexey Gokhberg; based on the original SAX2 specification by David Megginson
Constructor/Destructor Summary
CAttributes ();
����������Constructs the list of attributes.
~CAttributes ();
����������Destroys the list of attributes.

Function Summary
int GetLength ();
����������Gets the number of attributes in this list.
const�WCHAR�* GetUri (int nIndex);
����������Looks up an attribute's namespace URI by index.
const�WCHAR�* GetLocalName (int nIndex);
����������Looks up an attribute's local name by index.
const�WCHAR�* GetQName (int nIndex);
����������Looks up an attribute's XML 1.0 qualified name by index.
const�WCHAR�* GetType (int nIndex);
����������Looks up an attribute's type by index.
const�WCHAR�* GetValue (int nIndex);
����������Looks up an attribute's value by index.
int GetIndex (const WCHAR *pszUri, const WCHAR *pszLocalName);
����������Looks up the index of an attribute by namespace name.
int GetIndex (const WCHAR *pszQName);
����������Looks up the index of an attribute by XML 1.0 qualified name.
const�WCHAR�* GetType (const WCHAR *pszUri, const WCHAR *pszLocalName);
����������Looks up an attribute's type by namespace name.
const�WCHAR�* GetType (const WCHAR *pszQName);
����������Looks up an attribute's type by XML 1.0 qualified name.
const�WCHAR�* GetValue (const WCHAR *pszUri, const WCHAR *pszLocalName);
����������Looks up an attribute's value by namespace name.
const�WCHAR�* GetValue (const WCHAR *pszQName);
����������Looks up an attribute's value by XML 1.0 qualified name.

Constructor/Destructor Detail

CAttributes

CAttributes();

Constructs the list of attributes.

~CAttributes

virtual ~CAttributes();

Destroys the list of attributes.

Function Detail

GetLength

virtual int GetLength() = 0;

Gets the number of attributes in this list.

Once you know the number of attributes, you can iterate through the list.

Returns:
the number of attributes in this list

GetUri

virtual const WCHAR *GetUri(int nIndex) = 0;

Looks up an attribute's namespace URI by index.

Parameters:
nIndex - the attribute index (zero-based)
Returns:
the namespace URI, or the empty string if none is available or if the index is out of range

GetLocalName

virtual const WCHAR *GetLocalName(int nIndex) = 0;

Looks up an attribute's local name by index.

Parameters:
nIndex - the attribute index (zero-based)
Returns:
the local name, or the empty string if namespace processing is not being performed or if the index is out of range

GetQName

virtual const WCHAR *GetQName(int nIndex) = 0;

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

Parameters:
nIndex - the attribute index (zero-based)
Returns:
the XML 1.0 qualified name, or the empty string if none is available or if the index is out of range

GetType

virtual const WCHAR *GetType(int nIndex) = 0;

Looks up an attribute's type by index.

The attribute type is one of the strings "CDATA" , "ID" , "IDREF" , "IDREFS" , "NMTOKEN" , "NMTOKENS" , "ENTITY" , "ENTITIES" , or "NOTATION" (always in upper case).

If the reader has not read a declaration for the attribute, or if the reader does not report attribute types, then it must return the value "CDATA" as stated in the XML 1.0 Recommentation (clause 3.3.3, "Attribute-Value Normalization").

For an enumerated attribute that is not a notation, the reader will report the type as "NMTOKEN" .

Parameters:
nIndex - the attribute index (zero-based)
Returns:
the attribute's type as a string, or the empty string if the index is out of range

GetValue

virtual const WCHAR *GetValue(int nIndex) = 0;

Looks up an attribute's value by index.

If the attribute value is a list of tokens ( IDREFS , ENTITIES , or NMTOKENS ), the tokens will be concatenated into a single string with each token separated by a single space.

Parameters:
nIndex - the attribute index (zero-based)
Returns:
the attribute's value as a string, or the empty string if the index is out of range

GetIndex

virtual int GetIndex(
    const WCHAR *pszUri, 
    const WCHAR *pszLocalName) = 0;

Looks up the index of an attribute by namespace name.

Parameters:
pszUri - the namespace URI, or the empty string if the name has no namespace URI
pszLocalName - the attribute's local name
Returns:
the index of the attribute, or -1 if it does not appear in the list

GetIndex

virtual int GetIndex(const WCHAR *pszQName) = 0;

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

Parameters:
pszQName - the qualified (prefixed) name
Returns:
the index of the attribute, or -1 if it does not appear in the list

GetType

virtual const WCHAR *GetType(
    const WCHAR *pszUri,
    const WCHAR *pszLocalName) = 0;

Looks up an attribute's type by namespace name.

Parameters:
pszUri - the namespace URI, or the empty string if the name has no namespace URI
pszLocalName - the attribute's local name
Returns:
the attribute type as a string, or the empty string if the attribute is not in the list or if namespace processing is not being performed

GetType

virtual const WCHAR *GetType(const WCHAR *pszQName) = 0;

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

Parameters:
pszQName - the qualified (prefixed) name
Returns:
the attribute type as a string, or the empty string if the attribute is not in the list or if qualified names are not available

GetValue

virtual const WCHAR *GetValue(
    const WCHAR *pszUri,
    const WCHAR *pszLocalName) = 0;

Looks up an attribute's value by namespace name.

Parameters:
pszUri - the namespace URI, or the empty string if the name has no namespace URI
pszLocalName - the attribute's local name
Returns:
the attribute value as a string, or the empty string if the attribute is not in the list

GetValue

virtual const WCHAR *GetValue(const WCHAR *pszQName) = 0;

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

Parameters:
pszQName - the qualified (prefixed) name
Returns:
the attribute value as a string, or the empty string if the attribute is not in the list or if qualified names are not available

Unicorn XML Toolkit
Version 1.50.00


This document was created using Unicorn DOC++.

Copyright 1999-2001 Unicorn Enterprises SA.
All Rights Reserved.