This post is more than 5 years old
45 Posts
0
5263
January 8th, 2009 10:00
tag attributes
Hi, I have a question regarding tag attributes: if I want to give out all attributes of a tag (which are name/value pairs) I would expect to
use code like this:
for(String key : tag.getAttributes()) {
String value = tag.getStringAttribute(key);
// do something
}
but instead only the following works
String [] atts = tag.getAttributes();
booleanisNameValueArray = (atts.length/ 2 == tag.getNumAttributes());
if(isNameValueArray) {
for(inti=0; i < atts.length/ 2; i+=2) {
String key = atts;
String value = atts[i+1];
// do something
}
} else{
for(String key : tag.getAttributes()) {
String value = tag.getStringAttribute(key);
// do something
}
}
gstuartemc
2 Intern
•
417 Posts
0
January 9th, 2009 04:00
Chris - getAttributes in Java API has always behaved in this fashion. As we are now promoting the use of the XAM SDK then you can rest assured that this will not change in the Centera SDK!
As Henky pointed out, if you only want to retrieve a single attribute then you can easily do this if you know it's name e.g. myAttrValue = myClip.getStringAttribute("myAttrName").
Purnawan_Henky
15 Posts
0
January 8th, 2009 20:00
Hi,
This is not a bug of SDK. This is how SDK should work.
You can get all of attributes by single call. This is more effective than
iterating all attributes one-by-one.
If you want to get just only one attribute then you can call
getBooleanAttribute(), getStringAttribute() or getLongAttribute().
Rgds,
Henky
christoph_retti
45 Posts
0
January 9th, 2009 00:00
Hi, I was just wondering why I get attribute names and values back in this call. Normally one gets an array of all attributes names and then
goes over them and gets their values. So if this is the wanted behaviour then I can assume that this will stay the way and remove one
of the variants on my code.
Many thanks,
Chris
gstuartemc
2 Intern
•
417 Posts
1
January 9th, 2009 05:00
The Centera SDK will continue to be supported for several years, but it is unlikely that any new functionality willbe introduced. Service Packs consisting purely of bug fixes are the likely direction.
There are various presentations and information available for download in the XAM sections of the EDN Centera community. Feel free to post questions in the XAM discussions forum.
christoph_retti
45 Posts
0
January 9th, 2009 05:00
That behaviour is ok as long as it does not change:)
I guess I will have a look at the XAM SDK then; so from your answer I assume that in the future
only XAM SDK should be used? Is this correct? Is there a comparison between the features and functionality of the two
SDKs somewhere?
many thanks, Chris