InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ISAXAttributeList Class Referenceabstract

#include <ISAXAttributeList.h>

Inheritance diagram for ISAXAttributeList:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ISAXATTRIBUTELIST }
 

Public Member Functions

virtual void Adopt (BIB_NAMESPACE::CAXEAttributeList attributes, ISAXDOMSerializerServices *owner)=0
 
virtual int32 GetLength () const =0
 
virtual void AttributeHandled (uint32 index)=0
 
virtual bool16 GetURI (uint32 index, WideString &uri) const =0
 
virtual bool16 GetLocalName (uint32 index, WideString &localName) const =0
 
virtual bool16 GetQName (uint32 index, WideString &qName) const =0
 
virtual bool16 GetType (uint32 index, WideString &attributeType) const =0
 
virtual bool16 GetValue (uint32 index, WideString &attributeValue) const =0
 
virtual bool16 GetIndex (const WideString &uri, const WideString &localPart, uint32 &index) const =0
 
virtual bool16 GetIndex (const WideString &qName, uint32 &index) const =0
 
virtual bool16 GetType (const WideString &uri, const WideString &localPart, WideString &attributeType) const =0
 
virtual bool16 GetType (const WideString &qName, WideString &attributeType) const =0
 
virtual bool16 GetValue (const WideString &uri, const WideString &localPart, WideString &attributeValue) const =0
 
virtual bool16 GetValue (const WideString &qName, WideString &attributeValue) const =0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

An InDesign friendly Wrapper for CAXEAttributeList. An instance of this class will be passed to ISaxContentHandler::StartElement.

Deliver a list of an element's attributes

The DOM serializer implements this interface and passes an instance as an argument of the startElement event. This class mimics the CAXEAttributes class so to make the interfaces of HAXEContentHandlerBase and HAXEDOMSerializerHandlerBase classes as similar as possible.

The instance provided is guaranteed to return valid results only during the scope of the startElement invocation. It is a reference to a live AXE DOM which could change. To save the attribute values for future use, the application must make a copy.

An attribute only includes traits that have been specified or defaulted: #IMPLIED attributes will not be included.

There are two ways for the application to obtain information from the CAXEAttributesList class. First, it can iterate through the entire list:


startElement(CAXEString& uri, CAXEString& localname,

    CAXEString& qname, CAXEAttributeList& attrs, 

    CAXENodeDOM& sourceNode ) {

  for (unsigned int i = 0; i < atts.getLength(); i++) {

    CAXEString qName, URI, local, type, value;

    if (!atts.getQName(i, qName)) ...

    if (!atts.getURI(i, URI)) ...

    if (!atts.getLocalName(i, local)) ...

    if (!atts.getType(i, type)) ...

    if (!atts.getValue(i, value)) ...

    [...]

  }

}

(Note: The result of getLength() will be zero if there are no attributes.)

As an alternative, the application can request the value or type of specific attributes by qualified name or by fully expanded name with namespace:


startElement(CAXEString& uri, CAXEString& localname,

CAXEString& qname, CAXEAttributeList& attrs, 

    CAXENodeDOM& sourceNode )

  CAXEString identifier;

  if (!atts.getValue("id", identifier)) ...

  CAXEString label;

  if (!atts.getValue("label", label)) ...

  [...]

}

Invalid Parameters

Unless otherwise indicated, it is an error to use an invalid container (IsValid() == false), or a NULL pointer, as a parameter to any function. In some instances, the requirement that a specific parameter must be valid is repeated in the commentary for the specific function. The lack of any indication in the commentary for the specific function should still be taken to mean that an invalid container or NULL pointer will result in a kAXEErrClientFault exception.

See Also
ISAXOMSerializerHandler::startElement

Member Function Documentation

virtual void ISAXAttributeList::Adopt (BIB_NAMESPACE::CAXEAttributeList attributes,
ISAXDOMSerializerServicesowner 
)
pure virtual

Adopt an instance of a CAXEAttributeList class provided by the serializer. This is not intended to by used by clients.

virtual void ISAXAttributeList::AttributeHandled (uint32 index)
pure virtual

Mark an attribute as handled so that other attribute handlers will not have to try and deal with it.

Parameters
indexThe index of the attribute in the list (starting at 0).
virtual bool16 ISAXAttributeList::GetIndex (const WideStringuri,
const WideStringlocalPart,
uint32 & index 
) const
pure virtual

Index by namespace name

Parameters
uriThe Namespace URI, or the empty string if the name has no Namespace URI.
localPartThe attribute's local name.
indexOutput of index if returned true.
Returns
kFalse if no such attribute, true otherwise.
virtual bool16 ISAXAttributeList::GetIndex (const WideStringqName,
uint32 & index 
) const
pure virtual

Index by XML 1.0 qualified name

Parameters
qNameThe qualified (prefixed) name.
indexOutput of index if returned true.
Returns
kFalse if no such attribute, true otherwise.
virtual int32 ISAXAttributeList::GetLength () const
pure virtual

Number of attributes in this list

The attributes may be delivered in any arbitrary order, regardless of the order in which they were declared or specified. The number of attributes may be zero.

Returns
The number of attributes in the list.
virtual bool16 ISAXAttributeList::GetLocalName (uint32 index,
WideStringlocalName 
) const
pure virtual

Local name of an attribute by position

The QNames must be unique: no attribute will be included in the list twice. Attributes without values (those declared #IMPLIED without a value specified in the start tag) will be omitted from the list.

Parameters
indexThe index of the attribute in the list (starting at 0).
localNameThe output parameter specified by the caller to contain the returned local name of the indexed attribute.
Returns
kFalse if the index is out of range, true otherwise.
See Also
GetLength
virtual bool16 ISAXAttributeList::GetQName (uint32 index,
WideStringqName 
) const
pure virtual

QName of an attribute by position

The QNames must be unique: no attribute will be included in the list twice. Attributes without values (those declared #IMPLIED without a value specified in the start tag) will be omitted from the list.

Parameters
indexThe index of the attribute in the list (starting at 0).
qNameThe output parameter specified by the caller to contain the returned QName of the indexed attribute.
Returns
kFalse if the index is out of range, true otherwise.
See Also
GetLength
virtual bool16 ISAXAttributeList::GetType (uint32 index,
WideStringattributeType 
) const
pure virtual

Return the type of an attribute in the list (by position).

This method is included to provide consistency with the CAXEAttributes class. Every call to this method will return "CDATA" as the type if the index is in range.

Parameters
indexThe index of the attribute in the list (starting at 0).
attributeTypeThe output parameter specified by the caller to contain the returned type string of the indexed attribute.
Returns
kFalse if the index is out of range, true otherwise.
See Also
GetLength
#GetType(String)
virtual bool16 ISAXAttributeList::GetType (const WideStringuri,
const WideStringlocalPart,
WideStringattributeType 
) const
pure virtual

Type by namespace name

See GetType for a description of the possible types.

Parameters
uriThe namespace URI, or the empty string if the name has no namespace URI.
localPartThe local name of the attribute.
attributeTypeThe output parameter specified by the caller to contain the returned type string of the named attribute.
Returns
kFalse if the attribute is not in the list or if namespace processing is not being performed, true otherwise.
virtual bool16 ISAXAttributeList::GetType (const WideStringqName,
WideStringattributeType 
) const
pure virtual

Type by qualified name

See GetType for a description of the possible types.

Parameters
qNameThe XML 1.0 qualified name.
attributeTypeThe output parameter specified by the caller to contain the returned type string of the named attribute.
Returns
kFalse if the attribute is not in the list or if qualified names are not available, true otherwise.
virtual bool16 ISAXAttributeList::GetURI (uint32 index,
WideStringuri 
) const
pure virtual

Namespace URI of an attribute by position

The QNames must be unique: no attribute will be included in the list twice. Attributes without values (those declared #IMPLIED without a value specified in the start tag) will be omitted from the list.

Parameters
indexThe index of the attribute in the list (starting at 0).
uriThe output parameter specified by the caller to contain the returned URI.
Returns
kFalse if the index is out of range, true otherwise.
See Also
GetLength
virtual bool16 ISAXAttributeList::GetValue (uint32 index,
WideStringattributeValue 
) const
pure virtual

Value of an attribute by position

Parameters
indexThe index of the attribute in the list (starting at 0).
attributeValueThe output parameter specified by the caller to contain the returned value of the indexed attribute.
Returns
kFalse if the index is out of range, true otherwise.
See Also
GetLength
GetValue
virtual bool16 ISAXAttributeList::GetValue (const WideStringuri,
const WideStringlocalPart,
WideStringattributeValue 
) const
pure virtual

Value by namespace name

Parameters
uriThe namespace URI, or the empty String if the name has no Namespace URI.
localPartThe local name of the attribute.
attributeValueThe output parameter specified by the caller to contain the returned value of the named attribute.
Returns
kFalse if the attribute is not in the list, true otherwise.
virtual bool16 ISAXAttributeList::GetValue (const WideStringqName,
WideStringattributeValue 
) const
pure virtual

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

Parameters
qNameThe XML 1.0 qualified name.
attributeValueThe output parameter specified by the caller to contain the returned value of the named attribute.
Returns
kFalse if the attribute is not in the list or if qualified names are not available, true otherwise.