You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Andy Hird <an...@myinternet.com.au> on 2000/09/05 07:27:38 UTC
Re: [Xalan C] Reading Stylesheet from a string
Hi Dave, Sorry took so long to get back to you (been distracted!).
Anyway - I tried the latest builds of Xalan/Xerces with my program which
attempts to load a stylesheet and XML document from a string and
then transform (should I be using Xerces from CVS with the current Xalan?). I
get a new error from my attempts to load a stylesheet from a string (well const
char *). This is all on Linux (Debian Linux 2.2 kernel - with gcc 2.95.2)
processStylesheet is now returning:
XMLException Type is : XMLPlatformException
Message is : Could not determine base pathname of the file
I've attached a sample program which reproduces this. Any insights would be
gratefully received.
Thanks
Andy
On 08-Aug-2000 David_N_Bertoni@lotus.com wrote:
>
> Hi Andy,
>
> I just checked in some fixes for this problem. You should get the latest
> sources and rebuild Xalan if you want to try it out.
>
> By the way, this line of code is a memory leak:
>
> iXMLInputSource.setSystemId(XMLString::transcode("XSLString"));
>
> You need to delete the pointer return from XMLString::transcode(). As an
> alternative, you migh try the following:
>
> const DOMString systemID("XSLString");
> iXMLInputSource.setSystemId(systemID.rawBuffer());
>
> Or the following, if your compiler supports wide string constants:
>
> iXMLInputSource.setSystemId(L"XSLString");
>
> Please let me know if you still have problems with this.
>
> Dave
>
>
>
>
> Andy Hird
> <andyh@internal.schools.ne To:
> xalan-dev@xml.apache.org
> t.au> cc: (bcc: David N
> Bertoni/CAM/Lotus)
> Sent by: Subject: [Xalan C]
> Reading Stylesheet from a string
> andyh@dougal.internal.scho
> ols.net.au
>
>
> 08/04/2000 02:21 AM
> Please respond to
> xalan-dev
>
>
>
>
>
> Hi there, I'm trying to get xalan (C ver 0.40 on Linux) to create a
> StyleSheetRoot from a string. I've been trying to use the
> XSLTEngineImpl::processStylesheet(XSLTInputSource &,
> StylesheetConstructionContext &)
>
> interface where the XSLTInputSource is constructed from a istrstream but
> not
> with much success. Can anyone offer an alternative or an example of some
> working code?
>
> I managed to use istrstreams to parse the XML to be transformed from a
> string
> fine.
>
> So far I worked out I needed to set a systemID on the XSLTInputSource
> otherwise
> processStyleSheet just returns 0 (no errors or anything).
>
> That didn't seem to help - I'm now crashing deeper inside
> processStylesheet.
>
>
> A short code example of what I'm using:
>
> const char *xslDocument = "xsl document here";
> int doclen = strlen(xslDocument);
>
> istrstream iXSLdocumentStream(xslDocument, doclen);
> XSLTInputSource iXMLInputSource(&iXSLdocumentStream);
>
> iXMLInputSource.setSystemId(XMLString::transcode("XSLString"));
>
> pStylesheet = Processor.processStylesheet(iXMLInputSource,
> TheConstructionContext);
>
> Ideas, help?
>
> Thanks in advance
> Andy Hird