You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Notion, Endre Furnes" <en...@notion.no> on 2001/11/07 16:28:49 UTC

sorting attributes

Hi all. I'm a newbee to xerces. Has just replaced the crimson with xerces, and access it via jaxp interface.

The reason why I replaced the parser, was that crimson removed '\n' and '\t' from the attribute values. (I'll do that myself). Also some annoyment in relative versus absolute dtd pointing in crimson. Xerces is fine in both respects. However, Xerces "sorts" the attributes according to name? Crimson did not. Been looking all over for a way to switch that off, but does not find a way.

Anyone give be a hint?

Thks and best regards

Endre Furnes

Re: sorting attributes

Posted by Dennis Sosnoski <dm...@sosnoski.com>.
If Xerces is *not* removing '\n' and '\t' from attribute values 
(actually, replacing them with space characters) it has a problem - this 
is supposed to be done by all XML processors. See XML recommendation 
section 3.3.3 Attribute-Value Normalization for details.

  - Dennis

Notion, Endre Furnes wrote:

> Hi all. I'm a newbee to xerces. Has just replaced the crimson with 
> xerces, and access it via jaxp interface.
>
>  
>
> The reason why I replaced the parser, was that crimson removed '\n' 
> and '\t' from the attribute values. (I'll do that myself). Also some 
> annoyment in relative versus absolute dtd pointing in crimson. Xerces 
> is fine in both respects. However, Xerces "sorts" the attributes 
> according to name? Crimson did not. Been looking all over for a way to 
> switch that off, but does not find a way.
>
>  
>
> Anyone give be a hint?
>
>  
>
> Thks and best regards
>
>  
>
> Endre Furnes
>



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


SV: sorting attributes

Posted by "Notion, Endre Furnes" <en...@notion.no>.
Sorry, I've missed that point. I can use them, anyhow.

I use the xerces-2.0.0 beta2

Endre Furnes
Notion
----- Original Message ----- 
From: Elena Litani <el...@ca.ibm.com>
To: <xe...@xml.apache.org>
Sent: Wednesday, November 07, 2001 8:28 PM
Subject: Re: sorting attributes


> 
> 
> "Notion, Endre Furnes" wrote: 
> >The reason why I replaced the parser, was that crimson removed 
> > '\n' and '\t' from the attribute values. (I'll do that myself).
> > Xerces is fine in both respects. 
> 
> This is really interesting.. What version of Xerces are you using? 
> Xerces conforms to XML 1.0 Attribute normalization (unless we have a
> bug..).
> 
> Thanks,
> 
> -- 
> Elena Litani / IBM Toronto
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: sorting attributes

Posted by Elena Litani <el...@ca.ibm.com>.

"Notion, Endre Furnes" wrote: 
>The reason why I replaced the parser, was that crimson removed 
> '\n' and '\t' from the attribute values. (I'll do that myself).
> Xerces is fine in both respects. 

This is really interesting.. What version of Xerces are you using? 
Xerces conforms to XML 1.0 Attribute normalization (unless we have a
bug..).

Thanks,

-- 
Elena Litani / IBM Toronto

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


SV: sorting attributes

Posted by "Notion, Endre Furnes" <en...@notion.no>.
Hi Scott, thks for taking interest.

I'm building a GUI, presenting xml on screen. Its ment to work at all xml objects, not only my own. So it's not my choice, if the file contains attribute, it's displayed.

I could mail you a screen shot, if you like.

Thks and regards

Endre Furnes
Notion
  ----- Original Message ----- 
  From: Scott Moore 
  To: xerces-j-user@xml.apache.org 
  Sent: Wednesday, November 07, 2001 9:48 PM
  Subject: Re: sorting attributes


  I'm not sure I follow what you are trying to do, but if order is important, then use <Elements> instead of attributes.  The XML spec guarantees elements will remain in the same order they are created in.

  Scott
    ----- Original Message ----- 
    From: Notion, Endre Furnes 
    To: xerces-j-user@xml.apache.org 
    Sent: Wednesday, November 07, 2001 2:20 PM
    Subject: SV: sorting attributes


    Thks for rapid responce, Scott. 
     
    A pitty, though that I can't switch that off. Looking at it, cocoon's build file has sorted attributes, so I'm sure you are right. The thing is, I'm working on a GUI, and I think it matters for clarity that the ex. build file says:  -name, -depends, -if, -unless and not in sorted appearance:  -depends, -if, -name, -unless. I can't rearrange them, as it should be the author's privilege to decide what comes first and what comes last.

Re: sorting attributes

Posted by Scott Moore <sc...@netdecide.com>.
I'm not sure I follow what you are trying to do, but if order is important, then use <Elements> instead of attributes.  The XML spec guarantees elements will remain in the same order they are created in.

Scott
  ----- Original Message ----- 
  From: Notion, Endre Furnes 
  To: xerces-j-user@xml.apache.org 
  Sent: Wednesday, November 07, 2001 2:20 PM
  Subject: SV: sorting attributes


  Thks for rapid responce, Scott. 
   
  A pitty, though that I can't switch that off. Looking at it, cocoon's build file has sorted attributes, so I'm sure you are right. The thing is, I'm working on a GUI, and I think it matters for clarity that the ex. build file says:  -name, -depends, -if, -unless and not in sorted appearance:  -depends, -if, -name, -unless. I can't rearrange them, as it should be the author's privilege to decide what comes first and what comes last.

SV: sorting attributes

Posted by "Notion, Endre Furnes" <en...@notion.no>.
Thks for rapid responce, Scott. 

A pitty, though that I can't switch that off. Looking at it, cocoon's build file has sorted attributes, so I'm sure you are right. The thing is, I'm working on a GUI, and I think it matters for clarity that the ex. build file says:  -name, -depends, -if, -unless and not in sorted appearance:  -depends, -if, -name, -unless. I can't rearrange them, as it should be the author's privilege to decide what comes first and what comes last.

This is (nearly) as annoying as Crimsons removing of '\n' s and '\t' s in long attribute values. Why could they just not ignore them, and not remove them? For a machine it won't matter, for man it does. I'm sure the good Stefano Mazzocchi would like me to see the name fo the target first, in his build file for cocoon, as he has put so much effort in it, for me to understand :-)

Best regards to all

Endre Furnes
Notion
  ----- Original Message ----- 
  From: Scott Moore 
  To: xerces-j-user@xml.apache.org 
  Sent: Wednesday, November 07, 2001 5:18 PM
  Subject: Re: sorting attributes


  According to the XML standard, attribute order is not guaranteed and is implementation dependent.  So, (and I'm guessing here), I doubt there is a way to turn it off in Xerces.  They probably sort it in order to do a fast binary search lookup by attribute name, so the sorting is a side-effect of that implementation.

  Scott

    ----- Original Message ----- 
    From: Notion, Endre Furnes 
    To: xerces-j-user@xml.apache.org 
    Sent: Wednesday, November 07, 2001 10:28 AM
    Subject: sorting attributes


    Hi all. I'm a newbee to xerces. Has just replaced the crimson with xerces, and access it via jaxp interface.

    The reason why I replaced the parser, was that crimson removed '\n' and '\t' from the attribute values. (I'll do that myself). Also some annoyment in relative versus absolute dtd pointing in crimson. Xerces is fine in both respects. However, Xerces "sorts" the attributes according to name? Crimson did not. Been looking all over for a way to switch that off, but does not find a way.

    Anyone give be a hint?

    Thks and best regards

    Endre Furnes

Re: sorting attributes

Posted by Scott Moore <sc...@netdecide.com>.
According to the XML standard, attribute order is not guaranteed and is implementation dependent.  So, (and I'm guessing here), I doubt there is a way to turn it off in Xerces.  They probably sort it in order to do a fast binary search lookup by attribute name, so the sorting is a side-effect of that implementation.

Scott

  ----- Original Message ----- 
  From: Notion, Endre Furnes 
  To: xerces-j-user@xml.apache.org 
  Sent: Wednesday, November 07, 2001 10:28 AM
  Subject: sorting attributes


  Hi all. I'm a newbee to xerces. Has just replaced the crimson with xerces, and access it via jaxp interface.

  The reason why I replaced the parser, was that crimson removed '\n' and '\t' from the attribute values. (I'll do that myself). Also some annoyment in relative versus absolute dtd pointing in crimson. Xerces is fine in both respects. However, Xerces "sorts" the attributes according to name? Crimson did not. Been looking all over for a way to switch that off, but does not find a way.

  Anyone give be a hint?

  Thks and best regards

  Endre Furnes