You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2009/03/09 17:39:00 UTC

[2.x] Update on the new OASIS SCA Property XML syntax support

Hi,

I changed the code to support the new OASIS SCA syntax for properties under 
r751079 [1].

Simply speaking, the property value can be declared in the following styles:

For properties as simple types:
* <property name="simpleProperty" value="100"/>
* <property name="simpleProperty">100</property>
* <property name="simpleProperty">
      <value>100</value>
  </property>

For properties as complexTypes:
* <property name="complexProperty">
        <value xmlns:c="http://customer" c:id="C01">
              <c:firstName>John</c:firstName>
              <c:lastName>Smith</c:lastName>
        </value>
  </property>

For properties as global elements:
* <property name="complexProperty">
        <c:customer xmlns:c="http://customer" c:id="C01">
              <c:firstName>John</c:firstName>
              <c:lastName>Smith</c:lastName>
        </c:customer>
  </property>

For properties with multiple values:
* <property name="multipleValuedProperty">
       <value>10</value>
       <value>20</value>
  </property>

* <property name="multipleValuedProperty">
        <value xmlns:c="http://customer" c:id="C01">
              <c:firstName>John</c:firstName>
              <c:lastName>Smith</c:lastName>
        </value>
        <value xmlns:c="http://customer" c:id="C02">
              <c:firstName>Jane</c:firstName>
              <c:lastName>Smith</c:lastName>
        </value>
  </property>

* <property name="multipleValuedProperty">
        <c:customer xmlns:c="http://customer" c:id="C01">
              <c:firstName>John</c:firstName>
              <c:lastName>Smith</c:lastName>
        </c:customer>
        <c:customer xmlns:c="http://customer" c:id="C02">
              <c:firstName>Jane</c:firstName>
              <c:lastName>Smith</c:lastName>
        </c:customer>
  </property>

Now the runtime parse the values into a DOM document, and the root element 
is <property>. The different styles of the value are normalized as child 
elements under property.

For example:
* <property name="simpleProperty" value="100"/> ==> 
<property><value>100</value></property>
* <property name="simpleProperty">100</property> ==> 
<property><value>100</value></property>

[1] http://svn.apache.org/viewvc?rev=751079&view=rev