You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by "Stefano Linguerri (JIRA)" <ji...@apache.org> on 2008/05/28 15:13:45 UTC

[jira] Created: (ABDERA-170) FOMParser.parse( InputStream in, String base, ParserOptions options) throws exeception

FOMParser.parse(    InputStream in,     String base,     ParserOptions options) throws exeception
-------------------------------------------------------------------------------------------------

                 Key: ABDERA-170
                 URL: https://issues.apache.org/jira/browse/ABDERA-170
             Project: Abdera
          Issue Type: Bug
         Environment: linux Ubuntu 7.10, jvm Sun 1.6.0._03, abdera built from trunk source with maven
            Reporter: Stefano Linguerri


This is on Trunk.
The method FOMParser.parse(InputStream in, String base, ParserOptions options) use FOMSniffingInputStream this class is the problem.

FOMSniffingInputStream left the mark of inputstrem moved
So when the input stream is passed to the parser an exception occurs.

Two stupid test methods for Junit to verify the bug:

This WORK:
 @Test
  public void testXMLFromFileWithoutFOMSniffingInputStream() throws Exception {
    File file = new File("testentry.xml");

    Abdera abdera = new Abdera();
    FileInputStream is = new FileInputStream(file);

    FOMParser fomParser = new FOMParser(abdera);
    Document<Element> doc = fomParser.parse(is);
    doc.getRoot().toString();
  }

This THROWS EXECEPTION
  @Test
  public void testXMLFromFileWithFOMSniffingInputStream() throws Exception {
    File file = new File("testentry.xml");

    Abdera abdera = new Abdera();
    FileInputStream is = new FileInputStream(file);

    FOMSniffingInputStream fomSniffingInputStream = new FOMSniffingInputStream(is);
    fomSniffingInputStream.getEncoding();

    FOMParser fomParser = new FOMParser(abdera);
    Document<Element> doc = fomParser.parse(is);

    doc.getRoot().toString();
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ABDERA-170) FOMParser.parse( InputStream in, String base, ParserOptions options) throws exeception

Posted by "Stefano Linguerri (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ABDERA-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600762#action_12600762 ] 

Stefano Linguerri commented on ABDERA-170:
------------------------------------------

Thanks, but the tests code is to explain better what I think it's a  bug.

Why i think it's a bug:

When I post an entry to AbderaServelt the Request pass through:

AbstractProvider.processEntry()
    --> AbstractEntityCollectionAdapter.postEntry()
        --> AbstractEntityCollectionAdapter.getEntryFromRequest()

In the AbstractEntityCollectionAdapter.getEntryFromRequest() method:

the Parser provided by Abdera is used to parse the entry:
...
     Abdera abdera = request.getAbdera();
     Parser parser = abdera.getParser();
...

The Parser returned is an instance of FOMParser.

With debbuger I see that the InputStream passes through
the method  FOMParser.parse(InputStream in, String base, ParserOptions options)
 the FOMParser at line 101 has this code:
...
    if (charset == null && options.getAutodetectCharset()) {
        FOMSniffingInputStream sin =
          (in instanceof FOMSniffingInputStream) ?
            (FOMSniffingInputStream)in :
            new FOMSniffingInputStream(in);
        charset = sin.getEncoding();
        if (charset != null) options.setCharset(charset);
        in = sin;
      }
...

So to be sure that the problem was FOMSniffingInputStream I wrote the two tests that I posted.

The test with FOMSniffingInputStream throws exception the same way as the AbderaServer.

> FOMParser.parse(    InputStream in,     String base,     ParserOptions options) throws exeception
> -------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-170
>                 URL: https://issues.apache.org/jira/browse/ABDERA-170
>             Project: Abdera
>          Issue Type: Bug
>         Environment: linux Ubuntu 7.10, jvm Sun 1.6.0._03, abdera built from trunk source with maven
>            Reporter: Stefano Linguerri
>         Attachments: testentry.xml
>
>
> This is on Trunk.
> The method FOMParser.parse(InputStream in, String base, ParserOptions options) use FOMSniffingInputStream this class is the problem.
> FOMSniffingInputStream left the mark of inputstrem moved
> So when the input stream is passed to the parser an exception occurs.
> Two stupid test methods for Junit to verify the bug:
> This WORK:
>  @Test
>   public void testXMLFromFileWithoutFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }
> This THROWS EXECEPTION
>   @Test
>   public void testXMLFromFileWithFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMSniffingInputStream fomSniffingInputStream = new FOMSniffingInputStream(is);
>     fomSniffingInputStream.getEncoding();
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (ABDERA-170) FOMParser.parse( InputStream in, String base, ParserOptions options) throws exeception

Posted by "James M Snell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ABDERA-170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James M Snell resolved ABDERA-170.
----------------------------------

    Resolution: Fixed

what application server are you running? what kind of inputstream are you passing in to the parser?  it's possible that there's some strange interaction going on with the inputstream impl being passed in.

> FOMParser.parse(    InputStream in,     String base,     ParserOptions options) throws exeception
> -------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-170
>                 URL: https://issues.apache.org/jira/browse/ABDERA-170
>             Project: Abdera
>          Issue Type: Bug
>         Environment: linux Ubuntu 7.10, jvm Sun 1.6.0._03, abdera built from trunk source with maven
>            Reporter: Stefano Linguerri
>         Attachments: testentry.xml
>
>
> This is on Trunk.
> The method FOMParser.parse(InputStream in, String base, ParserOptions options) use FOMSniffingInputStream this class is the problem.
> FOMSniffingInputStream left the mark of inputstrem moved
> So when the input stream is passed to the parser an exception occurs.
> Two stupid test methods for Junit to verify the bug:
> This WORK:
>  @Test
>   public void testXMLFromFileWithoutFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }
> This THROWS EXECEPTION
>   @Test
>   public void testXMLFromFileWithFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMSniffingInputStream fomSniffingInputStream = new FOMSniffingInputStream(is);
>     fomSniffingInputStream.getEncoding();
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ABDERA-170) FOMParser.parse( InputStream in, String base, ParserOptions options) throws exeception

Posted by "Stefano Linguerri (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ABDERA-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600465#action_12600465 ] 

Stefano Linguerri commented on ABDERA-170:
------------------------------------------

I update the trunk today, i had to manually remove class examples/src/main/java/org/apache/abdera/examples/ext/Features.java because maven didn't compile.

> FOMParser.parse(    InputStream in,     String base,     ParserOptions options) throws exeception
> -------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-170
>                 URL: https://issues.apache.org/jira/browse/ABDERA-170
>             Project: Abdera
>          Issue Type: Bug
>         Environment: linux Ubuntu 7.10, jvm Sun 1.6.0._03, abdera built from trunk source with maven
>            Reporter: Stefano Linguerri
>
> This is on Trunk.
> The method FOMParser.parse(InputStream in, String base, ParserOptions options) use FOMSniffingInputStream this class is the problem.
> FOMSniffingInputStream left the mark of inputstrem moved
> So when the input stream is passed to the parser an exception occurs.
> Two stupid test methods for Junit to verify the bug:
> This WORK:
>  @Test
>   public void testXMLFromFileWithoutFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }
> This THROWS EXECEPTION
>   @Test
>   public void testXMLFromFileWithFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMSniffingInputStream fomSniffingInputStream = new FOMSniffingInputStream(is);
>     fomSniffingInputStream.getEncoding();
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ABDERA-170) FOMParser.parse( InputStream in, String base, ParserOptions options) throws exeception

Posted by "Stefano Linguerri (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ABDERA-170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefano Linguerri updated ABDERA-170:
-------------------------------------

    Attachment: testentry.xml

The entry I used to test.

> FOMParser.parse(    InputStream in,     String base,     ParserOptions options) throws exeception
> -------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-170
>                 URL: https://issues.apache.org/jira/browse/ABDERA-170
>             Project: Abdera
>          Issue Type: Bug
>         Environment: linux Ubuntu 7.10, jvm Sun 1.6.0._03, abdera built from trunk source with maven
>            Reporter: Stefano Linguerri
>         Attachments: testentry.xml
>
>
> This is on Trunk.
> The method FOMParser.parse(InputStream in, String base, ParserOptions options) use FOMSniffingInputStream this class is the problem.
> FOMSniffingInputStream left the mark of inputstrem moved
> So when the input stream is passed to the parser an exception occurs.
> Two stupid test methods for Junit to verify the bug:
> This WORK:
>  @Test
>   public void testXMLFromFileWithoutFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }
> This THROWS EXECEPTION
>   @Test
>   public void testXMLFromFileWithFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMSniffingInputStream fomSniffingInputStream = new FOMSniffingInputStream(is);
>     fomSniffingInputStream.getEncoding();
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (ABDERA-170) FOMParser.parse( InputStream in, String base, ParserOptions options) throws exeception

Posted by "Stefano Linguerri (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ABDERA-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600468#action_12600468 ] 

eljeko edited comment on ABDERA-170 at 5/28/08 6:19 AM:
-------------------------------------------------------------------

added the entry I used to test as attach

      was (Author: eljeko):
    The entry I used to test.
  
> FOMParser.parse(    InputStream in,     String base,     ParserOptions options) throws exeception
> -------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-170
>                 URL: https://issues.apache.org/jira/browse/ABDERA-170
>             Project: Abdera
>          Issue Type: Bug
>         Environment: linux Ubuntu 7.10, jvm Sun 1.6.0._03, abdera built from trunk source with maven
>            Reporter: Stefano Linguerri
>         Attachments: testentry.xml
>
>
> This is on Trunk.
> The method FOMParser.parse(InputStream in, String base, ParserOptions options) use FOMSniffingInputStream this class is the problem.
> FOMSniffingInputStream left the mark of inputstrem moved
> So when the input stream is passed to the parser an exception occurs.
> Two stupid test methods for Junit to verify the bug:
> This WORK:
>  @Test
>   public void testXMLFromFileWithoutFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }
> This THROWS EXECEPTION
>   @Test
>   public void testXMLFromFileWithFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMSniffingInputStream fomSniffingInputStream = new FOMSniffingInputStream(is);
>     fomSniffingInputStream.getEncoding();
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: Summary as a Div

Posted by M Harris <md...@yahoo.com>.
Regardless of the namespace I get the result <summary type="text"> instead of <summary type="xhtml"> when I use setSummary(div) method. This is because in FOMFactory newSummary(Element parent) creates a newSummary of type TEXT.

Jim Ancona <ji...@anconafamily.com> wrote: I'm pretty sure that the parser used in Abdera will only generate 
declarations for namespaces that are actually *used*. Try doing

div.setAttributeValue(new QName("http://www.somensurl.com/something", 
"foo"), "bar");

That should generate a namespace declaration.

Jim

M Harris wrote:
> I should add that in FOMEntry I see
> setSummary(Div div) method calls the factory's newSummary() method passing the Div... But in FOMFactory newSummary only takes arguments Element, Text.Type.. So it returns newSummary(Text.Type.TEXT, parent) - treats the div as if it is a parent.  
> 
> It doesn't work as I think it should work or the way you say it should work... 
> 
> I have version .4... is there a patch?
> 
> M Harris  wrote: I've tried that to and I get this result:
> 
> code:
> Div div = factory.newDiv(); 
> div.setText("test value"); 
> div.declareNS("http://www.somensurl.com/something", "prefix");
> entry.setSummary(div);
> 
> result:
> 



       

Re: Summary as a Div

Posted by James M Snell <ja...@gmail.com>.
Fix checked into trunk. fwiw, this problem also affected all the other 
text construct methods that accepted the Div. Great catch, thank you.

- James

M Harris wrote:
> I had to change Abdera code to get the desired result:
> 
> public Text setSummary(Div value){
>   FOMFactory factory = (FOMFactory)this.factory;
>   Text text = factory.newSummary(Text.Type.XHTML);
>   text.setValueElement(value);
>   setSummaryElement(text);
>   return text;
> }
> 
> Jim Ancona <ji...@anconafamily.com> wrote: I'm pretty sure that the parser used in Abdera will only generate 
> declarations for namespaces that are actually *used*. Try doing
> 
> div.setAttributeValue(new QName("http://www.somensurl.com/something", 
> "foo"), "bar");
> 
> That should generate a namespace declaration.
> 
> Jim
> 
> M Harris wrote:
>> I should add that in FOMEntry I see
>> setSummary(Div div) method calls the factory's newSummary() method passing the Div... But in FOMFactory newSummary only takes arguments Element, Text.Type.. So it returns newSummary(Text.Type.TEXT, parent) - treats the div as if it is a parent.  
>>
>> It doesn't work as I think it should work or the way you say it should work... 
>>
>> I have version .4... is there a patch?
>>
>> M Harris  wrote: I've tried that to and I get this result:
>>
>> code:
>> Div div = factory.newDiv(); 
>> div.setText("test value"); 
>> div.declareNS("http://www.somensurl.com/something", "prefix");
>> entry.setSummary(div);
>>
>> result:
>>
> 
> 
> 
>        

Re: Summary as a Div

Posted by James M Snell <ja...@gmail.com>.
Ok, yeah, sorry for the delay on this but there's definitely a bug here. 
  Will get it fixed.

- James

M Harris wrote:
> I had to change Abdera code to get the desired result:
> 
> public Text setSummary(Div value){
>   FOMFactory factory = (FOMFactory)this.factory;
>   Text text = factory.newSummary(Text.Type.XHTML);
>   text.setValueElement(value);
>   setSummaryElement(text);
>   return text;
> }
> 
> Jim Ancona <ji...@anconafamily.com> wrote: I'm pretty sure that the parser used in Abdera will only generate 
> declarations for namespaces that are actually *used*. Try doing
> 
> div.setAttributeValue(new QName("http://www.somensurl.com/something", 
> "foo"), "bar");
> 
> That should generate a namespace declaration.
> 
> Jim
> 
> M Harris wrote:
>> I should add that in FOMEntry I see
>> setSummary(Div div) method calls the factory's newSummary() method passing the Div... But in FOMFactory newSummary only takes arguments Element, Text.Type.. So it returns newSummary(Text.Type.TEXT, parent) - treats the div as if it is a parent.  
>>
>> It doesn't work as I think it should work or the way you say it should work... 
>>
>> I have version .4... is there a patch?
>>
>> M Harris  wrote: I've tried that to and I get this result:
>>
>> code:
>> Div div = factory.newDiv(); 
>> div.setText("test value"); 
>> div.declareNS("http://www.somensurl.com/something", "prefix");
>> entry.setSummary(div);
>>
>> result:
>>
> 
> 
> 
>        

Re: Summary as a Div

Posted by M Harris <md...@yahoo.com>.
I had to change Abdera code to get the desired result:

public Text setSummary(Div value){
  FOMFactory factory = (FOMFactory)this.factory;
  Text text = factory.newSummary(Text.Type.XHTML);
  text.setValueElement(value);
  setSummaryElement(text);
  return text;
}

Jim Ancona <ji...@anconafamily.com> wrote: I'm pretty sure that the parser used in Abdera will only generate 
declarations for namespaces that are actually *used*. Try doing

div.setAttributeValue(new QName("http://www.somensurl.com/something", 
"foo"), "bar");

That should generate a namespace declaration.

Jim

M Harris wrote:
> I should add that in FOMEntry I see
> setSummary(Div div) method calls the factory's newSummary() method passing the Div... But in FOMFactory newSummary only takes arguments Element, Text.Type.. So it returns newSummary(Text.Type.TEXT, parent) - treats the div as if it is a parent.  
> 
> It doesn't work as I think it should work or the way you say it should work... 
> 
> I have version .4... is there a patch?
> 
> M Harris  wrote: I've tried that to and I get this result:
> 
> code:
> Div div = factory.newDiv(); 
> div.setText("test value"); 
> div.declareNS("http://www.somensurl.com/something", "prefix");
> entry.setSummary(div);
> 
> result:
> 



       

Re: Summary as a Div

Posted by Jim Ancona <ji...@anconafamily.com>.
I'm pretty sure that the parser used in Abdera will only generate 
declarations for namespaces that are actually *used*. Try doing

div.setAttributeValue(new QName("http://www.somensurl.com/something", 
"foo"), "bar");

That should generate a namespace declaration.

Jim

M Harris wrote:
> I should add that in FOMEntry I see
> setSummary(Div div) method calls the factory's newSummary() method passing the Div... But in FOMFactory newSummary only takes arguments Element, Text.Type.. So it returns newSummary(Text.Type.TEXT, parent) - treats the div as if it is a parent.  
> 
> It doesn't work as I think it should work or the way you say it should work... 
> 
> I have version .4... is there a patch?
> 
> M Harris <md...@yahoo.com> wrote: I've tried that to and I get this result:
> 
> code:
> Div div = factory.newDiv(); 
> div.setText("test value"); 
> div.declareNS("http://www.somensurl.com/something", "prefix");
> entry.setSummary(div);
> 
> result:
> 


Re: Summary as a Div

Posted by M Harris <md...@yahoo.com>.
I should add that in FOMEntry I see
setSummary(Div div) method calls the factory's newSummary() method passing the Div... But in FOMFactory newSummary only takes arguments Element, Text.Type.. So it returns newSummary(Text.Type.TEXT, parent) - treats the div as if it is a parent.  

It doesn't work as I think it should work or the way you say it should work... 

I have version .4... is there a patch?

M Harris <md...@yahoo.com> wrote: I've tried that to and I get this result:

code:
Div div = factory.newDiv(); 
div.setText("test value"); 
div.declareNS("http://www.somensurl.com/something", "prefix");
entry.setSummary(div);

result:





James M Snell  wrote: In that case, you can create the div, then call the setSummary(div) method.

- James

M Harris wrote:
> That works to an extent but I can't figure out how to get other namespaces in the div element
> I need this:
> 
> 
> By doing setSummaryAsXhtml it seems to put the div automatically and not allow me to add other namespaces.
> 
> 
> James M Snell  wrote: This should do it:
> 
> entry.setSummaryAsXhtml("Some information here with a 
> class=\"..\">and a date formatted in XML format");
> 
> - James
> 
> M Harris wrote:
>> I'm a bit confused by reading the API.  I can't figure out how to get the desired result
>>
>>
>>     
>>         Some information here with a  and a date formatted in XML format
>>    
> 
>>
>> within an entry
>>
>> I tried creating a div with simple text but that did not even show up at all.
>>
>>        
> 
> 
>        



       

       

Re: Summary as a Div

Posted by M Harris <md...@yahoo.com>.
I've tried that to and I get this result:

code:
Div div = factory.newDiv(); 
div.setText("test value"); 
div.declareNS("http://www.somensurl.com/something", "prefix");
entry.setSummary(div);

result:
<summary type="text"></summary>




James M Snell <ja...@gmail.com> wrote: In that case, you can create the div, then call the setSummary(div) method.

- James

M Harris wrote:
> That works to an extent but I can't figure out how to get other namespaces in the div element
> I need this:
> 
> 
> By doing setSummaryAsXhtml it seems to put the div automatically and not allow me to add other namespaces.
> 
> 
> James M Snell  wrote: This should do it:
> 
> entry.setSummaryAsXhtml("Some information here with a 
> class=\"..\">and a date formatted in XML format");
> 
> - James
> 
> M Harris wrote:
>> I'm a bit confused by reading the API.  I can't figure out how to get the desired result
>>
>>
>>     
>>         Some information here with a  and a date formatted in XML format
>>    
> 
>>
>> within an entry
>>
>> I tried creating a div with simple text but that did not even show up at all.
>>
>>        
> 
> 
>        



       

Re: Summary as a Div

Posted by James M Snell <ja...@gmail.com>.
In that case, you can create the div, then call the setSummary(div) method.

- James

M Harris wrote:
> That works to an extent but I can't figure out how to get other namespaces in the div element
> I need this:
> <div xmlns:p="http://www.example.com/p" xmlns="http://www.w3.org/1999/xhtml">
> 
> By doing setSummaryAsXhtml it seems to put the div automatically and not allow me to add other namespaces.
> 
> 
> James M Snell <ja...@gmail.com> wrote: This should do it:
> 
> entry.setSummaryAsXhtml("Some information here with a 
> class=\"..\">and a date formatted in XML format");
> 
> - James
> 
> M Harris wrote:
>> I'm a bit confused by reading the API.  I can't figure out how to get the desired result
>>
>>
>>     
>>         Some information here with a  and a date formatted in XML format
>>    
> 
>>
>> within an entry
>>
>> I tried creating a div with simple text but that did not even show up at all.
>>
>>        
> 
> 
>        

Re: Summary as a Div

Posted by M Harris <md...@yahoo.com>.
That works to an extent but I can't figure out how to get other namespaces in the div element
I need this:
<div xmlns:p="http://www.example.com/p" xmlns="http://www.w3.org/1999/xhtml">

By doing setSummaryAsXhtml it seems to put the div automatically and not allow me to add other namespaces.


James M Snell <ja...@gmail.com> wrote: This should do it:

entry.setSummaryAsXhtml("Some information here with a 
class=\"..\">and a date formatted in XML format");

- James

M Harris wrote:
> I'm a bit confused by reading the API.  I can't figure out how to get the desired result
> 
> 
>     
>         Some information here with a  and a date formatted in XML format
>    

> 
> 
> within an entry
> 
> I tried creating a div with simple text but that did not even show up at all.
> 
>        


       

Re: Summary as a Div

Posted by James M Snell <ja...@gmail.com>.
This should do it:

entry.setSummaryAsXhtml("Some information here with a <span 
class=\"..\">and</span> a date formatted in XML format");

- James

M Harris wrote:
> I'm a bit confused by reading the API.  I can't figure out how to get the desired result
> 
> <summary type="xhtml">
>     <div xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://www.example.org/p">
>         Some information here with a <span class=".."> and a date formatted in XML format
>    </div>
> </summary>
> 
> within an entry
> 
> I tried creating a div with simple text but that did not even show up at all.
> 
>        

Summary as a Div

Posted by M Harris <md...@yahoo.com>.
I'm a bit confused by reading the API.  I can't figure out how to get the desired result

<summary type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://www.example.org/p">
        Some information here with a <span class=".."> and a date formatted in XML format
   </div>
</summary>

within an entry

I tried creating a div with simple text but that did not even show up at all.

       

[jira] Commented: (ABDERA-170) FOMParser.parse( InputStream in, String base, ParserOptions options) throws exeception

Posted by "Stefano Linguerri (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ABDERA-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602949#action_12602949 ] 

Stefano Linguerri commented on ABDERA-170:
------------------------------------------

I use maven with jetty plugin (jetty-6.1.1).
But I also have the problem out of the web container as in the tests examples I posted.


> FOMParser.parse(    InputStream in,     String base,     ParserOptions options) throws exeception
> -------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-170
>                 URL: https://issues.apache.org/jira/browse/ABDERA-170
>             Project: Abdera
>          Issue Type: Bug
>         Environment: linux Ubuntu 7.10, jvm Sun 1.6.0._03, abdera built from trunk source with maven
>            Reporter: Stefano Linguerri
>         Attachments: testentry.xml
>
>
> This is on Trunk.
> The method FOMParser.parse(InputStream in, String base, ParserOptions options) use FOMSniffingInputStream this class is the problem.
> FOMSniffingInputStream left the mark of inputstrem moved
> So when the input stream is passed to the parser an exception occurs.
> Two stupid test methods for Junit to verify the bug:
> This WORK:
>  @Test
>   public void testXMLFromFileWithoutFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }
> This THROWS EXECEPTION
>   @Test
>   public void testXMLFromFileWithFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMSniffingInputStream fomSniffingInputStream = new FOMSniffingInputStream(is);
>     fomSniffingInputStream.getEncoding();
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ABDERA-170) FOMParser.parse( InputStream in, String base, ParserOptions options) throws exeception

Posted by "James M Snell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ABDERA-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600671#action_12600671 ] 

James M Snell commented on ABDERA-170:
--------------------------------------

FOMSniffingInputStream and FOMParser are not really meant to be used directly like this.  Use this pattern instead:

    //...
    Parser parser = abdera.getParser();
    ParserOptions options = parser.getDefaultParserOptions();
    options.setAutodetectCharset(true);
    
    Document<Element> doc = parser.parse(is, options);
    
    System.out.println(doc.getRoot().toString());    
    System.out.println(doc.getCharset());

FOMParser uses FOMSniffingInputStream internally to do the charset detection.

> FOMParser.parse(    InputStream in,     String base,     ParserOptions options) throws exeception
> -------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-170
>                 URL: https://issues.apache.org/jira/browse/ABDERA-170
>             Project: Abdera
>          Issue Type: Bug
>         Environment: linux Ubuntu 7.10, jvm Sun 1.6.0._03, abdera built from trunk source with maven
>            Reporter: Stefano Linguerri
>         Attachments: testentry.xml
>
>
> This is on Trunk.
> The method FOMParser.parse(InputStream in, String base, ParserOptions options) use FOMSniffingInputStream this class is the problem.
> FOMSniffingInputStream left the mark of inputstrem moved
> So when the input stream is passed to the parser an exception occurs.
> Two stupid test methods for Junit to verify the bug:
> This WORK:
>  @Test
>   public void testXMLFromFileWithoutFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }
> This THROWS EXECEPTION
>   @Test
>   public void testXMLFromFileWithFOMSniffingInputStream() throws Exception {
>     File file = new File("testentry.xml");
>     Abdera abdera = new Abdera();
>     FileInputStream is = new FileInputStream(file);
>     FOMSniffingInputStream fomSniffingInputStream = new FOMSniffingInputStream(is);
>     fomSniffingInputStream.getEncoding();
>     FOMParser fomParser = new FOMParser(abdera);
>     Document<Element> doc = fomParser.parse(is);
>     doc.getRoot().toString();
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.