<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<p>A huge issue with any interchange protocol is not just defining
what you are exchanging but how it's exchanged. The entire point
of the RFC effort is to define what is what. Take for example
section 4.2.7.6 from the draft RFC:</p>
<p id="section-4.2.7.6-2" style="padding: 0px; margin: 0px 0px 1em;
text-align: left; color: rgb(34, 34, 34); font-family: "Noto
Sans", Arial, Helvetica, sans-serif; font-size: 14px;
font-style: normal; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: 400; letter-spacing:
normal; orphans: 2; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial;">Command:<span> </span><code
style="background-color: rgb(248, 248, 248); font-family:
"Roboto Mono", monospace; font-size: 13.3px;">LIST UPS</code></p>
<p id="section-4.2.7.6-3" style="padding: 0px; margin: 0px 0px 1em;
text-align: left; color: rgb(34, 34, 34); font-family: "Noto
Sans", Arial, Helvetica, sans-serif; font-size: 14px;
font-style: normal; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: 400; letter-spacing:
normal; orphans: 2; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial;">The response is:</p>
<div id="section-4.2.7.6-4" style="position: relative; margin: 0px;
color: rgb(34, 34, 34); font-family: "Noto Sans", Arial,
Helvetica, sans-serif; font-size: 14px; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
start; text-indent: 0px; text-transform: none; white-space:
normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width:
0px; background-color: rgb(255, 255, 255);
text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial;">
<pre class="sourcecode" style="background-color: rgb(249, 249, 249); font-family: "Roboto Mono", monospace; border: 1px solid rgb(238, 238, 238); margin: 0.5px 0px 0px; padding: 1em; overflow-x: auto; max-width: calc(100% - 22px); font-size: 13.3px; break-before: auto; break-after: auto; line-height: 1.12;">BEGIN LIST UPS
UPS <upsname> "<description>"
...
END LIST UPS</pre>
</div>
<p>The Command that is sent to the UPS is very rigidly defined - it
is "LIST UPS" with a newline at the end. A UPS that adheres to the
RFC has no choice but to accept that command, it MUST accept that
command and do what the command says, which is "<span
style="color: rgb(34, 34, 34); font-family: "Noto
Sans", Arial, Helvetica, sans-serif; font-size: 14px;
font-style: normal; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: 400; letter-spacing:
normal; orphans: 2; text-align: left; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); text-decoration-thickness:
initial; text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">to report a
list of the UPS units to which it is attached"</span></p>
<div class="moz-cite-prefix">The problem is in the response. It's
undefined. Whatever sent the LIST UPS command is expecting what?
An ASCII string terminated with newlines? Notice that there's a
statement in there about U+0022 QUOTATION MARK characters are
supposed to be part of the response because Roger already ran into
this issue.<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">But if you enclose the response in the
XML I posted earlier. The response would be:</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"><?xml version="1.0" encoding="UTF-8"
standalone="no"?>
<br>
<list_ups_response>
<br>
<parameter name="UPS">
<br>
<value>SmartUPS 1000</value></div>
<div class="moz-cite-prefix"> <value>APC
SmartUPS 1000 located on "accounting office" 3'rd
floor</value></div>
<div class="moz-cite-prefix"> </parameter>
<br>
<parameter name="UPS">
<br>
<value>Eaton 1000</value></div>
<div class="moz-cite-prefix">
<value></value>
</div>
<div class="moz-cite-prefix"> </parameter> <br>
</div>
<div class="moz-cite-prefix"></list_ups_response></div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">This gives the recipient a great deal
of information. On the first item, if for example the admin wants
to put quote characters in the response description - no big deal
at all</div>
<div class="moz-cite-prefix">The recipient also knows when the end
of the list is. The recipient also knows that on the second UPS
parameter that the sender deliberately has nothing in the
description. <br>
</div>
<div class="moz-cite-prefix">The RFC defines 2 values to the UPS
parameter and the recipient knows if a value was deliberately left
empty instead of making assumptions.<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">And there's already XML parsing
libraries out there and XML itself is defined. You can't put a
space in the parameter and the RFC can define how many values are
supposed</div>
<div class="moz-cite-prefix">to be returned from a parameter. You
don't get tripped up because some joker put a reserved character
into the response output and if you define XML as an output it</div>
<div class="moz-cite-prefix">automatically disallows using a
construction like </ in the UPS name itself, and if the NUT
daemon programs are outputting XML then they know to strip those
characters</div>
<div class="moz-cite-prefix">out of any UPS-provided description
that a user might have typed in at the UPS front panel.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">And all of the XML requirements can be
listed under a "SHOULD" in the RFC such that 'XML output is
optional but if it is made available then this is the format that
the</div>
<div class="moz-cite-prefix">responses are in' In essence you are
"reserving" the special characters used in XML for use in an
optional XML output.<br>
</div>
<p>Remember that you do NOT have to implement every last thing in an
RFC in code. You can define suggested future and experimental
things.</p>
<p>Ted</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 12/30/2021 4:49 AM, Greg Troxel
wrote:<br>
</div>
<blockquote type="cite" cite="mid:rmizgoi8dgt.fsf@s1.lexort.com">Posing
that question makes it clear to me that the XML situation is not
<pre class="moz-quote-pre" wrap="">baked enough to put in an RFC, and I think it's much better to document
what's already established, and then after the XML has settled down,
create a revision that includes XML also, along with any other fixes.
(As an aside, I wonder why there is XML instead of JSON. I suppose there
is schema benefit, but XML just seems so much more awkward these days.)
</pre>
</blockquote>
</body>
</html>