Hi
My code is working... The problem was, I was trying to do
<xsl:message><xsl:value-of
select="document('data:<fasih>as</fasih>')"/></xsl:message>
This led to the calling of str() on the XNodeSet object that was
formed, which returns as rather than <fasih>as</fasih>
Doing a <xsl:value-of
select="document('data:<fasih>as</fasih>')/fasih"/> confirmed taht a
nodeset was formed.
Thanx John
Fasih
On Tue, 1 Feb 2005 13:35:21 +0530, Fasihullah Askiri
<[EMAIL PROTECTED]> wrote:
> Oo, is that what is expected from a resolver?
> I thought when u say new StreamSource(new StringReader(string)) ,
> xalan is going to parse the StreamSource as reqd... Anyway, if I have
> to do the parsing, how do i do it?
> as in, where do i get the dom parser from?
> If I create a new one per request... i guess it will say that the dom
> was created from a different document cannot be attached to this
> doc....
>
> Can u plz give me a sample code on how to do this...
>
> Thanx
> Fasih
>
>
> ---------- Forwarded message ----------
> From: Fasihullah Askiri <[EMAIL PROTECTED]>
> Date: Tue, 1 Feb 2005 13:34:58 +0530
> Subject: Re: URI Resolver: XML in String
> To: John Gentilin <[EMAIL PROTECTED]>
>
> Oo, is that what is expected from a resolver?
> I thought when u say new StreamSource(new StringReader(string)) ,
> xalan is going to parse the StreamSource as reqd... Anyway, if I have
> to do the parsing, how do i do it?
> as in, where do i get the dom parser from?
> If I create a new one per request... i guess it will say that the dom
> was created from a different document cannot be attached to this
> doc....
>
> Can u plz give me a sample code on how to do this...
>
> Thanx
> Fasih
>
> On Mon, 31 Jan 2005 22:51:50 -0800, John Gentilin
> <[EMAIL PROTECTED]> wrote:
> > I suggested before to parse the String with a DOM parser then pass back
> > a DOM Source in the resolver...
> >
> > Fasihullah Askiri wrote:
> >
> > >hi
> > >referring to my code snippet, the value of href is a String
> > >"data:<fas><fasi>asd</fasi></fas>"
> > >the string is this... and i dont think there is an error in this.. or
> > >is there an error?
> > >
> > >Also, can u please suggest some way to debug this problem....
> > >
> > >
> > >thanx
> > >fasih
> > >
> > >On Mon, 31 Jan 2005 13:20:48 -0800, John Gentilin
> > ><[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >>Are you receiving the string you expect inside the resolver i.e. Are the
> > >>entities coming through as
> > >>entities or the resolved characters ?? This looks like one of those
> > >>thing where you are going to
> > >>have conflicts on entity expansion. How do you populate the string ??
> > >>
> > >>It may help to debug by parsing the string with a DOM parser then pass
> > >>back a DOMSource.
> > >>If you force the parsing to occur in the resolver it may give you better
> > >>insight on what is happening.
> > >>
> > >>-John G
> > >>
> > >>
> > >>Fasihullah Askiri wrote:
> > >>
> > >>
> > >>
> > >>>Hi all
> > >>>I have a string variable that contains xml in it. I want to parse it
> > >>>and use a particular node in my xsl processing. I tried writing a
> > >>>URIResolver so that I can do a document() and get it parsed, but I am
> > >>>getting a strange behaviour, what I get is only the text node as
> > >>>string back from the document(). Please tell me where I am wrong or
> > >>>how should I do it best.
> > >>>
> > >>>Code snippet:
> > >>>My resolver class:
> > >>>
> > >>>public class DataResolver implements URIResolver{
> > >>> public Source resolve(String href, String base) throws
> > >>>TransformerException {
> > >>> try {
> > >>> if(href.startsWith("data:")) {
> > >>> StreamSource s = new StreamSource(new
> > >>>StringReader(href.substring(5)));
> > >>> return s;
> > >>> }
> > >>> } catch(Exception ie){
> > >>> System.out.println("Problem" + ie.getMessage());
> > >>> }
> > >>> return null;
> > >>> }
> > >>>}
> > >>>
> > >>>
> > >>>
> > >>>My xsl:
> > >>><xsl:value-of select="document('data:'<?xml
> > >>>version="1.0"?><fas><fasi>Fasih</fasi></fas>')"/>
> > >>>
> > >>>returns Fasih
> > >>>rather than, <fas><fasi>Fasih</fasi></fas> as a node-set.
> > >>>
> > >>>Please help me on this, I was so desperate on this that I even
> > >>>downloaded the xalan src code to figure out what was wrong.
> > >>>
> > >>>Thanx in advance for any help
> > >>>Fasih
> > >>>
> > >>>
> > >>>
> > >>>
> > >>
> > >>
> >
> >
>