|
Unicorn XML Toolkit Version 1.00.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |
class CAttributesImpl: public CAttributes { public: CAttributesImpl(); CAttributesImpl(const XAttributes &pAtts); ~CAttributesImpl(); public: int GetLength(); CString GetUri(int nIndex); CString GetLocalName(int nIndex); CString GetQName(int nIndex); CString GetType(int nIndex); CString GetValue(int nIndex); int GetIndex( const CString &strUri, const CString &strLocalName); int GetIndex(const CString &strQName); CString GetType( const CString &strUri, const CString &strLocalName); CString GetType(const CString &strQName); CString GetValue( const CString &strUri, const CString &strLocalName); CString GetValue(const CString &strQName); public: void Clear(); void SetAttributes(const XAttributes &pAtts); void AddAttribute( const CString &strUri, const CString &strLocalName, const CString &strQName, const CString &strType, const CString &strValue); void SetAttribute( int nIndex, const CString &strUri, const CString &strLocalName, const CString &strQName, const CString &strType, const CString &strValue); void RemoveAttribute(int nIndex); void SetUri(int nIndex, const CString &strUri); void SetLocalName(int nIndex, const CString &strLocalName); void SetQName(int nIndex, const CString &strQName); void SetType(int nIndex, const CString &strType); void SetValue(int nIndex, const CString &strValue); };
The default implementation of lists of XML attributes.
This class provides the default implementation to the interface
specified by the
CAttributes
class, with the addition
of manipulators so that lists of attributes
can be modified or reused.
There are two typical uses of this class:
CAttributes
object
in a
CContentHandler::StartElement
event; orCAttributes
object in a SAX2 reader or filter.
CAttributes
Constructor/Destructor Summary | |
CAttributesImpl
();
����������Constructs the empty list of attributes. |
|
CAttributesImpl
(const XAttributes &pAtts);
����������Constructs the list of attributes, copying an existing CAttributes
object. |
|
~CAttributesImpl
();
����������Destroys the list of attributes. |
Function Summary | |
int
|
GetLength
();
����������Gets the number of attributes in this list. |
CString
|
GetUri
(int nIndex);
����������Looks up an attribute's namespace URI by index. |
CString
|
GetLocalName
(int nIndex);
����������Looks up an attribute's local name by index. |
CString
|
GetQName
(int nIndex);
����������Looks up an attribute's XML 1.0 qualified name by index. |
CString
|
GetType
(int nIndex);
����������Looks up an attribute's type by index. |
CString
|
GetValue
(int nIndex);
����������Looks up an attribute's value by index. |
int
|
GetIndex
(const CString &strUri, const CString &strLocalName);
����������Looks up the index of an attribute by namespace name. |
int
|
GetIndex
(const CString &strQName);
����������Looks up the index of an attribute by XML 1.0 qualified name. |
CString
|
GetType
(const CString &strUri, const CString &strLocalName);
����������Looks up an attribute's type by namespace name. |
CString
|
GetType
(const CString &strQName);
����������Looks up an attribute's type by XML 1.0 qualified name. |
CString
|
GetValue
(const CString &strUri, const CString &strLocalName);
����������Looks up an attribute's value by namespace name. |
CString
|
GetValue
(const CString &strQName);
����������Looks up an attribute's value by XML 1.0 qualified name. |
void
|
Clear
();
����������Clears the attribute list for reuse. |
void
|
SetAttributes
(const XAttributes &pAtts);
����������Copies an entire attribute list. |
void
|
AddAttribute
(const CString &strUri, const CString &strLocalName, const CString &strQName, const CString &strType, const CString &strValue);
����������Adds the attribute to the end of the list. |
void
|
SetAttribute
(int nIndex, const CString &strUri, const CString &strLocalName, const CString &strQName, const CString &strType, const CString &strValue);
����������Sets an attribute in the list. |
void
|
RemoveAttribute
(int nIndex);
����������Removes an attribute from this list. |
void
|
SetUri
(int nIndex, const CString &strUri);
����������Sets the namespace URI of a specific attribute. |
void
|
SetLocalName
(int nIndex, const CString &strLocalName);
����������Sets the local name of a specific attribute. |
void
|
SetQName
(int nIndex, const CString &strQName);
����������Sets the qualified name of a specific attribute. |
void
|
SetType
(int nIndex, const CString &strType);
����������Sets the type of a specific attribute. |
void
|
SetValue
(int nIndex, const CString &strValue);
����������Sets the value of a specific attribute. |
Constructor/Destructor Detail |
CAttributesImpl();
Constructs the empty list of attributes.
CAttributesImpl(const XAttributes &pAtts);
Constructs the list of attributes, copying an existing
CAttributes
object.
This constructor might be especially useful inside
a
CContentHandler::StartElement
event.
pAtts
- the existing list of attributes~CAttributesImpl();
Destroys the list of attributes.
Function Detail |
int GetLength();
Gets the number of attributes in this list.
Once you know the number of attributes, you can iterate through the list.
CString GetUri(int nIndex);
Looks up an attribute's namespace URI by index.
nIndex
- the attribute index (zero-based)CString GetLocalName(int nIndex);
Looks up an attribute's local name by index.
nIndex
- the attribute index (zero-based)CString GetQName(int nIndex);
Looks up an attribute's XML 1.0 qualified name by index.
nIndex
- the attribute index (zero-based)CString GetType(int nIndex);
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"
.
nIndex
- the attribute index (zero-based)CString GetValue(int nIndex);
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.
nIndex
- the attribute index (zero-based)int GetIndex( const CString &strUri, const CString &strLocalName);
Looks up the index of an attribute by namespace name.
strUri
- the namespace URI, or the empty string if
the name has no namespace URIstrLocalName
- the attribute's local name-1
if it does not
appear in the listint GetIndex(const CString &strQName);
Looks up the index of an attribute by XML 1.0 qualified name.
strQName
- the qualified (prefixed) name-1
if it does not
appear in the listCString GetType( const CString &strUri, const CString &strLocalName);
Looks up an attribute's type by namespace name.
strUri
- the namespace URI, or the empty string if
the name has no namespace URIstrLocalName
- the attribute's local nameCString GetType(const CString &strQName);
Looks up an attribute's type by XML 1.0 qualified name.
strQName
- the qualified (prefixed) nameCString GetValue( const CString &strUri, const CString &strLocalName);
Looks up an attribute's value by namespace name.
strUri
- the namespace URI, or the empty string if
the name has no namespace URIstrLocalName
- the attribute's local nameCString GetValue(const CString &strQName);
Looks up an attribute's value by XML 1.0 qualified name.
strQName
- the qualified (prefixed) namevoid Clear();
Clears the attribute list for reuse.
void SetAttributes(const XAttributes &pAtts);
Copies an entire attribute list.
pAtts
- the attribute list to copyvoid AddAttribute( const CString &strUri, const CString &strLocalName, const CString &strQName, const CString &strType, const CString &strValue);
Adds the attribute to the end of the list.
strUri
- the namespace URI, or the empty string if
none is available or namespace processing is not
being performedstrLocalName
- the local name, or the empty string if
namespace processing is not being performedstrQName
- the qualified (prefixed) name, or the empty string
if qualified names are not availablestrType
- the attribute type as a stringstrValue
- the attribute valuevoid SetAttribute( int nIndex, const CString &strUri, const CString &strLocalName, const CString &strQName, const CString &strType, const CString &strValue);
Sets an attribute in the list.
nIndex
- the index of the attribute (zero-based)strUri
- the namespace URI, or the empty string if
none is available or namespace processing is not
being performedstrLocalName
- the local name, or the empty string if
namespace processing is not being performedstrQName
- the qualified name, or the empty string
if qualified names are not availablestrType
- the attribute type as a stringstrValue
- the attribute valuevoid RemoveAttribute(int nIndex);
Removes an attribute from this list.
nIndex
- the index of the attribute (zero-based)void SetUri(int nIndex, const CString &strUri);
Sets the namespace URI of a specific attribute.
nIndex
- the index of the attribute (zero-based)strUri
- the attribute's namespace URI, or the empty
string for nonevoid SetLocalName(int nIndex, const CString &strLocalName);
Sets the local name of a specific attribute.
nIndex
- the index of the attribute (zero-based)strLocalName
- the attribute's local name, or the empty
string for nonevoid SetQName(int nIndex, const CString &strQName);
Sets the qualified name of a specific attribute.
nIndex
- the index of the attribute (zero-based)strLocalName
- the attribute's qualified name, or the empty
string for nonevoid SetType(int nIndex, const CString &strType);
Sets the type of a specific attribute.
nIndex
- the index of the attribute (zero-based)strType
- the attribute's typevoid SetValue(int nIndex, const CString &strValue);
Sets the value of a specific attribute.
nIndex
- the index of the attribute (zero-based)strType
- the attribute's value
|
Unicorn XML Toolkit Version 1.00.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |