cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Gaffga" <cgaf...@triplemind.com>
Subject Re: data from url into java String
Date Wed, 08 May 2002 17:03:41 GMT
> So what i really need, is to get dynamic text (XML in this case) into a
Java
> string at runtime...
> and here i thought i almost had it... isn't there a load_String_from_URL
> method somewhere???

That's easy, but has nothing to do with Cocoon:

      import java.io.InputStream;
      import java.net.URL;

      String s = "";

      try {
        InputStream in = new
URL("http://www.someurl.com/somepage.xml").openStream();
        int c;
        while( (c=in.read()) != -1) {
          s += (char) c;
        }
        in.close();
      } catch ( Exception e) {
        e.printStackTrace();
      }

Yout page from someurl is in String s!

yours
Christoph


----- Original Message -----
From: "Jon Williams" <jon@ulanguzi.com>
To: <cocoon-users@xml.apache.org>
Sent: Wednesday, May 08, 2002 6:18 PM
Subject: data from url into java String


> I've made a great deal of progress on this problem already, but i seem to
> have hit a snag.
>
> i have this line in my XSP:
>
> <cinclude:include
> src="http://localhost:8080/exist/modify_rank/includeXmlTest.xsp" />
>
> which causes the include of data that looks like:
>
> <xsp:logic>
> String xml="&lt;/content&gt;";
> </xsp:logic>
>
> alas, cincludes appear to be processed *after* the XSP page is compiled
> and so i end up with the above XML in my output stream, rather than it
> being executed along with the rest of the XSP page.
>
> just fyi, what i'm going for is to get "entity-fied" XML (via
> xml-to-string.xsl)
> into a java variable, so i can pass it to a taglib that saves it into an
XML
> repository.
>
> So what i really need, is to get dynamic text (XML in this case) into a
Java
> string at runtime...
> and here i thought i almost had it... isn't there a load_String_from_URL
> method somewhere???
>
> i've been reading the archives for months -- thanks for the kickin'
resource
>
> :j
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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