Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The documentation for libxml's <a href="http://www.xmlsoft.org/html/libxml-SAX2.html#xmlSAX2StartElementNs" rel="nofollow noreferrer">start element callback</a> states that the pointer is to an array that hold 5 values for each attribute (the number of attributes is returned in nb_attributes). This means that every 5th value in the array is a new attribute item.</p> <p>The five items for each attribute are:</p> <ol> <li>localname (the name of the attribute)</li> <li>prefix (the namespace of the attribute)</li> <li>URI</li> <li>[start of] value (a pointer to the start of the xmlChar string for the value)</li> <li>end [of value] (a pointer to the end of the xmlChar string for the value)</li> </ol> <p>So you need to step through the array, get each value out of the items for the first attribute, then use the start value pointer to get the xmlChar string that is length = end - start. Then start over with the next attribute till you read in nb_attributes worth.</p> <p>If that makes your head ache then I strongly suggest you switch to Apple's <a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html" rel="nofollow noreferrer">NSXMLParser</a> (link may require login, or use this link <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html" rel="nofollow noreferrer">NSXMLParser</a>). In which case you would get the attributes as an NSDictionary. To get all the attributes out of it you could do the following:</p> <pre><code>for (NSString *attributeName in [attributeDict allKeys]) { NSString *attributeValue = [attributeDict objectForKey:attributeName]; // do something here with attributeName and attributeValue } </code></pre> <p>If you have access to the iPhone developer site then look at the example <a href="https://developer.apple.com/iphone/library/samplecode/SeismicXML/index.html" rel="nofollow noreferrer">SeismicXML</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload