In the context of a WS developpment, I use the following schema:
<xs:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Apporteurs">
  <xs:complexType name="namedValue_t">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="name" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="Prospect">
    <xs:sequence>
      <xs:element name="values" type="namedValue_t" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="origine"     type="xs:string" />
    <xs:attribute name="prenom"      type="xs:string" />
    <xs:attribute name="nom"         type="xs:string" />
    <xs:attribute name="departement" type="xs:int" />
  </xs:complexType>
</xs:schema>
A valid XML for this schema is:
<?xml version="1.0"?>
<prospect
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="WS.xsd"
   origine     = "toto"
   prenom      = "Aubin"
   nom         = "MAHE"
   departement = "33">
   <values name="Prénom">Aubin</values>
   <values name="Nom">MAHE</values>
</prospect>
How to code this XML values into a PHP literal?
I try the following but I'm not sure because the server fail to handle WS request built with this data:
$prospect = array(
   'origine'     => 'test-origine',
   'prenom'      => 'Aubin',
   'nom'         => 'MAHE',
   'departement' => 33,
   'values'      => array());
$prospect['values'][] = array( 'name' => 'Prénom', 'value' => 'Aubin' );
$prospect['values'][] = array( 'name' => 'Nom'   , 'value' => 'MAHE'  );
When the two last lines are commented, the request is successfully executed.