#14 Handle CDATA in VALUE strings

backlog
open
sfcb (22)
Standards
2015-01-19
2012-03-23
Dave Blaschke
No

According to the Specification for the Representation of CIM in XML with regard to strings in VALUE elements:

"3.2.3.1. VALUE

"The VALUE element is used to define a single (non-array and non-reference) CIM Property value, CIM Qualifier value, or a CIM Method Parameter value.

"<!ELEMENT VALUE (#PCDATA)>

"Values are not type-validatable using DTD, so each value appears in PCDATA format irrespective of the type. The TYPE attribute of the parent element will determine the (CIM) type of the value. The format of the PCDATA content depends on the CIM type, and is described in what follows.

"String Values

"If the CIM type is string, then the PCDATA value MUST be a sequence of zero or more UCS-2 characters. The value MUST NOT be surrounded by string delimiter characters (such as double-quote or single-quote). The actual representation of characters depends on the encoding attribute defined for the <?xml> processing instruction.

"If this value contains reserved XML characters, then this value MUST either be enclosed within the standard XML data escape sequence <![CDATA[ ... ]]>, or standard XML character escaping mechanisms MUST be applied to those characters.

"In particular if the content contains the ]]> sequence, the CDATA escape mechanism MUST NOT be used."

sfcb does not appear to support this. I sent a createInstance request that failed:

<--- request begin 2012.03.23 07:01:29.703 -----
<?xml version="1.0" encoding="UTF-8"?>

<CIM CIMVERSION="2.0" DTDVERSION="2.0">
<MESSAGE ID="547998" PROTOCOLVERSION="1.0">
<SIMPLEREQ>
<IMETHODCALL NAME="CreateInstance">
<LOCALNAMESPACEPATH>
<NAMESPACE NAME="root"/>
<NAMESPACE NAME="interop"/>
</LOCALNAMESPACEPATH>
<IPARAMVALUE NAME="NewInstance">
<INSTANCE CLASSNAME="CIM_ListenerDestinationCIMXML">
<PROPERTY NAME="CreationClassName" TYPE="string">
<VALUE>CIM_ListenerDestinationCIMXML</VALUE>
</PROPERTY>
<PROPERTY NAME="Destination" TYPE="string">
<VALUE>http://9.65.187.65:5999/create</VALUE>
</PROPERTY>
<PROPERTY NAME="Name" TYPE="string">
<VALUE><![CDATA[JSR48PegasusSampleListener1]]></VALUE>
</PROPERTY>
</INSTANCE>
</IPARAMVALUE>
</IMETHODCALL>
</SIMPLEREQ>
</MESSAGE>
</CIM>
---- request end ------>
<--- response begin 2012.03.23 07:01:29.843 ----
<?xml version="1.0" encoding="utf-8" ?>
<CIM CIMVERSION="2.0" DTDVERSION="2.0">
<MESSAGE ID="547998" PROTOCOLVERSION="1.0">
<SIMPLERSP>
<IMETHODRESPONSE NAME="CreateInstance">
<ERROR CODE="1" DESCRIPTION="invalid imethodcall XML"/>
</IMETHODRESPONSE>
</SIMPLERSP>
</MESSAGE>
</CIM>
---- response end ----->

Discussion

  • Dave Blaschke
    Dave Blaschke
    2012-03-23

    The Java CIM Client has no dependency on this, I am merely bringing the issue to your attention. The bug was reported within IBM Director between the Client and OpenPegasus.

     
  • Dave Blaschke
    Dave Blaschke
    2012-03-31

    Need to be able to handle multiple CDATA sections. From Andreas Maier:

    CIM-XML is silent about CDATA sections. The interpretation is that because CDATA sections are a standard XML ability, they are also allowed in CIM-XML.

    So we need to check the W3C XML spec on what it says about mixing: http://www.w3.org/TR/REC-xml/

    Rule [43] in subclause 3.1 clearly shows that CDATA sections (ABNF rule CDsect) can be mixed arbitrarily with character data (ABNF rule CharData), including multiple occurrences of CDATA sections in the same XML element content. The only thing that is excluded is nesting of CDATA sections.

     
  • Chris Buccella
    Chris Buccella
    2013-02-12

    • component: --> sfcb
     
  • Chris Buccella
    Chris Buccella
    2013-02-21

    Ticket moved from /p/sblim/bugs/2400/

    Can't be converted:

    • _component: sfcb
    • _milestone: Standards_Compliance
    • _priority: 5
     
    • category: --> Standards
    • milestone: Standards_Compliance --> 1.4.5
     
  • Chris Buccella
    Chris Buccella
    2013-03-08

    • milestone: 1.4.5 --> backlog
     
  • Andreas Maier
    Andreas Maier
    2015-01-19

    Note that DSP0201 2.4.0 has added section 5.1.1.4 "Escaping of element content and attribute values", which explains details on CDATA support, including the nesting of CDATA sections and how it can be mixed with XML-based escaping.
    Implementers of a fix for this bug should definitely read that section.