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

Conflict with tag having both the xml value and xml element #16

Open
narayanamurthy opened this issue Dec 3, 2014 · 10 comments
Open

Conflict with tag having both the xml value and xml element #16

narayanamurthy opened this issue Dec 3, 2014 · 10 comments

Comments

@narayanamurthy
Copy link

I'm having a problem while preparing XML.
If a tag contains both the sub-tags and value( yeah i have different XMLs ) and when i'm trying to set sub-tags it doesn't work and it only sets attributes or value not the sub-tags.

Here is the example from two XMLs.

  1.      <Body type="plain">
            <Text>Dear test,
                For your Information.,
                Kind Regards,
                test
            </Text>
        </Body>
    
  2.     <Subject> 
             Test mail
        </Subject>
        <Body Type="html">This is the sample text.</Body>
        <ToAddresses>[email protected],[email protected]</ToAddresses>
        <CcAddresses>[email protected]</CcAddresses>
        <BccAddresses>[email protected]</BccAddresses>
        <TemplateID>2123</TemplateID>
    
@yann-eugone
Copy link

Can you paste your marshalling model configuration ?

@narayanamurthy
Copy link
Author

Dear Yann Eugoné,

I am really sorry to say that I really do not know about "marshallong
entities configuration".

Kind Regards,
Narayana Murthy

On Wed, Dec 3, 2014 at 2:32 PM, Yann Eugoné [email protected]
wrote:

Can you paste your marshallong entities configuration ?


Reply to this email directly or view it on GitHub
#16 (comment)
.

@yann-eugone
Copy link

Ok, this Bundle is trying to achieve XML to object mapping, so it can help you building the (de)serialization (called marshalling and unmarshalling) rules of your objects to(from) XML.

But the bundle is not able to do this without some configuration...

Please read the doc

@narayanamurthy
Copy link
Author

Thanks for the reply.
I understand that the Bundle is not able to convert( Marshall ) object into XML.
But where can I change the configuration in this library.

@yann-eugone
Copy link

This Bundle IS able to :

  • marshall objects to XML
  • unmarshall objects from XML

Let's take an example

With the class :

namespace My\Bundle\Model;

use Level42\NotJaxbBundle\Annotation as Marshall;

/**
 * @Marshall\XmlObject(name="email")
 */
class Email
{
    /**
     * @Marshall\XmlElement(name="Subject")
     */
    protected $subject;

    /**
     * @Marshall\XmlElement(name="ToAddresses")
     */
    protected $toAddresses;
}

You can get such a XML :

<email>
    <Subject>Test mail</Subject>
    <ToAddresses>[email protected],[email protected]</ToAddresses>
</email>

@narayanamurthy
Copy link
Author

If also contails value like

[email protected]

the email class looks like this


/**
* @marshall\XmlValue
*/
protected $email_value;


Now when i am trying to set or its not working. If I remove the above fraction of code it is working fine. I do not know whats the problem. Hope you understood my problem.

@yann-eugone
Copy link

Ok, if I understand your need, you got such a XML ?

<email>
    [email protected] 
    <Subject>Test mail</Subject>
    <ToAddresses>[email protected],[email protected]</ToAddresses>
</email>

@narayanamurthy
Copy link
Author

No I do not have an xml like that. But I'm using different xmls which have
common Tags.

Like in 1st xml

testmail.test.com

in 2nd xml

Test mail [email protected],[email protected]

and I created class for "email" depending on the above two xmls. And i got
stuck here.

On Wed, Dec 3, 2014 at 4:35 PM, Yann Eugoné [email protected]
wrote:

Ok, if I understand your need, you got such a XML ?

[email protected] Test mail [email protected],[email protected]


Reply to this email directly or view it on GitHub
#16 (comment)
.

@yann-eugone
Copy link

Ok, I will have a look and try to reproduce to your issue later.

You can try using XmlRaw until we found a solution.

yann-eugone added a commit that referenced this issue Dec 4, 2014
@yann-eugone
Copy link

So, I tested your use case, and I got the same problem.
I think that this is caused by XmlValue, overriding the XML content within the marshalling process.

I created a new branch.

@fperinel what do you think we can do for this ?

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

2 participants