Fixed (un)marshalling of elements following a namespaced element #24

Closed
wants to merge 1 commit into
from

Projects

None yet

1 participant

@jakzal

Elements following a namespaced element are not unmarshalled. In the following example bas element would be null:

<qux xmlns="http://www.foobar.com/schema"
         xmlns:bat="http://www.foobaz.com/schema">
    <bat:baz>Baz</bat:baz>
    <bas>Bas</bas>
</qux>

Also, element prefix is not added during the marshalling. Classes:

namespace Doctrine\Tests\OXM\Entities\NamespaceEntities;

class Baz
{
    /**
     * @XmlValue(type="string")
     */
    public $title;
}

/**
 * @XmlRootEntity
 * @XmlNamespaces({
 *   @XmlNamespace(url="http://www.foobar.com/schema"),
 *   @XmlNamespace(url="http://www.foobaz.com/schema", prefix="bat")
 * })
 */
class Qux
{
    /**
     * @XmlElement(type="Doctrine\Tests\OXM\Entities\NamespaceEntities\Baz", name="baz", prefix="bat")
     */
    public $baz;

    /**
     * @XmlText(type="string", name="bas")
     */
    public $bas;
}

Would be marshalled to (baz would lack the namespace):

<qux xmlns="http://www.foobar.com/schema" 
        xmlns:bat="http://www.foobaz.com/schema">
    <baz>Baz</baz>
    <bas>Bas</bas>
</qux>

Note that doUnmarshal() method doesn't take prefix into account. I'm not sure if it's correct behavior. However, my fix is consistent with it.

@jakzal jakzal Fixed unmarshalling of elements which are present after a namespaced …
…element. Fixed marshalling of namespaced elements.
46d8e8b
@jakzal jakzal closed this Jan 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment