Preliminary rules for pointers usage

Hi group,

Here you have a mock-up for opening the discussion about rules for pointing best practices. This is not yet an exhaustive list, but could help to see if you think it's the right direction.


RULES FOR STRUCTURED LANGUAGES (such us XML or SGML based languages)
*********************************************************************


USING SINGLE POINTERS
----------------------


* General problems

- 1st character of the document (or no pointer at all?)

E.g. missing DOCTYPE


* Wrong attribute

- 1st character of the attribute

E.g. <image pretty="yes"/> Should point to the 'p' character.
            - 

* Missing attribute

- 1st character of the associated element where the attribute should be present (that is the '<' character of the start tag)

E.g. <image pretty="yes"/> (missing alt) Should point to the '<' character.
     -

* Wrong attribute value

- 1st character of the attribute value (ignoring the inverted commas if present)

E.g. <image height="forty-one pixels"/> Should point to the 'f' character.
                    -

* Wrong element 

- 1st character of the element (that is the '<' character of the start tag) 

E.g. <html><cool>me</cool></html> Should point to the second '<' character.
           -

* Missing element

- 1st character of the parent element (that is the '<' character of the start tag)

E.g. <head></head><body><p>Just an example</p></body> (No title included)
     -
Should point to the first '<' character.


* Syntactical error

- Beginning of the syntactical error

E.g. <a href="example.org/me&you">Go!</a> Should point to the '&' character.
                            -


USING COMPOUND POINTERS
------------------------


* Wrong attribute

- 1st and last character of the attribute

E.g. <image pretty="yes"/> Should point to the 'p' and 'y' characters.
            -    -

* Missing attribute

- 1st character of the associated element where the attribute should be present (that is the '<' character of the start tag and the '>' character of the end tag, or the '>', or the last character of the element content if the end tag has been omitted, or the '>' character of the start tag if there is no content element)

E.g. <image pretty="yes"/> (missing alt)
     -                   - 
Should point to the '<' and '>' characters.


* Wrong value

- 1st and last characters of the value (ignoring the inverted commas if present)

E.g. <image height="forty-one pixels"/> 
                    -              -
Should point to the 'f' and 's' characters.


* Wrong element 

- 1st and last characters of the element (that is the '<' character of the start tag and the '>' character of the end tag, or the '>', or the last character of the element content if the end tag has been omitted, or the '>' character of the start tag if there is no content element)

E.g. <html><cool>me</cool></html> 
           -             -
Should point to the second '<' character and the third '<' character.


* Missing element

- 1st and last characters of the parent element (that is the '<' character of the start tag and the '>' character of the end tag, or the '>', or the last character of the element content if the end tag has been omitted, or the '>' character of the start tag if there is no content element)

E.g. <head></head><body><p>Just an example</p></body> (No title included)
     -           -
Should point to the first '<' and the second '>' characters.


* Syntactical error

- Beginning and end of the syntactical error

E.g. <a href="example.org/me&you">Go!</a> 
                            -  -
Should point to the '&' and 'u' characters.



RULES FOR PLAIN TEXT (such us .txt or .css)
************************************

- Point always to the first relevant character (the closest to the problem itself) where the problem occurs.

E.g. "This is intentionally mispelling" 
                            -     

Points to the first letter of the misspelt word.

E.g. padding-bottom: -4px
                     -

Points to the first character of the property value ('-')

                              
- When using compound pointers point always to the first and last relevant characters (the closest to the problem itself).

E.g. "This is intentionally mispelling"
                            -        -

Points to the first and last letters of the misspelt word.

E.g. padding-bottom: -4px
                     -  -

Points to the first and last character of the property value ('-' and 'x')


Note that here I am following a report oriented approach in every example, pointing to the relevant element in each case, in opposition to a parser oriented approach where the pointers follow the parser rules.

For example, in the case of a missing attribute, with a report oriented approach one should point to the beginning of the element where the attribute is missing (or the hole element with compound pointers)

<image pretty="yes"/> (missing alt) Points to the first '<' character.
-

But with the parser approach the pointer usually point to the end of the element, where the parser has found that there's a missing attribute

<image pretty="yes"/> (missing alt) Points to the first '>' character.
                    -

IMO this approach make more sense for the purpose of the Pointers, but we need to discuss what of both we want to follow and the impact of following this one (Several tools already follow the "parser approach" e.g. html validator).



Regards,
 CI.

____________________

Carlos Iglesias

Fundación CTIC
Parque Científico-Tecnológico de Gijón
33203 - Gijón, Asturias, España
teléfono: +34 984291212
email: carlos.iglesias@fundacionctic.org
URL: http://www.fundacionctic.org 

Received on Wednesday, 17 September 2008 08:14:41 UTC