Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

shilpa

macrumors member
Original poster
May 29, 2008
33
0
Hi all,
I am creating xmldocument using NSXMLDocument.Application work fine in simulator.But when i build it for device i am getting errors that (NSXMLDocument *root) NSXMLDocument is undecleared,even NSXMLNode and NSXMLElement are undecleared it is showing.so please help.
 

sapplesystems

macrumors newbie
Nov 26, 2009
15
0
write xml dynamically

Hi

I am tring to create a xml file dynamically through my code using NSXMLElement and NSXMLDocument. But compiler displaying me the error that NSXMLElement and NSXMLDocument are undefined.

Can any one help in this.

Thanks in advance.

Gaurav
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
I will assume this is an iPhone question. If it is then the answer is NSXMLDocument does not exist on the iPhone so don't use it. It's not in the iPhone Developer Center documentation so you should have already known this.

Yes it works in the simulator as that is using the libraries on your Mac but that does not mean it works on an iPhone. Stick to using the APIs declared by Apple.
 

sapplesystems

macrumors newbie
Nov 26, 2009
15
0
Ok Thanks for your support.

I am pretty new to Iphone development. So can you please tell me which API should I use to write a xml file dynamically.

Thanks

Gaurav
 

sapplesystems

macrumors newbie
Nov 26, 2009
15
0
Thanks for your support

But it seems to me that the above document is related with How can we Parse the existing document. But I want to create a new xml file.

Could I do the same with XMLParser class?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Thanks for your support

But it seems to me that the above document is related with How can we Parse the existing document. But I want to create a new xml file.

Could I do the same with XMLParser class?

Sorry: my initial scan of that document had me believing it was about using hte Parser to create a document. It's not.

If you don't want to use libxml2 directly (it's on the phone so you can use it) you could look at Google's replacement for NSXMLDocument which should let you do what you want.
 

sapplesystems

macrumors newbie
Nov 26, 2009
15
0
How could I use libxml2 to write a xml file? Could you please provide me any tutorial link or sample code for this?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Are you so lazy that you can't use Google? Or do you just expect life to spoon-feed you results with no effort?

The first search result in Google for "libxml2 write to file" links to a page of examples, the first of which seems to do what you want.
 

sapplesystems

macrumors newbie
Nov 26, 2009
15
0
I am not lazy neither I want spoon feeding. I had already visited this page but the issue is I am not able to understand how could I use this code because it seems to me a php script.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
I am not lazy neither I want spoon feeding. I had already visited this page but the issue is I am not able to understand how could I use this code because it seems to me a php script.

testWriter.c is (as the file extension suggests) a pure C program. If it looks like PHP then you have serious issues as you should have a good knowledge of C before writing anything for the iPhone.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.