cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Piroumian" <KPiroum...@flagship.ru>
Subject Re: DOM ERROR
Date Thu, 26 Oct 2000 12:43:24 GMT
Yes, you can!

I HAVE ALREADY ANSWERED YOUR QUESTION!
See the list!

----- Original Message -----
From: "Marco Spinetti" <m.spinetti@pisa.iol.it>
To: <cocoon-users@xml.apache.org>
Sent: 26 ??????? 2000 ?., ??????? 16:34
Subject: I: DOM ERROR


>
>
>
> > Konstantin Piroumian wrote:
> >
> > > Hi!
> > >
> > > You can use FP Taglib to look for something in an XML file.
> > > See the FP Taglib page: http://xml.apache.org/cocoon/fp.html
> > >
> > > There you can find an example of how to read something that depends on
> the
> > > request.
> > >
> > > Regards,
> > >   Kot.
> > >
> > > ----- Original Message -----
> > > From: "Marco Spinetti" <m.spinetti@pisa.iol.it>
> > > To: <cocoon-users@xml.apache.org>
> > > Sent: 26 ??????? 2000 ?., ??????? 10:37
> > > Subject: I: DOM ERROR
> > >
> > > >
> > > > > Hi,
> > > > > I send you the file as attchment.
> > > > > I want to use DOM because I must look for ( in the file xml)a text
> > > > inside
> > > > a
> > > > > tag which depends from the parameter "segno".
> > > > > Marco
> > > > > m.spinetti@pisa.iol.it
> > > > >
> > > > > ----- Original Message -----
> > > > > From: Robin Green <greenrd@hotmail.com>
> > > > > To: <cocoon-users@xml.apache.org>
> > > > > Sent: Wednesday, October 25, 2000 6:07 PM
> > > > > Subject: Re: DOM ERROR
> > > > >
> > > > >
> > > > > > marco <m.spinetti@pisa.iol.it> wrote:
> > > > > > >I have tried to use the DOM inside Xsp to do the Parsing
of the
> Xml
> > > > file
> > > > > > >to which the Sheet style is associate. The part in which
I do
the
> > > > > > >Parsing is the following:
> > > > > > >
> > > > > > ><xsp:logic>
> > > > > > >public void main () {
> > > > > >
> > > > > > If you need to use the request object in a method, then you
need
> to
> > > > pass
> > > > > it
> > > > > > in:
> > > > > >
> > > > > > public void main (HttpServletRequest request) {
> > > > > >
> > > > > > >  String segno = request.getParameter("segnou");
> > > > > > >  String scelta = request.getParameter("sceltau");
> > > > > > >  try {
> > > > > > >
> > > > > >
> > > >
> >xspParser.parse("/usr/local/jakarta-tomcat/webapps/cocoon/prova31.xml")
> > > > ;
> > > > > > >
> > > > > > >   Document doc = xspParser.getDocument();
> > > > > >
> > > > > > I think this should be Document doc =
> > > > xspParser.parse("/usr/local...");
> > > > > >
> > > > > > >   analizza(doc);
> > > > > > >  } catch (Exception e) {
> > > > > > >   System.err.println("ERRORE NEL PARSING:"+e.getMessage()
);
> > > > > > >  }
> > > > > > >}
> > > > > > >
> > > > > > >public String analizza ( Document doc) {
> > > > > > >  String err = "Non trovata nessuna corrispondenza";
> > > > > > >  boolean trovato = false;
> > > > > > >  Element elem = doc.getDocumentElement();
> > > > > > >  NodeList nl = elem.getElementsByTagName("Segno");
> > > > > > >  for ( int i=0; i&lt;nl.getLength(); i++) {
> > > > > > >   Element segno = (Element)nl.item(i);
> > > > > > >   NodeList nl1 = segno.getElementsByTagName("Zodiaco");
> > > > > > >   Node zodiaco = nl1.item(0);
> > > > > > >   if (
> > > > > >
> >(((CharacterData)zodiaco.getFirstChild()).getData()).equals(segno))
> > > > > > >trovato=true;
> > > > > > >   if (trovato) {
> > > > > > >    trovato=false;
> > > > > > >    NodeList nl2 = segno.getElementsByTagName("Generale");
> > > > > > >    Element generale = (Element)nl2.item(0);
> > > > > > >    NodeList nl3 =
generale.getElementsByTagName("Descrizione");
> > > > > > >    Node descrizione = nl3.item(0);
> > > > > > >    String s =
> > > > (((CharacterData)descrizione.getFirstChild()).getData());
> > > > > > >    return s;
> > > > > > >   }
> > > > > > >  }
> > > > > > >  return err;
> > > > > > >}
> > > > > > >
> > > > > > ></xsp:logic>
> > > > > > >
> > > > > > >Therefore I try to call the Main () function:
> > > > > > >
> > > > > > ><xsl:when test="$sceltau='generale'">
> > > > > > ><CORPO>
> > > > > > ><xsp:expr>main()</xsp:expr>
> > > > > >
> > > > > > Pass in the request object as mentioned above:
> > > > > > main (request)
> > > > > >
> > > > > > but you can't use <xsp:expr> for this since main() does
not
return
> > > > > anything!
> > > > > >
> > > > > > ></CORPO>
> > > > > > ></xsl:when>
> > > > > > >
> > > > > > >However the Cocoon returns me the following mistakes:
> > > > > > >
> > > > > > ><h3 align="center">Error found handling the request.</h3>
> > > > > > ><blockquote><pre>java.lang.Exception: XSP Java
Compiler:
> > > > Compilation
> > > > > > >failed for _prova31.java
> > > > > > >64: '}' expected.
> > > > > > >     xspParentNode.appendChild(xspCurrentNode);
> > > > > > >                                               ^
> > > > > > >67: Statement expected.
> > > > > > >public void main () {
> > > > > > >^
> > > > > > >102: Identifier expected.
> > > > > > >     xspParentNode = xspCurrentNode;
> > > > > >
> > > > > > These errors are happening before the main method in your XML.
> > > > Please
> > > > show
> > > > > > us the full file.
> > > > > >
> > > > > > >Can I use DOM in a xsp page?
> > > > > >
> > > > > > Sure. But maybe you don't need to. Please explain what you're
> trying
> > > > to
> > > > > do.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > >
> ________________________________________________________________________
> > > > _
> > > > > > Get Your Private, Free E-mail from MSN Hotmail at
> > > > http://www.hotmail.com.
> > > > > >
> > > > > > Share information about yourself, create your own public profile
> at
> > > > > > http://profiles.msn.com.
> > > > > >
> > > > > >
> > > > > >
> > >
> ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > > > > For additional commands, e-mail:
cocoon-users-help@xml.apache.org
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>   Can I use FP to take a text in a Xml file and associate it to a String
to
>  modify it in Java (XSP)? Can I do a thing of the kind:
>  <xsp:logic>
>  String testo = <fp:read ..............................>;
>
>   Now I modify the string "testo "using Java
>  </xsp:logic>
>
>  Now I print the risult:
>  .......
>  <xsp:expr>
>  testo
>  <xsp:expr>
>  .................
>  Marco
>  m.spinetti@pisa.iol.it
>
>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>


Mime
View raw message