XML in Content - disappears

View: New views
16 Messages — Rating Filter:   Alert me  

XML in Content - disappears

by erlingwl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I put this XML in the content on the clientside:

<projectconfig><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig>

I use type = application/xml or text/xml

On the serverside - this is received as just "\n" or a blank string -
I can't parse it anyway..

Are there any rules or something that applies to putting XML in the
content? Do I have to convert < > to < and >s ?

Thanks, Erling

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XML in Content - disappears

by Alejandro Abdelnur-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Erling,

How are you setting that XML on the client? Would you provide the code snippet?

A

On Mon, Mar 31, 2008 at 10:03 PM, Erling Wegger Linde
<erlingwl@...> wrote:

> Hi,
>
>  I put this XML in the content on the clientside:
>
>  <projectconfig><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig>
>
>  I use type = application/xml or text/xml
>
>  On the serverside - this is received as just "\n" or a blank string -
>  I can't parse it anyway..
>
>  Are there any rules or something that applies to putting XML in the
>  content? Do I have to convert < > to < and >s ?
>
>  Thanks, Erling
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@...
>  For additional commands, e-mail: users-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XML in Content - disappears

by erlingwl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, and thanks for your interest!

I figured this out, I had to use content.setType(Content.XML)

It seems that content.setType("text/xml") and
content.setType("application/xml") doesn't work. I am not sure whether
this is according to the Atom Protocol or not?

http://www.atomenabled.org/developers/syndication/#contentElement states:

"Otherwise, if the type attribute ends in +xml or /xml, then an xml
document of this type is contained inline.
Otherwise, if the type attribute starts with text, then an escaped
document of this type is contained inline."

I'm not sure if that means that ROME should accept other types such as
"application/xml" instead of just "xml" or whether it should
autoconvert this or what? It would be nice if the server side could
understand the difference of for instance "application/xml" and
"application/rdf+xml". What do you think?

This is my current code by the way:

                XMLOutputter outputter = new XMLOutputter(format)
                String value = outputter.outputString(doc)
               
                content.setValue(value)
                content.setType(Content.XML)
                //content.setType("application/xml")




On Tue, Apr 1, 2008 at 7:44 PM, Alejandro Abdelnur <tucu00@...> wrote:

> Erling,
>
>  How are you setting that XML on the client? Would you provide the code snippet?
>
>  A
>
>
>
>  On Mon, Mar 31, 2008 at 10:03 PM, Erling Wegger Linde
>  <erlingwl@...> wrote:
>  > Hi,
>  >
>  >  I put this XML in the content on the clientside:
>  >
>  >  <projectconfig><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig>
>  >
>  >  I use type = application/xml or text/xml
>  >
>  >  On the serverside - this is received as just "\n" or a blank string -
>  >  I can't parse it anyway..
>  >
>  >  Are there any rules or something that applies to putting XML in the
>  >  content? Do I have to convert < > to < and >s ?
>  >
>  >  Thanks, Erling
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  For additional commands, e-mail: users-help@...
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@...
>  For additional commands, e-mail: users-help@...
>
>



--
Med vennlig hilsen
Erling Wegger Linde

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XML in Content - disappears

by Alejandro Abdelnur-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mmmhh, Content.XML is for Atom 0.3 only.

Looking at the code it seems that a MIME type ending in 'xml' would do the job.

Can you please verify it does not work, if not I'll check what is going on.

A

On Tue, Apr 1, 2008 at 11:36 PM, Erling Wegger Linde <erlingwl@...> wrote:

> Hi, and thanks for your interest!
>
>  I figured this out, I had to use content.setType(Content.XML)
>
>  It seems that content.setType("text/xml") and
>  content.setType("application/xml") doesn't work. I am not sure whether
>  this is according to the Atom Protocol or not?
>
>  http://www.atomenabled.org/developers/syndication/#contentElement states:
>
>  "Otherwise, if the type attribute ends in +xml or /xml, then an xml
>  document of this type is contained inline.
>  Otherwise, if the type attribute starts with text, then an escaped
>  document of this type is contained inline."
>
>  I'm not sure if that means that ROME should accept other types such as
>  "application/xml" instead of just "xml" or whether it should
>  autoconvert this or what? It would be nice if the server side could
>  understand the difference of for instance "application/xml" and
>  "application/rdf+xml". What do you think?
>
>  This is my current code by the way:
>
>                 XMLOutputter outputter = new XMLOutputter(format)
>                 String value = outputter.outputString(doc)
>
>                 content.setValue(value)
>                 content.setType(Content.XML)
>                 //content.setType("application/xml")
>
>
>
>
>
>
>  On Tue, Apr 1, 2008 at 7:44 PM, Alejandro Abdelnur <tucu00@...> wrote:
>  > Erling,
>  >
>  >  How are you setting that XML on the client? Would you provide the code snippet?
>  >
>  >  A
>  >
>  >
>  >
>  >  On Mon, Mar 31, 2008 at 10:03 PM, Erling Wegger Linde
>  >  <erlingwl@...> wrote:
>  >  > Hi,
>  >  >
>  >  >  I put this XML in the content on the clientside:
>  >  >
>  >  >  <projectconfig><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig>
>  >  >
>  >  >  I use type = application/xml or text/xml
>  >  >
>  >  >  On the serverside - this is received as just "\n" or a blank string -
>  >  >  I can't parse it anyway..
>  >  >
>  >  >  Are there any rules or something that applies to putting XML in the
>  >  >  content? Do I have to convert < > to < and >s ?
>  >  >
>  >  >  Thanks, Erling
>  >  >
>  >  >  ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  For additional commands, e-mail: users-help@...
>  >  >
>  >  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  For additional commands, e-mail: users-help@...
>  >
>  >
>
>
>
>  --
>  Med vennlig hilsen
>  Erling Wegger Linde
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@...
>  For additional commands, e-mail: users-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XML in Content - disappears

by erlingwl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't understand why it doesn't work either.. but:

                        Content content = new Content();
                        content.setValue(value);
                        content.setType(Content.XML);
// content.setType("application/xml");
                        System.out.println(content.getValue());
                        entry.setContent(content);

Works and

                        Content content = new Content();
                        content.setValue(value);
// content.setType(Content.XML);
                        content.setType("application/xml");
                        System.out.println(content.getValue());
                        entry.setContent(content);

Doesn't!...

When trying to parse it I get org.jdom.input.JDOMParseException: Error
on line -1: Premature end of file, and writing it to sysout give just
a blank linebreak..

Is it something that needs to be configured differently? Can I have
configured my endpoint as supporting Atom 0.3?

Thanks for looking into this! - Erling


On Wed, Apr 2, 2008 at 3:44 PM, Alejandro Abdelnur <tucu00@...> wrote:

> Mmmhh, Content.XML is for Atom 0.3 only.
>
>  Looking at the code it seems that a MIME type ending in 'xml' would do the job.
>
>  Can you please verify it does not work, if not I'll check what is going on.
>
>  A
>
>
>
>  On Tue, Apr 1, 2008 at 11:36 PM, Erling Wegger Linde <erlingwl@...> wrote:
>  > Hi, and thanks for your interest!
>  >
>  >  I figured this out, I had to use content.setType(Content.XML)
>  >
>  >  It seems that content.setType("text/xml") and
>  >  content.setType("application/xml") doesn't work. I am not sure whether
>  >  this is according to the Atom Protocol or not?
>  >
>  >  http://www.atomenabled.org/developers/syndication/#contentElement states:
>  >
>  >  "Otherwise, if the type attribute ends in +xml or /xml, then an xml
>  >  document of this type is contained inline.
>  >  Otherwise, if the type attribute starts with text, then an escaped
>  >  document of this type is contained inline."
>  >
>  >  I'm not sure if that means that ROME should accept other types such as
>  >  "application/xml" instead of just "xml" or whether it should
>  >  autoconvert this or what? It would be nice if the server side could
>  >  understand the difference of for instance "application/xml" and
>  >  "application/rdf+xml". What do you think?
>  >
>  >  This is my current code by the way:
>  >
>  >                 XMLOutputter outputter = new XMLOutputter(format)
>  >                 String value = outputter.outputString(doc)
>  >
>  >                 content.setValue(value)
>  >                 content.setType(Content.XML)
>  >                 //content.setType("application/xml")
>  >
>  >
>  >
>  >
>  >
>  >
>  >  On Tue, Apr 1, 2008 at 7:44 PM, Alejandro Abdelnur <tucu00@...> wrote:
>  >  > Erling,
>  >  >
>  >  >  How are you setting that XML on the client? Would you provide the code snippet?
>  >  >
>  >  >  A
>  >  >
>  >  >
>  >  >
>  >  >  On Mon, Mar 31, 2008 at 10:03 PM, Erling Wegger Linde
>  >  >  <erlingwl@...> wrote:
>  >  >  > Hi,
>  >  >  >
>  >  >  >  I put this XML in the content on the clientside:
>  >  >  >
>  >  >  >  <projectconfig><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig>
>  >  >  >
>  >  >  >  I use type = application/xml or text/xml
>  >  >  >
>  >  >  >  On the serverside - this is received as just "\n" or a blank string -
>  >  >  >  I can't parse it anyway..
>  >  >  >
>  >  >  >  Are there any rules or something that applies to putting XML in the
>  >  >  >  content? Do I have to convert < > to < and >s ?
>  >  >  >
>  >  >  >  Thanks, Erling
>  >  >  >
>  >  >  >  ---------------------------------------------------------------------
>  >  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  >  For additional commands, e-mail: users-help@...
>  >  >  >
>  >  >  >
>  >  >
>  >  >  ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  For additional commands, e-mail: users-help@...
>  >  >
>  >  >
>  >
>  >
>  >
>  >  --
>  >  Med vennlig hilsen
>  >  Erling Wegger Linde
>  >
>  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  For additional commands, e-mail: users-help@...
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@...
>  For additional commands, e-mail: users-help@...
>
>



--
Med vennlig hilsen
Erling Wegger Linde

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XML in Content - disappears

by Alejandro Abdelnur-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Erling,

I've just did the following test and it works. Are you sure the value
the content bean is proper XML? that could be a reason.

--------------------
package com.sun.syndication.unittest;

import com.sun.syndication.feed.atom.Feed;
import com.sun.syndication.feed.atom.Content;
import com.sun.syndication.io.WireFeedOutput;
import junit.framework.TestCase;

import java.io.StringWriter;

public class TestAtomContent extends TestCase {

    private String createFeed() throws Exception {
        Feed feed = new Feed();
        Content content = new Content();
        content.setType("application/xml");
        content.setValue("<test>Hello Hello</test>");
        feed.setTitleEx(content);
        feed.setFeedType("atom_1.0");
        StringWriter sw = new StringWriter();
        WireFeedOutput output = new WireFeedOutput();
        output.output(feed, sw);
        sw.close();

        return sw.toString();
    }

    public void testWrite() throws Exception {
        String s = createFeed();
        System.out.println(s);
    }

}
--------------------

On Wed, Apr 2, 2008 at 8:00 PM, Erling Wegger Linde <erlingwl@...> wrote:

> I don't understand why it doesn't work either.. but:
>
>                         Content content = new Content();
>
>                         content.setValue(value);
>                         content.setType(Content.XML);
>  //                      content.setType("application/xml");
>                         System.out.println(content.getValue());
>                         entry.setContent(content);
>
>  Works and
>
>                         Content content = new Content();
>
>                         content.setValue(value);
>  //                      content.setType(Content.XML);
>                         content.setType("application/xml");
>                         System.out.println(content.getValue());
>                         entry.setContent(content);
>
>  Doesn't!...
>
>  When trying to parse it I get org.jdom.input.JDOMParseException: Error
>  on line -1: Premature end of file, and writing it to sysout give just
>  a blank linebreak..
>
>  Is it something that needs to be configured differently? Can I have
>  configured my endpoint as supporting Atom 0.3?
>
>  Thanks for looking into this! - Erling
>
>
>
>
>  On Wed, Apr 2, 2008 at 3:44 PM, Alejandro Abdelnur <tucu00@...> wrote:
>  > Mmmhh, Content.XML is for Atom 0.3 only.
>  >
>  >  Looking at the code it seems that a MIME type ending in 'xml' would do the job.
>  >
>  >  Can you please verify it does not work, if not I'll check what is going on.
>  >
>  >  A
>  >
>  >
>  >
>  >  On Tue, Apr 1, 2008 at 11:36 PM, Erling Wegger Linde <erlingwl@...> wrote:
>  >  > Hi, and thanks for your interest!
>  >  >
>  >  >  I figured this out, I had to use content.setType(Content.XML)
>  >  >
>  >  >  It seems that content.setType("text/xml") and
>  >  >  content.setType("application/xml") doesn't work. I am not sure whether
>  >  >  this is according to the Atom Protocol or not?
>  >  >
>  >  >  http://www.atomenabled.org/developers/syndication/#contentElement states:
>  >  >
>  >  >  "Otherwise, if the type attribute ends in +xml or /xml, then an xml
>  >  >  document of this type is contained inline.
>  >  >  Otherwise, if the type attribute starts with text, then an escaped
>  >  >  document of this type is contained inline."
>  >  >
>  >  >  I'm not sure if that means that ROME should accept other types such as
>  >  >  "application/xml" instead of just "xml" or whether it should
>  >  >  autoconvert this or what? It would be nice if the server side could
>  >  >  understand the difference of for instance "application/xml" and
>  >  >  "application/rdf+xml". What do you think?
>  >  >
>  >  >  This is my current code by the way:
>  >  >
>  >  >                 XMLOutputter outputter = new XMLOutputter(format)
>  >  >                 String value = outputter.outputString(doc)
>  >  >
>  >  >                 content.setValue(value)
>  >  >                 content.setType(Content.XML)
>  >  >                 //content.setType("application/xml")
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >  On Tue, Apr 1, 2008 at 7:44 PM, Alejandro Abdelnur <tucu00@...> wrote:
>  >  >  > Erling,
>  >  >  >
>  >  >  >  How are you setting that XML on the client? Would you provide the code snippet?
>  >  >  >
>  >  >  >  A
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >  On Mon, Mar 31, 2008 at 10:03 PM, Erling Wegger Linde
>  >  >  >  <erlingwl@...> wrote:
>  >  >  >  > Hi,
>  >  >  >  >
>  >  >  >  >  I put this XML in the content on the clientside:
>  >  >  >  >
>  >  >  >  >  <projectconfig><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig>
>  >  >  >  >
>  >  >  >  >  I use type = application/xml or text/xml
>  >  >  >  >
>  >  >  >  >  On the serverside - this is received as just "\n" or a blank string -
>  >  >  >  >  I can't parse it anyway..
>  >  >  >  >
>  >  >  >  >  Are there any rules or something that applies to putting XML in the
>  >  >  >  >  content? Do I have to convert < > to < and >s ?
>  >  >  >  >
>  >  >  >  >  Thanks, Erling
>  >  >  >  >
>  >  >  >  >  ---------------------------------------------------------------------
>  >  >  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  >  >  For additional commands, e-mail: users-help@...
>  >  >  >  >
>  >  >  >  >
>  >  >  >
>  >  >  >  ---------------------------------------------------------------------
>  >  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  >  For additional commands, e-mail: users-help@...
>  >  >  >
>  >  >  >
>  >  >
>  >  >
>  >  >
>  >  >  --
>  >  >  Med vennlig hilsen
>  >  >  Erling Wegger Linde
>  >  >
>  >  >
>  >  >
>  >  >  ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  For additional commands, e-mail: users-help@...
>  >  >
>  >  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  For additional commands, e-mail: users-help@...
>  >
>  >
>
>
>
>  --
>  Med vennlig hilsen
>  Erling Wegger Linde
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@...
>  For additional commands, e-mail: users-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XML in Content - disappears

by erlingwl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again!

I'm setting the content of a ClientEntry. But it works to set and read
the content before I execute the addEntry(entry) method. However,
there is something happening in the transport.. all that is received
at the client side is a blank String with a line break or two..

Here's my client side code (with hardcoded xml, just to be sure..):

                        ClientCollection atomClient =
AtomClientFactory.getCollection(endpointAdress, username, password);

                        ClientEntry entry = atomClient.createEntry();

                        entry.setTitle(title);
                       
                        Content content = new Content();
                        content.setType("application/xml"); content.setValue("<projectconfig><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig>");
// content.setType(Content.XML);
                        System.out.println("Value: " + content.getValue() + " \ntype: " +
content.getType());
                        entry.setContent(content);
                        System.out.println("Stored value: " + entry.getContent().getValue());

                        atomClient.addEntry(entry);

Both the System.out.printlns confirmes that the value is stored.. so
it is something that happens either at the client side when
atomClient.addEntry(entry); is executed or perhaps some parsing on the
server side.. Is it possible to see the raw HTTP header + body from
public String postEntry(AtomRequest req, Entry entry) throws
AtomException { ? I guess it might be possible to get something out of
req?

- Erling



On Thu, Apr 3, 2008 at 5:06 AM, Alejandro Abdelnur <tucu00@...> wrote:

> Erling,
>
>  I've just did the following test and it works. Are you sure the value
>  the content bean is proper XML? that could be a reason.
>
>  --------------------
>  package com.sun.syndication.unittest;
>
>  import com.sun.syndication.feed.atom.Feed;
>  import com.sun.syndication.feed.atom.Content;
>  import com.sun.syndication.io.WireFeedOutput;
>  import junit.framework.TestCase;
>
>  import java.io.StringWriter;
>
>  public class TestAtomContent extends TestCase {
>
>     private String createFeed() throws Exception {
>         Feed feed = new Feed();
>         Content content = new Content();
>         content.setType("application/xml");
>         content.setValue("<test>Hello Hello</test>");
>         feed.setTitleEx(content);
>         feed.setFeedType("atom_1.0");
>         StringWriter sw = new StringWriter();
>         WireFeedOutput output = new WireFeedOutput();
>         output.output(feed, sw);
>         sw.close();
>
>         return sw.toString();
>     }
>
>     public void testWrite() throws Exception {
>         String s = createFeed();
>         System.out.println(s);
>     }
>
>  }
>  --------------------
>
>
>
>  On Wed, Apr 2, 2008 at 8:00 PM, Erling Wegger Linde <erlingwl@...> wrote:
>  > I don't understand why it doesn't work either.. but:
>  >
>  >                         Content content = new Content();
>  >
>  >                         content.setValue(value);
>  >                         content.setType(Content.XML);
>  >  //                      content.setType("application/xml");
>  >                         System.out.println(content.getValue());
>  >                         entry.setContent(content);
>  >
>  >  Works and
>  >
>  >                         Content content = new Content();
>  >
>  >                         content.setValue(value);
>  >  //                      content.setType(Content.XML);
>  >                         content.setType("application/xml");
>  >                         System.out.println(content.getValue());
>  >                         entry.setContent(content);
>  >
>  >  Doesn't!...
>  >
>  >  When trying to parse it I get org.jdom.input.JDOMParseException: Error
>  >  on line -1: Premature end of file, and writing it to sysout give just
>  >  a blank linebreak..
>  >
>  >  Is it something that needs to be configured differently? Can I have
>  >  configured my endpoint as supporting Atom 0.3?
>  >
>  >  Thanks for looking into this! - Erling
>  >
>  >
>  >
>  >
>  >  On Wed, Apr 2, 2008 at 3:44 PM, Alejandro Abdelnur <tucu00@...> wrote:
>  >  > Mmmhh, Content.XML is for Atom 0.3 only.
>  >  >
>  >  >  Looking at the code it seems that a MIME type ending in 'xml' would do the job.
>  >  >
>  >  >  Can you please verify it does not work, if not I'll check what is going on.
>  >  >
>  >  >  A
>  >  >
>  >  >
>  >  >
>  >  >  On Tue, Apr 1, 2008 at 11:36 PM, Erling Wegger Linde <erlingwl@...> wrote:
>  >  >  > Hi, and thanks for your interest!
>  >  >  >
>  >  >  >  I figured this out, I had to use content.setType(Content.XML)
>  >  >  >
>  >  >  >  It seems that content.setType("text/xml") and
>  >  >  >  content.setType("application/xml") doesn't work. I am not sure whether
>  >  >  >  this is according to the Atom Protocol or not?
>  >  >  >
>  >  >  >  http://www.atomenabled.org/developers/syndication/#contentElement states:
>  >  >  >
>  >  >  >  "Otherwise, if the type attribute ends in +xml or /xml, then an xml
>  >  >  >  document of this type is contained inline.
>  >  >  >  Otherwise, if the type attribute starts with text, then an escaped
>  >  >  >  document of this type is contained inline."
>  >  >  >
>  >  >  >  I'm not sure if that means that ROME should accept other types such as
>  >  >  >  "application/xml" instead of just "xml" or whether it should
>  >  >  >  autoconvert this or what? It would be nice if the server side could
>  >  >  >  understand the difference of for instance "application/xml" and
>  >  >  >  "application/rdf+xml". What do you think?
>  >  >  >
>  >  >  >  This is my current code by the way:
>  >  >  >
>  >  >  >                 XMLOutputter outputter = new XMLOutputter(format)
>  >  >  >                 String value = outputter.outputString(doc)
>  >  >  >
>  >  >  >                 content.setValue(value)
>  >  >  >                 content.setType(Content.XML)
>  >  >  >                 //content.setType("application/xml")
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >  On Tue, Apr 1, 2008 at 7:44 PM, Alejandro Abdelnur <tucu00@...> wrote:
>  >  >  >  > Erling,
>  >  >  >  >
>  >  >  >  >  How are you setting that XML on the client? Would you provide the code snippet?
>  >  >  >  >
>  >  >  >  >  A
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >  On Mon, Mar 31, 2008 at 10:03 PM, Erling Wegger Linde
>  >  >  >  >  <erlingwl@...> wrote:
>  >  >  >  >  > Hi,
>  >  >  >  >  >
>  >  >  >  >  >  I put this XML in the content on the clientside:
>  >  >  >  >  >
>  >  >  >  >  >  <projectconfig><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig>
>  >  >  >  >  >
>  >  >  >  >  >  I use type = application/xml or text/xml
>  >  >  >  >  >
>  >  >  >  >  >  On the serverside - this is received as just "\n" or a blank string -
>  >  >  >  >  >  I can't parse it anyway..
>  >  >  >  >  >
>  >  >  >  >  >  Are there any rules or something that applies to putting XML in the
>  >  >  >  >  >  content? Do I have to convert < > to < and >s ?
>  >  >  >  >  >
>  >  >  >  >  >  Thanks, Erling
>  >  >  >  >  >
>  >  >  >  >  >  ---------------------------------------------------------------------
>  >  >  >  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  >  >  >  For additional commands, e-mail: users-help@...
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >
>  >  >  >  >  ---------------------------------------------------------------------
>  >  >  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  >  >  For additional commands, e-mail: users-help@...
>  >  >  >  >
>  >  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >  --
>  >  >  >  Med vennlig hilsen
>  >  >  >  Erling Wegger Linde
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >  ---------------------------------------------------------------------
>  >  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  >  For additional commands, e-mail: users-help@...
>  >  >  >
>  >  >  >
>  >  >
>  >  >  ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  For additional commands, e-mail: users-help@...
>  >  >
>  >  >
>  >
>  >
>  >
>  >  --
>  >  Med vennlig hilsen
>  >  Erling Wegger Linde
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  For additional commands, e-mail: users-help@...
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@...
>  For additional commands, e-mail: users-help@...
>
>



--
Med vennlig hilsen
Erling Wegger Linde

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XML in Content - disappears

by erlingwl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Actually, it must be something on the server side - in the conversion
from a request to an entry.

This is the content of the HttpServletRequest body received at the
server in my public MplAtomHandler(HttpServletRequest req) construcotr

<entry xmlns="http://www.w3.org/2005/Atom"><title>RESTFULLAYER5</title><content
type="application/xml"><projectconfig
xmlns=""><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig></content></entry>

- Erling


On Thu, Apr 3, 2008 at 11:48 AM, Erling Wegger Linde <erlingwl@...> wrote:

> Hi again!
>
>  I'm setting the content of a ClientEntry. But it works to set and read
>  the content before I execute the addEntry(entry) method. However,
>  there is something happening in the transport.. all that is received
>  at the client side is a blank String with a line break or two..
>
>  Here's my client side code (with hardcoded xml, just to be sure..):
>
>                         ClientCollection atomClient =
>  AtomClientFactory.getCollection(endpointAdress, username, password);
>
>                         ClientEntry entry = atomClient.createEntry();
>
>                         entry.setTitle(title);
>
>                         Content content = new Content();
>                         content.setType("application/xml");                     content.setValue("<projectconfig><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig>");
>  //                      content.setType(Content.XML);
>                         System.out.println("Value: " + content.getValue() + " \ntype: " +
>  content.getType());
>                         entry.setContent(content);
>                         System.out.println("Stored value: " + entry.getContent().getValue());
>
>                         atomClient.addEntry(entry);
>
>  Both the System.out.printlns confirmes that the value is stored.. so
>  it is something that happens either at the client side when
>  atomClient.addEntry(entry); is executed or perhaps some parsing on the
>  server side.. Is it possible to see the raw HTTP header + body from
>  public String postEntry(AtomRequest req, Entry entry) throws
>  AtomException { ? I guess it might be possible to get something out of
>  req?
>
>  - Erling
>
>
>
>
>
>  On Thu, Apr 3, 2008 at 5:06 AM, Alejandro Abdelnur <tucu00@...> wrote:
>  > Erling,
>  >
>  >  I've just did the following test and it works. Are you sure the value
>  >  the content bean is proper XML? that could be a reason.
>  >
>  >  --------------------
>  >  package com.sun.syndication.unittest;
>  >
>  >  import com.sun.syndication.feed.atom.Feed;
>  >  import com.sun.syndication.feed.atom.Content;
>  >  import com.sun.syndication.io.WireFeedOutput;
>  >  import junit.framework.TestCase;
>  >
>  >  import java.io.StringWriter;
>  >
>  >  public class TestAtomContent extends TestCase {
>  >
>  >     private String createFeed() throws Exception {
>  >         Feed feed = new Feed();
>  >         Content content = new Content();
>  >         content.setType("application/xml");
>  >         content.setValue("<test>Hello Hello</test>");
>  >         feed.setTitleEx(content);
>  >         feed.setFeedType("atom_1.0");
>  >         StringWriter sw = new StringWriter();
>  >         WireFeedOutput output = new WireFeedOutput();
>  >         output.output(feed, sw);
>  >         sw.close();
>  >
>  >         return sw.toString();
>  >     }
>  >
>  >     public void testWrite() throws Exception {
>  >         String s = createFeed();
>  >         System.out.println(s);
>  >     }
>  >
>  >  }
>  >  --------------------
>  >
>  >
>  >
>  >  On Wed, Apr 2, 2008 at 8:00 PM, Erling Wegger Linde <erlingwl@...> wrote:
>  >  > I don't understand why it doesn't work either.. but:
>  >  >
>  >  >                         Content content = new Content();
>  >  >
>  >  >                         content.setValue(value);
>  >  >                         content.setType(Content.XML);
>  >  >  //                      content.setType("application/xml");
>  >  >                         System.out.println(content.getValue());
>  >  >                         entry.setContent(content);
>  >  >
>  >  >  Works and
>  >  >
>  >  >                         Content content = new Content();
>  >  >
>  >  >                         content.setValue(value);
>  >  >  //                      content.setType(Content.XML);
>  >  >                         content.setType("application/xml");
>  >  >                         System.out.println(content.getValue());
>  >  >                         entry.setContent(content);
>  >  >
>  >  >  Doesn't!...
>  >  >
>  >  >  When trying to parse it I get org.jdom.input.JDOMParseException: Error
>  >  >  on line -1: Premature end of file, and writing it to sysout give just
>  >  >  a blank linebreak..
>  >  >
>  >  >  Is it something that needs to be configured differently? Can I have
>  >  >  configured my endpoint as supporting Atom 0.3?
>  >  >
>  >  >  Thanks for looking into this! - Erling
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >  On Wed, Apr 2, 2008 at 3:44 PM, Alejandro Abdelnur <tucu00@...> wrote:
>  >  >  > Mmmhh, Content.XML is for Atom 0.3 only.
>  >  >  >
>  >  >  >  Looking at the code it seems that a MIME type ending in 'xml' would do the job.
>  >  >  >
>  >  >  >  Can you please verify it does not work, if not I'll check what is going on.
>  >  >  >
>  >  >  >  A
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >  On Tue, Apr 1, 2008 at 11:36 PM, Erling Wegger Linde <erlingwl@...> wrote:
>  >  >  >  > Hi, and thanks for your interest!
>  >  >  >  >
>  >  >  >  >  I figured this out, I had to use content.setType(Content.XML)
>  >  >  >  >
>  >  >  >  >  It seems that content.setType("text/xml") and
>  >  >  >  >  content.setType("application/xml") doesn't work. I am not sure whether
>  >  >  >  >  this is according to the Atom Protocol or not?
>  >  >  >  >
>  >  >  >  >  http://www.atomenabled.org/developers/syndication/#contentElement states:
>  >  >  >  >
>  >  >  >  >  "Otherwise, if the type attribute ends in +xml or /xml, then an xml
>  >  >  >  >  document of this type is contained inline.
>  >  >  >  >  Otherwise, if the type attribute starts with text, then an escaped
>  >  >  >  >  document of this type is contained inline."
>  >  >  >  >
>  >  >  >  >  I'm not sure if that means that ROME should accept other types such as
>  >  >  >  >  "application/xml" instead of just "xml" or whether it should
>  >  >  >  >  autoconvert this or what? It would be nice if the server side could
>  >  >  >  >  understand the difference of for instance "application/xml" and
>  >  >  >  >  "application/rdf+xml". What do you think?
>  >  >  >  >
>  >  >  >  >  This is my current code by the way:
>  >  >  >  >
>  >  >  >  >                 XMLOutputter outputter = new XMLOutputter(format)
>  >  >  >  >                 String value = outputter.outputString(doc)
>  >  >  >  >
>  >  >  >  >                 content.setValue(value)
>  >  >  >  >                 content.setType(Content.XML)
>  >  >  >  >                 //content.setType("application/xml")
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >  On Tue, Apr 1, 2008 at 7:44 PM, Alejandro Abdelnur <tucu00@...> wrote:
>  >  >  >  >  > Erling,
>  >  >  >  >  >
>  >  >  >  >  >  How are you setting that XML on the client? Would you provide the code snippet?
>  >  >  >  >  >
>  >  >  >  >  >  A
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >  On Mon, Mar 31, 2008 at 10:03 PM, Erling Wegger Linde
>  >  >  >  >  >  <erlingwl@...> wrote:
>  >  >  >  >  >  > Hi,
>  >  >  >  >  >  >
>  >  >  >  >  >  >  I put this XML in the content on the clientside:
>  >  >  >  >  >  >
>  >  >  >  >  >  >  <projectconfig><bugtracker_name>jira</bugtracker_name><bugtracker_url>http://localhost:8080/jira/</bugtracker_url></projectconfig>
>  >  >  >  >  >  >
>  >  >  >  >  >  >  I use type = application/xml or text/xml
>  >  >  >  >  >  >
>  >  >  >  >  >  >  On the serverside - this is received as just "\n" or a blank string -
>  >  >  >  >  >  >  I can't parse it anyway..
>  >  >  >  >  >  >
>  >  >  >  >  >  >  Are there any rules or something that applies to putting XML in the
>  >  >  >  >  >  >  content? Do I have to convert < > to < and >s ?
>  >  >  >  >  >  >
>  >  >  >  >  >  >  Thanks, Erling
>  >  >  >  >  >  >
>  >  >  >  >  >  >  ---------------------------------------------------------------------
>  >  >  >  >  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  >  >  >  >  For additional commands, e-mail: users-help@...
>  >  >  >  >  >  >
>  >  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >  ---------------------------------------------------------------------
>  >  >  >  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  >  >  >  For additional commands, e-mail: users-help@...
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >  --
>  >  >  >  >  Med vennlig hilsen
>  >  >  >  >  Erling Wegger Linde
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >  ---------------------------------------------------------------------
>  >  >  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  >  >  For additional commands, e-mail: users-help@...
>  >  >  >  >
>  >  >  >  >
>  >  >  >
>  >  >  >  ---------------------------------------------------------------------
>  >  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  >  For additional commands, e-mail: users-help@...
>  >  >  >
>  >  >  >
>  >  >
>  >  >
>  >  >
>  >  >  --
>  >  >  Med vennlig hilsen
>  >  >  Erling Wegger Linde
>  >  >
>  >  >  ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  >  For additional commands, e-mail: users-help@...
>  >  >
>  >  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@...
>  >  For additional commands, e-mail: users-help@...
>  >
>  >
>
>
>
>  --
>
>
> Med vennlig hilsen
>  Erling Wegger Linde
>



--
Med vennlig hilsen
Erling Wegger Linde

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XML in Content - disappears

by Alejandro Abdelnur-2 :: Rate this Message: