You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by M Harris <md...@yahoo.com> on 2008/06/06 19:19:29 UTC
Summary as a Div
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.
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.
>
>