-
Notifications
You must be signed in to change notification settings - Fork 2
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
Converting php object to xml is not working #17
Comments
Expected output Output Php object Level42\CSI\Classes\Entities\Mail_Request Object
) |
I'm really sorry but your PHP Object output is unreadable as is... Can you please paste us the Marshalling configuration for your objects ? |
Thank you very much for your immediate response. Really very sorry to says that i don't have any basic idea of "Marshalling configuration" and where to find this file.Could please tell me the path where to find the configuration of Marshalling. Please refer below lines. Each and every class have the following declaration before class definition. namespace Level42\CSI\Classes\Entities; use Level42\NotJaxbBundle\Annotation\XmlAttribute; My seniors have provided the following class for marshalling and unmarshalling....Now i am using object_2_xml() and xml_2_object methods. xmlUnmarshalling === null) { $cacheDir = __DIR__ . '/../../../cache/notjaxb-mapping-xml'; // Must be change $maxDepth = 20; // limit recursion $useCache = false; // set debug mode (no cache) $this->xmlUnmarshalling = new \Level42\NotJaxbBundle\Manager\XmlUnmarshalling( new \Level42\NotJaxbBundle\Mapping\ClassMetadataFactory( new \Level42\NotJaxbBundle\Annotation\AnnotationLoader( new \Doctrine\Common\Annotations\FileCacheReader( new \Doctrine\Common\Annotations\AnnotationReader(), $cacheDir, !$useCache), $maxDepth) ) ); } return $this->xmlUnmarshalling; } public function getMarshallerInstance() { if ($this->xmlMarshalling === null) { $cacheDir = __DIR__ . '/../../../cache/notjaxb-mapping-xml'; // Must be change $maxDepth = 20; // limit recursion $useCache = false; // set debug mode (no cache) $this->xmlMarshalling = new \Level42\NotJaxbBundle\Manager\XmlMarshalling( new \Level42\NotJaxbBundle\Mapping\ClassMetadataFactory( new \Level42\NotJaxbBundle\Annotation\AnnotationLoader( new \Doctrine\Common\Annotations\FileCacheReader( new \Doctrine\Common\Annotations\AnnotationReader(), $cacheDir, !$useCache), $maxDepth) ) ); } return $this->xmlMarshalling; } public function object_2_xml($object) { $xml = $this->getMarshallerInstance()->marshall($object); //echo "Object has converted to xml".$xml; return $xml; } public function xml_2_object($xml,$rootTag = null) { if(is_null($rootTag)) $rootTag = '\Level42\CSI\Classes\Entities\OTA_HotelDescriptiveInfoRS'; else $rootTag = '\Level42\CSI\Classes\Entities\\'.$rootTag; $object = $this->getUnmarshallerInstance()->unmarshall(trim($xml),$rootTag); return $object; } public function testFullMarshalling() { //echo "In the test full marshalling"; $xml = $this->getMarshallerInstance()->marshall($toMarshall); $xmlcommunicator = new \XMLCommunicator(); $xmlResponse = $xmlcommunicator->sendXMLdata(stripslashes(trim($xml))); //echo ' XmlResponse:'.$xmlResponse $xmlParseObject = $this->testFullUnmarshalling($xmlResponse); return $xmlParseObject; } public function testFullUnmarshalling($xml) { $xmlResponse = trim($xml); #echo ' XmlResponse' . $xmlResponse; $ParseObject = $this->getUnmarshallerInstance()->unmarshall($xmlResponse, '\Level42\CSI\Classes\Entities\OTA_HotelDescriptiveInfoRS'); return $ParseObject; } ``` } |
I am on yii project using level42 for unmarshalling untill now. Yes,I am doing same way as mentioned in the given link. Please find the following class. toList; } public function setToList($toList) { $this->toList[] = $toList; } /** - @xmllist(name="CcList",type="\Level42\CSI\Classes\Entities\CcList") */ private $ccList; public function getCcList() { return $this->ccList; } public function setCcList($ccList) { $this->ccList[] = $ccList; } /** - @xmllist(name="BccList",type="\Level42\CSI\Classes\Entities\BccList") */ private $bccList; public function getBccList() { return $this->bccList; } public function setBccList($bccList) { $this->bccList[] = $bccList; } /** - @xmllist(name="FailOver",type="\Level42\CSI\Classes\Entities\FailOver") */ private $failOver; public function getFailOver() { return $this->failOver; } public function setFailOver($failOver) { $this->failOver[] = $failOver; } } |
Dear Yann Eugoné, While trying to get out of this issue i noticed that metadata of my Attached document contains the my RecipientAddresses class and it's MetaData of RecipientAddresses On Thu, Dec 4, 2014 at 4:04 PM, Yann Eugoné [email protected]
|
I'm really sorry but the output you paste is not readable, please try something else than copy/pasting a var_dump if you want some help. |
We did not develop a way to configure the CDATA section appending... |
Thank you very much. |
Dear Team,
Please help me out of this issue as i was stopped my further developement here and need deliver the product to within few days.
Untill now i had used level42 for UnMarshaling only. But as per my new requirement i have an multiple php objects which have to be converted to individual xmls. But here my problem some of object fragments are not converting to xml . Attached document contains the php object,my desired output,actual oupt and level 42 files i am using.
Kind Regards,
Siva Kumar.
The text was updated successfully, but these errors were encountered: