Skip to content

Tag: xml

Echo specific value of a key of an array generated from an XML

I have the following code: That returns the following result: Now I want to echo the value of “CHANGEDATE”, but echo $array[“note”][“RESPONSE”][“CHANGE”][“TEST”][“CHANGEBY”]; returns nothing. Answer There’s no need to go to JSON, you can use your SimpleXML object directly: However, if you really want/need to, the root element note needs to be skipped: Demo:

XML file with different elements

Hello i have this xml file and i need to get data from element <are:ICO> with php, i tried this, but that shows me error, because of that “are:” i think, it shows me this error “Parse error: syntax error, unexpected token “:” in C:xampphtdocsxmldata.php on line 4″ Answer Since you are dealing with xml and namespaces, you should parse

Remove Namespace from child Element XML PHP

I am trying to create a xml file using simpleXML. This is the output that I need: But this is what I am getting when adding third parameter to the addChild func.: I have tried to leave the third parameter empty like this: $xml->addChild(‘g:id’, 123, ”); but it still adds it like this: <g:id xmlns:g=””>123</g:id> any ideas? Answer SimpleXMLElement::addChild needs

How to copy styles from generated file to target file

How to copy styles and numbering from generated file to target file Generated file image. In generated file bullet points are working fine when merge this to the target file getting issue Target file. The target file was copy of tempalte and a empty file. I assumed due to no numbering.xml it does not showing the bullets as bullets if

Add multiple images to product in prestashop

I would like to add several images in my product, the problem is that I don’t know how to do it, because for the moment I can only add one image via url! If someone has the solution or documentation, I would be interested! Thanks ! My code : Answer

Magento 2 Message Queue – Type Error with expected string, null given

I struggle for 3 days now to get a simple Message Queue in Magento 2 to work. Here are my XML files: communication.xml: queue_consumer.xml: queue_publisher.xml: queue_topology.xml: So adding messages to the queue works (I see it in the database table “queue_message”), however when I execute php bin/magento queue:consumers:start erp.queue.order I always get the following exception: My consumer test code: I

Get icon from XML URL

I am creating some EPG for the website. I do not have experience. Unfortunately, I’m finding it difficult. How can I get the icons, what is wrong in this code?` Answer If I understand you correctly, something like this should get you close to what I think you are trying to do. Note that not all programs have associated logos.

xPath problem while changing a XML file with PHP

I’m trying to modify a XML file. I tried same code with an more basic XML file and it worked perfectly. But when I use the same code for some other XML file with changing the path, I am getting this: This is the XML file: (I sign the line I want to change for example) So I use the