AaltoAsia / O-MI

Internet of Things data server implementing Open Messaging Interface and Open Data Format
BSD 4-Clause "Original" or "Old" License
22 stars 13 forks source link

quotes in <value> auto-escaped #19

Closed TK009 closed 5 years ago

TK009 commented 6 years ago

Problems

  1. O-MI node accepts values containing quotes without escaping, but automatically escapes it in read results. (Which is correct escape or not to escape?)
  2. Read result is escaped twice

Testing write request

<omiEnvelope xmlns="http://www.opengroup.org/xsd/omi/1.0/" version="1.0" ttl="0">
  <write msgformat="odf">
    <msg>
      <Objects xmlns="http://www.opengroup.org/xsd/odf/1.0/">
        <Object>
          <id>MyObject</id>
          <InfoItem name="quotesInValue">
            <value type="xs:string">"test"</value>
          </InfoItem>
          <InfoItem name="ampInValue">
            <value>test&amp;test</value>
          </InfoItem>
        </Object>
      </Objects>
    </msg>
  </write>
</omiEnvelope>

Read result

<omiEnvelope ttl="10" version="1.0" xmlns="http://www.opengroup.org/xsd/omi/1.0/">
  <response>
    <result msgformat="odf">
      <return returnCode="200">
      </return>
      <msg>
        <Objects xmlns="http://www.opengroup.org/xsd/odf/1.0/">
          <Object>
            <id>MyObject</id>
            <InfoItem name="quotesInValue">
              <value unixTime="1541609326"
                dateTime="2018-11-07T18:48:46.359+02:00"
                >&quot;test&quot;</value>
            </InfoItem>
            <InfoItem name="ampInValue">
              <value unixTime="1541609715"
                dateTime="2018-11-07T18:55:15.222+02:00"
                >test&amp;test</value>
            </InfoItem>
          </Object>
        </Objects>
      </msg>
    </result>
  </response>
</omiEnvelope>

Expected read result (?)

<omiEnvelope ttl="10" version="1.0" xmlns="http://www.opengroup.org/xsd/omi/1.0/">
  <response>
    <result msgformat="odf">
      <return returnCode="200">
      </return>
      <msg>
        <Objects xmlns="http://www.opengroup.org/xsd/odf/1.0/">
          <Object>
            <id>MyObject</id>
            <InfoItem name="quotesInValue">
              <value unixTime="1541609326"
                dateTime="2018-11-07T18:48:46.359+02:00"
                >"test"</value>
            </InfoItem>
            <InfoItem name="ampInValue">
              <value unixTime="1541609715"
                dateTime="2018-11-07T18:55:15.222+02:00"
                >test&amp;test</value>
            </InfoItem>
          </Object>
        </Objects>
      </msg>
    </result>
  </response>
</omiEnvelope>
TK009 commented 6 years ago

Double escaping fixed for v1.0.8 release

TK009 commented 6 years ago

dependency issue: https://github.com/scala/scala-xml/issues/57

TK009 commented 5 years ago

Fixed in version 2.0.0