Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problems with xml namespaces after update #621

Closed
ghost opened this issue Aug 11, 2016 · 9 comments
Closed

problems with xml namespaces after update #621

ghost opened this issue Aug 11, 2016 · 9 comments

Comments

@ghost
Copy link

ghost commented Aug 11, 2016

i use jms/serializer to deserialize xml files to dto. After updating serializer via composer i have some problems with my project.

i have properties which are defined in a xml namespace and others that are not defined in a namespace. For example

<abc:myProperty>

or

 <aPropertyWithoutNamespace>

before update there was no problem to deserialize properties without namespace. now it seems that i must explicit define a namespace, otherwise the property will not be mapped.

To make things more clear.

Before update the following works fine:

/**
* @JMS\SerializedName("myProperty")
* @JMS\Type("string")
* @JMS\XmlElement(cdata=false)
*/
private $myProperty;

After update i have to define a namspace to get a mapped property. Like this.

/**
* @JMS\SerializedName("myProperty")
* @JMS\Type("string")
* @JMS\XmlElement(cdata=false, namespace="http://a.namespace.com")
*/
private $myProperty;

What i am doing wrong?

Please let me know, if you need more details.

Thanks Nico

@goetas
Copy link
Collaborator

goetas commented Aug 11, 2016

Hi, any chance to create a failing test case?

@goetas goetas added the bug label Aug 11, 2016
@goetas
Copy link
Collaborator

goetas commented Aug 11, 2016

What makes "myProperty" a namespaced element? is it contained in a namespaced one?

/**
* @JMS\SerializedName("myProperty")
* @JMS\Type("string")
* @JMS\XmlElement(cdata=false)
*/
private $myProperty;

@ghost
Copy link
Author

ghost commented Aug 11, 2016

I defined a class like this.

/**
* @JMS\XmlNamespace(uri="http://www.abc.de/xml/data/1.0")
* @JMS\XmlNamespace(prefix="ebd", uri="http://www.abc.de/xml/data_ebd/definitionen/1.0")
*/
class MyClass extends BaseClass

in MyClass i have a property

/**
* @JMS\SerializedName("myProp")
* @JMS\Type("string")
* @JMS\XmlElement(cdata=false)
*/
private $myProp;

Before update the property was mapped correctly. But now i have to redefine the namespace
http://www.abc.de/xml/data/1.0 for the property $myProp to get mapped data.

/**
* @JMS\SerializedName("myProp")
* @JMS\Type("string")
* @JMS\XmlElement(cdata=false, namespace="http://www.abc.de/xml/data/1.0")
*/
private $myProp;

@ghost
Copy link
Author

ghost commented Aug 11, 2016

Was this information more usefull?

@goetas
Copy link
Collaborator

goetas commented Aug 11, 2016

can you apply some formatting to your comment?

Hi, any chance to create a failing test case?

@ghost
Copy link
Author

ghost commented Aug 11, 2016

done. i hope it is better now. sorry ;)

@ghost
Copy link
Author

ghost commented Aug 11, 2016

i think i found the problem, but i am not sure. the xml files contains different prefixes for the same structure. for example ns1 instead of abc and revert. so maybe this is the reason for my problem.
i think this issue is specific to my domain an not a common error.

thank you for your fast response. i will close this issue

@ghost ghost closed this as completed Aug 11, 2016
@goetas
Copy link
Collaborator

goetas commented Aug 11, 2016

In case the problem persists, feel fee to open the issue again.

@goetas goetas removed the bug label Aug 11, 2016
@ghost
Copy link
Author

ghost commented Aug 11, 2016

thank you :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant