Re: NSXMLDocument question (--> XSL Classes bug with > 1 XSL files?)
Re: NSXMLDocument question (--> XSL Classes bug with > 1 XSL files?)
- Subject: Re: NSXMLDocument question (--> XSL Classes bug with > 1 XSL files?)
- From: malcom <email@hidden>
- Date: Mon, 6 Mar 2006 16:19:04 +0100
setMIMEType does not work anymore (??? it's not so logic anyway...).
I'll use Jim solution, thanks Jim (and Brett).
However NSXMLDocument XSL apply style method does not work well if
your XSL data is contained in more than one file.
I've 3 file, one called template.xsl (where I'll use
objectByApplyingXSLT method) and two other auxiliary files (called
tools.xsl and labels.xsl). My XSL file will import them using:
<xsl:import href="tools.xsl" />
<xsl:import href="labels.xsl" />
after the top instructions:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
However when I try to use this (I've previously loaded template.xsl in
an NSData variable) XCode debugger returns:
I/O warning : failed to load external entity "tools.xsl"
compilation error: element import
xsl:import : unable to load tools.xsl
I/O warning : failed to load external entity "labels.xsl"
compilation error: element import
xsl:import : unable to load labels.xsl
tools and labes are contained in the same folder of template.xsl. So
why it can't import them? Is a known issue or a bug?
Thanks to all (again)
On 3/5/06, malcom <email@hidden> wrote:
> 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
>
--
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