Re: [xml] Getting the element's attributes with SAX2
- From: Daniel Veillard <veillard redhat com>
- To: Antonio Pozuelo <antonio pozuelo atosorigin com>
- Cc: xml gnome org
- Subject: Re: [xml] Getting the element's attributes with SAX2
- Date: Tue, 14 Mar 2006 18:21:41 -0500
On Tue, Mar 14, 2006 at 11:15:26AM -0500, Daniel Veillard wrote:
On Tue, Mar 14, 2006 at 04:26:59PM +0100, Antonio Pozuelo wrote:
{
...
strcpy(ctx->my_attributes[i],attributes[i])
...
}
Is anything wrong?
How am I supposed to tell ? what is i ? And no I won't debug your code.
Okay I think I realized what is confusing you. In the new callback
the attributes values are not copied in a new zero terminated string,
rather pointers to the beginning and the end of the attribute value are
given, this potentally avoids an awful lot of allocations/deallocations,
most of the time those are direct pointer from the UTF8 document stream.
The pointer to the routine in SAX2 should be relatively clear about this.
It's also documented in
http://xmlsoft.org/html/libxml-SAX2.html#xmlSAX2StartElementNs
attributes: pointer to the array of (localname/prefix/URI/value/end) attribute values.
so the array contains 5 pointer per attribute found
Daniel
--
Daniel Veillard | Red Hat http://redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]