From: Tatu S. <cow...@ya...> - 2006-09-05 18:11:45
|
--- Olusola Fadero <olu...@gm...> wrote: > Hi , > I've been looking at VTD-XML with interest . One > thing I don't understand is > how do I get the names of attributes out of an > element if I don't know all > the attribute names. In other Java API's there is a > way of getting a list of > attributes for an element i.e. by using a Nodelist. As you may have noticed, VTD-XML is not object-oriented in that sense, and thus elements and attributes are not really bundled together. They are related, and relationship can be found... but there is no object-level containment: so there is no concept of "getting attributes out of an element", just finding attributes that follow start element/start tag. Another way to think about that is to note that attributes are tokens same way as tags themselves are, ie. granularity is higher than with other toolkits. Also, as a consequence, looking at other APIs will not give much insight into knowing how to get attribute names and values from VTD-XML: the API is quite distinct due to impl wanting to avoid object allocation cost at any cost. I don't have javadocs at hand, but it is not all that hard to figure it out from the samples. And I'm sure Jimmy can give a complete example of how to traverse over attribute names, if and when you do need to know them all (most of the time you don't -- you know what to look for). -+ Tatu +- __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |