|
| virtual void | Adopt (const char **attributes, bool16 namespaced, ISAXServices *owner, const NamespaceDecl &namespaceDecls)=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 |
| |
| virtual bool16 | HasAttribute (const PMString &key) const =0 |
| |
| virtual bool16 | HasAttribute (const WideString &key) const =0 |
| |
| virtual PMString | GetAttributeString (const PMString &key, const PMString &defaultValue="") const =0 |
| |
| virtual WideString | GetAttributeString (const WideString &key, const WideString *defaultValue=nil) const =0 |
| |
| virtual bool16 | GetAttributeBool (const PMString &key, bool16 defaultValue=kFalse) const =0 |
| |
| virtual bool16 | GetAttributeBool (const WideString &key, bool16 defaultValue=kFalse) const =0 |
| |
| virtual int32 | GetAttributeInt (const PMString &key, int32 defaultValue=0) const =0 |
| |
| virtual int32 | GetAttributeInt (const WideString &key, int32 defaultValue=0) const =0 |
| |
| virtual IPMUnknown * | QueryInterface (PMIID interfaceID) const =0 |
| |
| virtual void | AddRef () const =0 |
| |
| virtual void | Release () const =0 |
| |
An InDesign friendly Wrapper for attributes in Expat. An instance of this class will be passed to ISaxContentHandler::StartElement.
An element's attributes
The instance provided will return valid results only during the scope of the startElement invocation. To save it for future use, the application must make a copy.
There are two ways for the SAX application to obtain information from the ISAXAttributes interface. First, it can iterate through the entire list:
StartElement(const WideString& uri, const WideString& localname,
const WideString& qname, ISAXAttributes* attrs) {
for (unsigned int i = 0; i < atts->GetLength(); i++) {
WideString 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(const WideString& uri, const WideString& localname,
const WideString& qname, ISAXAttributes* attrs) {
WideString identifier;
if (!atts->GetValue("id", identifier)) ...
WideString label;
if (!atts->GetValue("label", label)) ...
[...]
}
Invalid Parameters
- See Also
- ISAXContentHandler::StartElement
| virtual bool16 ISAXAttributes::GetType | ( | uint32 | index, | | | WideString & | attributeType | | ) | | const |
| pure virtual |
Return the type of an attribute in the list (by position).
The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper case).
If the parser has not read a declaration for the attribute, or if the parser 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 parser will report the type as "NMTOKEN".
- Parameters
| index | The index of the attribute in the list (starting at 0). |
| attributeType | The 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)