jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco.Mistr...@nokia.com
Subject RE: Is it a toolkit bug or what?
Date Tue, 01 Aug 2000 07:13:46 GMT
Hi Mike,
	thanx a lot....it worked!!!
regards
	marco

> -----Original Message-----
> From: EXT Michael Taylor [mailto:mdt@qad.com]
> Sent: 31. July 2000 23:27
> To: Marco.Mistroni@nokia.com
> Subject: RE: Is it a toolkit bug or what?
> 
> 
> 
> 
> 
> Marco,
> 
> <marco:trialxmltag xsl="<%=xslfile%>">
> <?xml version="1.0" ?>
> <document>
>    <scope></scope>
> </document>
> </marco:trialxmltag>My JSP is like that:
> 
> Yes, your JSP contains only one XML declaration.  However, it appears
> within the <marco:trialxmltag> element.  What I have been 
> trying to tell
> you is that when retrieving the sub-nodes of the 
> <marco:trialxmltag>, you
> will have a TEXT node after your start tag and BEFORE <?xml 
> version="1.0"
> ?> declaration.  This whitespace is apparently 1 linefeed.
> 
> This means that when you take the TEXT under <marco:trialxmltag>, the
> second line starts with <?xml... and that the characters are 
> numberd as
> follows:
> 
> <?xml version="1.0" ?>
> 01234567
> 
> I'm guessing that the parser figures out that it has an XML version
> declaration by the time it has read <?xml ver.  This makes 
> sense to me.
> So, if you TRIM the leading space or text node off this 
> fragment it will
> then run as you expect.
> 
> Do you see what I'm saying?
> 
> I think that this will work:
> 
> <marco:trialxmltag xsl="<%=xslfile%>"><?xml version="1.0" ?>
> <document>
>    <scope></scope>
> </document>
> </marco:trialxmltag>My JSP is like that:
> 
> The VERY first characters of the body of the tag would then be <?xml
> version and the parser will not complain.
> 
> Within your tag, it should be easy to trim leading whitespace 
> characters
> and the parser will be happy.
> 
> Cheers,
> 
> Mike
> 
> 
> 
> 
> 
> Marco.Mistroni@nokia.com on 07/30/2000 11:54:04 PM
> 
> To:   Michael Taylor/QAD1
> cc:   taglibs-dev@jakarta.apache.org
> 
> Subject:  RE: Is it a toolkit bug or what?
> 
> 
> 
> 
> HI Mike,
>      i tried, but it's not like that
> xml files should begin with
> <?xml
> 
> not
> <? xml
> 
> the processor won't recognize them
> anyway, it's still not clear to me why the XSL processor says
> 
> Input XSL; Line 2; Column 7
> XSL Error: Could not parse Input XML document!
> XSL Error: SAX Exception
> There was a SAX Exception!
> org.apache.xalan.xslt.XSLProcessorException: The XML 
> declaration may only
> appear
>  at the very beginning of the document.
>         at
> org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630)
>         at
> org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngin
> eImpl.java:852)
>         at
> org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java,
> Com
> 
> in my JSP there is ONLY one XML declaration...
> can anyone give me a clue about what it's happening??
> 
> <%@ page import="java.util.*"  %>
> <%   String xslfile=null;
>         String format = request.getHeader("User-Agent");
>         System.out.println("the user agent is " + format);
>         if(format.startsWith("Nokia")) {
>             response.setContentType("text/vnd.wap.wml");
>             xslfile = "file:///c:\\marcodev\\provawml.xsl";
>         } else {
>             xslfile="file:///c:\\marcodev\\prova.xsl";
>         }
> 
>          session.putValue("xslfile", xslfile);
>  %>
> 
> <%@ taglib uri="http://www.nokia.com/marcotag" prefix="marco" %>
> 
> <marco:trialxmltag xsl="<%=xslfile%>">
> <?xml version="1.0" ?>
> <document>
>    <scope></scope>
> </document>
> </marco:trialxmltag>My JSP is like that:
> 
> 
> please help
> 
> thanx in advance & regards
>      marco
> > -----Original Message-----
> > From: EXT Michael Taylor [mailto:mdt@qad.com]
> > Sent: 28. July 2000 22:21
> > To: Marco.Mistroni@nokia.com
> > Subject: RE: Is it a toolkit bug or what?
> >
> >
> >
> >
> >
> > Marco,
> >
> > Line one is a carriage return I'm guessing.  Line two is your
> > XML version.
> >
> > <?xml version="1.0"?>
> > 1234567
> >
> > If I try to parse this statement, the first seven characters
> > give me "<?xml
> > ".  The space is necessary to the parse to know you are
> > sending it <?xml
> > and not <?xmlsomethingelse...".  So I'm guessing it still
> > does not like the
> > xml version declaration.
> >
> > I think I would have to see the code and try it to be more
> > help in figuring
> > out why it won't take the version declaration.
> >
> > - Mike
> >
> >
> >
> >
> >
> > Marco.Mistroni@nokia.com on 07/27/2000 11:16:43 PM
> >
> > To:   Michael Taylor/QAD1
> > cc:
> >
> > Subject:  RE: Is it a toolkit bug or what?
> >
> >
> >
> >
> > HI Mike,
> >      well, it's not what i want....
> > i would like to write only one JSP, and see two output based
> > on XSL and
> > User-Agent
> > as u will see in the list, i already posted a msg 'cause i need some
> > comments
> > i had two solutions:
> > - skip completely the <?xml....>
> > - put it inside my custom tag, and in the processing of my
> > tag i remove the
> > <?xml...> and give the rest to the procesor
> >
> > the thing that i still can't understand is:
> > - why when i put <?xml....?> inside my custom tag, the XSLT
> > engine gives me
> > the exception
> > Input XSL; Line 2; Column 7
> > XSL Error: Could not parse Input XML document!
> > XSL Error: SAX Exception
> > There was a SAX Exception!
> > org.apache.xalan.xslt.XSLProcessorException: The XML
> > declaration may only
> > appear
> >  at the very beginning of the document.
> >
> > it looks like in the document there are TWO 
> <?xml....?>....but when i
> > output
> > the body content i got
> >
> > <?xml version="1.0"?>
> > <document>
> >    <scope></scope>
> > </document>
> >
> > so why it's like that??
> > can u help me?
> >
> > thanx & regards
> >      marco
> >
> >
> > > -----Original Message-----
> > > From: EXT Michael Taylor [mailto:mdt@qad.com]
> > > Sent: 28. July 2000 0:15
> > > To: Marco.Mistroni@nokia.com
> > > Subject: RE: Is it a toolkit bug or what?
> > >
> > >
> > >
> > >
> > >
> > > >the only solution that i found, as i told, was to avoid to
> > > write <?xml
> > > >version.....?> in the JSP
> > > >it's not nice.....but if i want to use web browser and wap
> > > browser, the
> > > >shortest solution was that
> > > >if anyone have another solution, please tell me, i am curious
> > >
> > > Perhaps you can conditionally generate the xml version based
> > > on the user
> > > agent?
> > >
> > > - Mike
> > >
> > >
> > >
> > >
> > >
> > > Marco.Mistroni@nokia.com on 07/27/2000 06:38:23 AM
> > >
> > > To:   taglibs-dev@jakarta.apache.org, Michael Taylor/QAD1,
> > >       Craig.McClanahan@eng.sun.com, sergek@lokitech.com
> > > cc:
> > >
> > > Subject:  RE: Is it a toolkit bug or what?
> > >
> > >
> > >
> > >
> > > hi all,
> > >      i discovered the problem...i think it's a toolkit problem
> > > i tried to display the output of the XSLT transformation..
> > > when i access from a web browser, i got
> > > <?xml version="1.0"?>
> > > <document>
> > > ....
> > > </document>
> > >
> > > when i access from the toolkit i have
> > > <?xml version="1.0"?>
> > > <?xml version="1.0" encoding="UTF..." ?>
> > > <document>
> > > ....
> > > </document>
> > >
> > >
> > > thanx in advance & regards
> > >      marco
> > >
> > > > -----Original Message-----
> > > > From: EXT Marco.Mistroni@nokia.com
> > [mailto:Marco.Mistroni@nokia.com]
> > > > Sent: 27. July 2000 12:15
> > > > To: mdt@qad.com; Craig.McClanahan@eng.sun.com; 
> sergek@lokitech.com
> > > > Cc: taglibs-dev@jakarta.apache.org
> > > > Subject: Is it a toolkit bug or what?
> > > >
> > > >
> > > > hi all,
> > > >    i wrote a custom tag that, depending on the User Agent,
> > > > transforms
> > > > the xml file contained in it into either HTML or WML.
> > > > In doing that i have encountered a problem, especially when i
> > > > loaded the jsp
> > > > page from the Nokia Toolkit:
> > > > if the page is like this
> > > >
> > > >  <%@ page import="java.util.*"  %>
> > > >  <%   String xslfile=null;
> > > >          String format = request.getHeader("User-Agent");
> > > >          System.out.println("the user agent is " + format);
> > > >          if(format.startsWith("Nokia")) {
> > > >              response.setContentType("text/vnd.wap.wml");
> > > >              xslfile = "file:///c:\\marcodev\\provawml.xsl";
> > > >          } else {
> > > >              xslfile="file:///c:\\marcodev\\prova.xsl";
> > > >          }
> > > >       session.putValue("xslfile", xslfile);
> > > >   %>
> > > >
> > > >  <%@ taglib uri="http://www.nokia.com/marcotag" 
> prefix="marco" %>
> > > >  <?xml version="1.0"?>
> > > >  <marco:trialxmltag xsl="<%= xslfile %>">
> > > >  <document>
> > > >     <scope></scope>
> > > >  </document>
> > > >  </marco:trialxmltag>
> > > >
> > > >
> > > > i continue to get errors from the Toolkit, and in fact if i
> > > > look at the
> > > > source output i see
> > > > <?xml version="1.0"?>
> > > > <?xml version="1.0" encoding="UTF...." ?>
> > > > .......
> > > >
> > > > now, if i load the jsp page from the web browser i got no
> > > > errors at all!!
> > > >
> > > > so, as a solution i tried to skip the <?xml version="1.0" ?>
> > > >
> > > > and in doing like that it worked fine......
> > > > i am using the latest version of Xalan as XSLT engine, tomcat
> > > > 3.1 and the
> > > > Nokia wap Server 2.0
> > > >
> > > > can anybody pls comment???
> > > >
> > > > thanx in advance & regards
> > > >    marco
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> 
> 
> 
> 

Mime
View raw message