Re: Some suggestions for the SOAP api

<quote author="Gmail Directeur">
Yes sure, but I'm talking about the "semantic" side of the soap
answer actually. It's IMHO supposed to give us "brut" information
without predefined styling and formatting. For example, the
<p class="helpwanted"> in the m:explanation tag is "superfluous"
since it's up to the response consumer to define its proper way
of formatting (html) and styling (css).
</quote>

Hello, I'm new to this group and just putting together my first 
Validator-SOAP client and I have to say that Gmail D is right here.

In one of my tests, I get an m:explanation that goes like:


<m:explanation>  <![CDATA[
    <p class="helpwanted">
      <a
        
href="http://validator.w3.org/feedback.html?uri=;errmsg_id=64#errormsg"
    title="Suggest improvements on this error message through our 
feedback channels"
      >&#x2709;</a>
    </p>

    <div class="ve mid-64">
    <p>
      The element named above was found in a context where it is not 
allowed.
      This could mean that you have incorrectly nested elements -- such as a
      "style" element in the "body" section instead of inside "head" -- or
      two elements that overlap (which is not allowed).
    </p>
    <p>
      One common cause for this error is the use of XHTML syntax in HTML
      documents. Due to HTML's rules of implicitly closed elements, this 
error
      can create cascading effects. For instance, using XHTML's 
"self-closing"
      tags for "meta" and "link" in the "head" section of a HTML 
document may
      cause the parser to infer the end of the "head" section and the
      beginning of the "body" section (where "link" and "meta" are not
      allowed; hence the reported error).
    </p>
  </div>

                  ]]>
</m:explanation>


This is tough - how do I use the style applied to: <div class="ve 
mid-64"> unless I build my own local stylesheet (or inline, etc)?  And 
what happens if you guys ever change the class attribute? (answer: my 
app breaks).  

Sure I can strip tags but then the whole "Suggest improvements on this 
error message" bit gets reduced to a '?'  So now I have to write a 
routine to strip out that symbol.  Not too hard but my code is now too 
tightly coupled to your choice of message.  If you ever change the 
format (say, add link text instead of the '?') my app breaks.

The point of SOAP is to get the data without the formatting -- 
otherwise, why not skip SOAP altogether and just have us parse the HTML 
version to get all our info?

If you guys think it is important to leave the HTML text in the 
explanation (for backwards compatibility or whatever), then I'd suggest 
solving it with something like:


<m:explanation>
  <![CDATA[
    <p class="helpwanted">
      <a 
href="http://validator.w3.org/feedback.html?uri=;errmsg_id=64#errormsg"...</a>
    </p>

    <div class="ve mid-64">
    <p>
      The element named above was found in a context blah blah blah...
    </p>
    <p>
      One common cause for this error is the blah blah blah...
    </p>
    </div>
  ]]>
</m:explanation>

<m:explanationcontent>
  <m:explanationfeedbacklink>
     http://validator.w3.org/feedback.html?uri=;errmsg_id=64#errormsg
  </m:explanationfeedbacklink>

  <m:explanationfeedbacktext>
     Suggest improvements on this error message through our feedback 
channels
  </m:explanationfeedbacktext>

  <m:explanationtext>
    The element named above was found in a context blah blah blah...
  </m:explanationtext>

  <m:explanationtext>
    One common cause for this error is the blah blah blah...
  </m:explanationtext>
<m:explanationcontent>


Of course my tag names choices here are irrelevant -- pick whatever you 
like.  You could even put my <m:explanationcontent> inside the existing 
</m:explanation> along with the <CDATA> if you prefer.  The point is to 
separate content and layout.

That way, if I want to create my on helpwanted link in the form of:
    <a href="http://validator.w3.org/feedback..." 
class="myFancyClass">Suggest improvements blah blah blah...</a>

or if I want my explanation text in a bulleted list with each paragraph 
separated by a <br /> (instead of wrapped in <p>'s inside <div>), I can 
do it easily.

No fancy parsing on my end and no code that is too tightly bound to your 
choice HTML layout.

I would think that this would be trivial to do on your end - but I've 
never seen your code.

-Chris

Received on Tuesday, 9 October 2007 10:51:58 UTC