[ 
https://issues.apache.org/jira/browse/JENA-560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13789254#comment-13789254
 ] 

Rob Vesse commented on JENA-560:
--------------------------------

This is the expected behavior for XML literals as defined by 
http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-rdf-XMLLiteral

Note that the text there states that the lexical space for literals is as 
follows:

{quote}
- which are well-balanced, self-contained XML content;
- for which encoding as UTF-8 yields exclusive Canonical XML (with comments, 
with empty InclusiveNamespaces PrefixList );
- for which embedding between an arbitrary XML start tag and an end tag yields 
a document conforming to XML Namespaces
{quote}

It the the exclusive Canonical XML which is relevant here, searching down the 
specification rabbit hole we find the following definition pertinent to 
attributes - http://www.w3.org/TR/2001/REC-xml-c14n-20010315#DocumentOrder

{quote}
- An element's attribute nodes are sorted lexicographically with namespace URI 
as the primary key and local name as the secondary key (an empty namespace URI 
is lexicographically least).

Lexicographic comparison, which orders strings from least to greatest 
alphabetically, is based on the UCS codepoint values, which is equivalent to 
lexicographic ordering based on UTF-8.
{quote}

Therefore your foo.nt example given violates this constraint because the b-c 
attribute occurs before the a attribute, conversely your bar.nt example does 
respect this constraint and thus is considered valid.

> jena riotcmd.ntriples XMLLiteral warning for attribute order
> ------------------------------------------------------------
>
>                 Key: JENA-560
>                 URL: https://issues.apache.org/jira/browse/JENA-560
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: RIOT
>    Affects Versions: Jena 2.11.1
>         Environment: Jena:       VERSION: 2.11.1-SNAPSHOT
> Jena:       BUILD_DATE: 20131006-0756
> ARQ:        VERSION: 2.11.1-SNAPSHOT
> ARQ:        BUILD_DATE: 20131006-0756
> RIOT:       VERSION: 2.11.1-SNAPSHOT
> RIOT:       BUILD_DATE: 20131006-0756
>            Reporter: Sarven Capadisli
>
> Given foo.nt:
> {{<http://example.org/1> <http://purl.org/dc/terms/description> "<div 
> xmlns=\"http://www.w3.org/1999/xhtml\"; xml:lang=\"en\"><p b-c=\"bar\" 
> a=\"foo\">3</p></div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>
>  .}}
> {quote}
> $ java riotcmd.ntriples --validate foo.nt
> WARN  [line: 1, col: 63] Lexical form '<div 
> xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en"><p b-c="bar" 
> a="foo">3</p></div>' not valid for datatype 
> http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral
> {quote}
> Changing the attribute order in p, given bar.nt:
> {{<http://example.org/1> <http://purl.org/dc/terms/description> "<div 
> xmlns=\"http://www.w3.org/1999/xhtml\"; xml:lang=\"en\"><p a=\"foo\" 
> b-c=\"bar\">3</p></div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>
>  .}}
> {quote}
> $ java riotcmd.ntriples --validate bar.nt
> {quote}
> does not throw warnings.
> The expectation is that, foo.nt should not throw an error.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to