Skip to content
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.

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

Closed
wants to merge 1 commit into from
Closed

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

wants to merge 1 commit into from

Conversation

jakzal
Copy link
Contributor

@jakzal jakzal commented Feb 1, 2012

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.

…element. Fixed marshalling of namespaced elements.
@jakzal jakzal closed this Jan 27, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant