Monica_G (28) [Avatar] Offline
#1
Hello!

I am working on Chapter 11 and am in the XML section. I've cloned the Swift-XML.git repository and then dragged the XML.swift file into my BookCase Project Navigator.

When I enter in the xml computed property in the Book object I get an error stating "XMLNode' is ambiguous for type lookup in this context"

Looking at the XML.swift file I dragged into the my project it contains similar errors too:

'XMLNode' is ambiguous for type lookup in this context
Invalid redeclaration of 'XML'.

What am I missing?

Here is a screenshot of the errors I see when looking at the XML.swift file:

image

Thank you!

Monica
Craig Grummitt (48) [Avatar] Offline
#2
Hi Monica,

Thanks for letting me know about this problem, I've looked into it and found you're right!

At some point when the repository was updated, it seems as though the XML.swift file was accidentally included with the Chapter11.2.StoreDataStart branch. So when you added it, it ended up being in the project twice! This is why you were seeing errors such as 'ambiguous...type' and 'invalid redeclaration'

So - sorry about that! I have removed the XML file from this branch, so you should now be able to follow the instructions in the XML section without a problem now.

Again, sorry, and good luck with it!

Craig
Monica_G (28) [Avatar] Offline
#3
Hi Craig,

Yes, it works now! Thank you for fixing it. smilie

Monica
Monica_G (28) [Avatar] Offline
#4
Hello Craig,

Sorry, but I am getting an "index out of range" error now in the XML.swift file, when I run the app. It occurs in the Chapter11.4.StoreDataXML branch as well. I've tried restarting XCode and also double checked that the 'booksFile' file is empty (it wasn't containing old data from the PList section).


image

Monica
Craig Grummitt (48) [Avatar] Offline
#5
Hi Monica,

I'm glad you got in touch - you seem to have uncovered a new bug in the XML repository. I've resolved the bug and it should work now. If you replace the contents of the XML.swift file in your project with the updated file here, it (fingers crossed!) should work now. You may need to "Erase all content and settings" on your simulator before testing.

Thanks again for letting me know about the problem, let me know how you go with it.

Good luck!
Craig
Monica_G (28) [Avatar] Offline
#6
Hi Craig,

Yes, it works now! I had to do the "Erase All Content And Settings..." in the simulator, and then it worked.

Thank you!

Monica
Craig Grummitt (48) [Avatar] Offline
#7
Great to hear!