You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by "machune (JIRA)" <ji...@apache.org> on 2008/08/18 12:11:44 UTC

[jira] Created: (ABDERA-198) Done't declare namespace correctly when calling addSimpleExtension(QName, String) many times to add a set of extension elements with same namespace.

Done't declare namespace correctly when calling addSimpleExtension(QName, String)  many times to add a set of extension elements with same namespace.
-----------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: ABDERA-198
                 URL: https://issues.apache.org/jira/browse/ABDERA-198
             Project: Abdera
          Issue Type: Bug
    Affects Versions: 0.3.0
            Reporter: machune


 Code snapshot is as follows:

final String OpenSearch_NS = "http://a9.com/-/spec/opensearch/1.1/";
 final String Total_Results = "totalResults";
final QName Total_Results_QN = new QName(OpenSearch_NS,"totalResults");
final String Items_Per_Pages = "itemsPerPage";
final QName Items_Per_Pages_QN = new QName(OpenSearch_NS,"itemsPerPage");
final int Item_Num_Per_Pages = 200;

Feed newFeed = new Abdera().newFeed();
newFeed.addSimpleExtension(Total_Results_QN,String.valueOf(getEntriesCount()));
newFeed.addSimpleExtension(Items_Per_Pages_QN,String.valueOf(Item_Num_Per_Pages));

the result is:
<feed xmlns="http://www.w3.org/2005/Atom">
<totalResults xmlns="http://a9.com/-/spec/opensearch/1.1/">23</totalResults >
<itemsPerPage>200</itemsPerPage>
</feed>

the element "itemsPerPage" has not correct namespace declaration.



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


[jira] Closed: (ABDERA-198) Done't declare namespace correctly when calling addSimpleExtension(QName, String) many times to add a set of extension elements with same namespace.

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

David Calavera closed ABDERA-198.
---------------------------------

    Resolution: Invalid

That code works fine in trunk. If you have to use 0.3.0 version I'm sure that the next code also works fine in that version:

IntegerElement items = feed.addExtension(OpenSearchExtensionFactory.ITEMS_PER_PAGE );
items.setText(itemsPerPage);
IntegerElement total = feed.addExtension(OpenSearchExtensionFactory.TOTAL_RESULTS );
total.setText(totalResults);
IntegerElement start = feed.addExtension(OpenSearchExtensionFactory.START_INDEX );
start.setText(startItem);

> Done't declare namespace correctly when calling addSimpleExtension(QName, String)  many times to add a set of extension elements with same namespace.
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-198
>                 URL: https://issues.apache.org/jira/browse/ABDERA-198
>             Project: Abdera
>          Issue Type: Bug
>    Affects Versions: 0.3.0
>            Reporter: machune
>
>  Code snapshot is as follows:
> final String OpenSearch_NS = "http://a9.com/-/spec/opensearch/1.1/";
>  final String Total_Results = "totalResults";
> final QName Total_Results_QN = new QName(OpenSearch_NS,"totalResults");
> final String Items_Per_Pages = "itemsPerPage";
> final QName Items_Per_Pages_QN = new QName(OpenSearch_NS,"itemsPerPage");
> final int Item_Num_Per_Pages = 200;
> Feed newFeed = new Abdera().newFeed();
> newFeed.addSimpleExtension(Total_Results_QN,String.valueOf(getEntriesCount()));
> newFeed.addSimpleExtension(Items_Per_Pages_QN,String.valueOf(Item_Num_Per_Pages));
> the result is:
> <feed xmlns="http://www.w3.org/2005/Atom">
> <totalResults xmlns="http://a9.com/-/spec/opensearch/1.1/">23</totalResults >
> <itemsPerPage>200</itemsPerPage>
> </feed>
> the element "itemsPerPage" has not correct namespace declaration.

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


[jira] Reopened: (ABDERA-198) Done't declare namespace correctly when calling addSimpleExtension(QName, String) many times to add a set of extension elements with same namespace.

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

machune reopened ABDERA-198:
----------------------------


Your code is different from my code.
in OpenSearchExtensionFactory, the  ITEMS_PER_PAGE declaration is:
static final QName ITEMS_PER_PAGE = new QName(OPENSEARCH_NS, ITEMS_PER_PAGE_LN, OS_PREFIX);
But in my code
final QName Items_Per_Pages_QN = new QName(OpenSearch_NS,"itemsPerPage");
I don't declare a prefix for the opensearch namespace.  If I add prefix of namespace in the Items_Per_Pages_QN declaration, I.E.
final QName Items_Per_Pages_QN = new QName(OpenSearch_NS,"itemsPerPage","os"); 
 it works well. 

So I guess, the problem should lie in the namespace declaration when calling addExtension() function, maybe you  did the check of prefix when declare a namespace. But it isn't true. For a namespace, it is ok if no prefix is specified for a namespace URI.





> Done't declare namespace correctly when calling addSimpleExtension(QName, String)  many times to add a set of extension elements with same namespace.
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-198
>                 URL: https://issues.apache.org/jira/browse/ABDERA-198
>             Project: Abdera
>          Issue Type: Bug
>    Affects Versions: 0.3.0
>            Reporter: machune
>
>  Code snapshot is as follows:
> final String OpenSearch_NS = "http://a9.com/-/spec/opensearch/1.1/";
>  final String Total_Results = "totalResults";
> final QName Total_Results_QN = new QName(OpenSearch_NS,"totalResults");
> final String Items_Per_Pages = "itemsPerPage";
> final QName Items_Per_Pages_QN = new QName(OpenSearch_NS,"itemsPerPage");
> final int Item_Num_Per_Pages = 200;
> Feed newFeed = new Abdera().newFeed();
> newFeed.addSimpleExtension(Total_Results_QN,String.valueOf(getEntriesCount()));
> newFeed.addSimpleExtension(Items_Per_Pages_QN,String.valueOf(Item_Num_Per_Pages));
> the result is:
> <feed xmlns="http://www.w3.org/2005/Atom">
> <totalResults xmlns="http://a9.com/-/spec/opensearch/1.1/">23</totalResults >
> <itemsPerPage>200</itemsPerPage>
> </feed>
> the element "itemsPerPage" has not correct namespace declaration.

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


[jira] Closed: (ABDERA-198) Done't declare namespace correctly when calling addSimpleExtension(QName, String) many times to add a set of extension elements with same namespace.

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

David Calavera closed ABDERA-198.
---------------------------------

    Resolution: Invalid

I know, I just show an alternative way to add opeanSearch elements properly with abdera 0.3.

Your code works fine with the development version, I get the next feed:

<feed xmlns="http://www.w3.org/2005/Atom"><id>http://example.com/opensearch+example</id><title type="text">QNames without prefix</title><updated>2008-08-20T09:27:36.585Z</updated><totalResults xmlns="http://a9.com/-/spec/opensearch/1.1/">47</totalResults><itemsPerPage xmlns="http://a9.com/-/spec/opensearch/1.1/">1</itemsPerPage></feed>

Thus, this is a problem that just affects to an older version and it shouldn't be a bug.

> Done't declare namespace correctly when calling addSimpleExtension(QName, String)  many times to add a set of extension elements with same namespace.
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ABDERA-198
>                 URL: https://issues.apache.org/jira/browse/ABDERA-198
>             Project: Abdera
>          Issue Type: Bug
>    Affects Versions: 0.3.0
>            Reporter: machune
>
>  Code snapshot is as follows:
> final String OpenSearch_NS = "http://a9.com/-/spec/opensearch/1.1/";
>  final String Total_Results = "totalResults";
> final QName Total_Results_QN = new QName(OpenSearch_NS,"totalResults");
> final String Items_Per_Pages = "itemsPerPage";
> final QName Items_Per_Pages_QN = new QName(OpenSearch_NS,"itemsPerPage");
> final int Item_Num_Per_Pages = 200;
> Feed newFeed = new Abdera().newFeed();
> newFeed.addSimpleExtension(Total_Results_QN,String.valueOf(getEntriesCount()));
> newFeed.addSimpleExtension(Items_Per_Pages_QN,String.valueOf(Item_Num_Per_Pages));
> the result is:
> <feed xmlns="http://www.w3.org/2005/Atom">
> <totalResults xmlns="http://a9.com/-/spec/opensearch/1.1/">23</totalResults >
> <itemsPerPage>200</itemsPerPage>
> </feed>
> the element "itemsPerPage" has not correct namespace declaration.

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