function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
B2AB2A 

getattribute tag not working

Just testing out some code from the xmlstreamreader tutorial using the string:

 

     String str = '<books><book author="Manoj">Foo bar</book>' +
        '<book author="Mysti">Baz</book></books>';

 

I only get values for author if i use the "reader.getAttributeValueAt(0)" however I get NO values if I use "reader.getAttributeValue('','author');"

 

Can anyone shed light on why this is so?

 

Thanks!

prageethprageeth

Hello B2A;

 

Use 

reader.getAttributeValue(null,'author');

 

Instead of 

reader.getAttributeValue('','author');

 

 

 

B2AB2A

Thanks,

 

I tried it, however I get the error "Error: Compile Error: Variable does not exist: auther at line 36 column 9"

prageethprageeth

Hello B2Z;

 

1. In line 36 you have used the word 'auther' without having single quatations. Pls put single quots around the word 'auther'.

2. However the above spellings for the word author is incorrect.(Check the letters marked in red)