• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSXMLDocument question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLDocument question


  • Subject: Re: NSXMLDocument question
  • From: malcom <email@hidden>
  • Date: Sun, 5 Mar 2006 15:21:01 +0100

I've found another solution.
Just add this line when you create an NSXMLDocument
	[xmlDoc setMIMEType:@"text/xml"];
It seems to works fine.
Thanks to all :)

On 3/5/06, Jim Correia <email@hidden> wrote:
> On Mar 4, 2006, at 11:29 AM, malcom wrote:
>
> > This is a short part of my code. Is there another way to convert
> > automatically <? Or need I do to it with replace functions of
> > NSString?
>
> [...]
>
> >              NSXMLElement *quoteNode = [[NSXMLElement alloc]
> > initWithKind:
> > NSXMLElementKind options:NSXMLNodePreserveAll];
> >                [quoteNode setName: @"QUOTE"];
> >                [quoteNode setStringValue: [NSString
> > stringWithFormat:@"%d", [[_text
> > objectAtIndex:k] state]]];
>
> It seems like you are going out of your way to make things more
> difficult than they need to be. Using the NSXMLElement convenience
> methods, and you'll the the right answer as an added bonus.
>
>         NSXMLElement *rootElement = [NSXMLNode elementWithName: @"root"];
>         NSXMLDocument *xmlDocument = [NSXMLNode documentWithRootElement:
> rootElement];
>
>         NSXMLElement *subElement = [NSXMLNode elementWithName: @"subelement"
> stringValue: @"<?"];
>         [rootElement addChild: subElement];
>
>         NSData *xmlData = [xmlDocument XMLData];
>         NSString *xmlString = [[[NSString alloc] initWithData: xmlData
> encoding:NSUTF8StringEncoding] autorelease];
>         NSLog(@"%@", xmlString);
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>


--
www.malcom-mac.com
mac/win software development
email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSXMLDocument question (From: malcom <email@hidden>)
 >Re: NSXMLDocument question (From: Robert Walker <email@hidden>)
 >Re: NSXMLDocument question (From: John Stiles <email@hidden>)
 >Re: NSXMLDocument question (From: malcom <email@hidden>)
 >Re: NSXMLDocument question (From: John Stiles <email@hidden>)
 >Re: NSXMLDocument question (From: malcom <email@hidden>)
 >Re: NSXMLDocument question (From: Sarah Wilkin <email@hidden>)
 >Re: NSXMLDocument question (From: malcom <email@hidden>)
 >Re: NSXMLDocument question (From: Jim Correia <email@hidden>)

  • Prev by Date: IGNORE Re: Determine Cocoa/CFM??
  • Next by Date: Re: was(Mail.app)iWeb.app like SplitView Handle
  • Previous by thread: Re: NSXMLDocument question
  • Next by thread: Re: NSXMLDocument question
  • Index(es):
    • Date
    • Thread