Skip to content
Advertisement

Tag: xml

How to convert XML to JSON in PHP

I want to convert som xml data into some pretty json data then output it into an api. The output is not the problem but it’s the formatting of the xml data. I’ve looked around, but haven’t gotten around making it as pretty as some of the online converters out there. this is the xml data structure: This converter can

Remove Child does not contain attribute value

I am practicing with XML DOM PHP parsing. I have such XML file (shorter version): I created attribute with name “id” and value “2” for two Tag elements. Now I would like to: Get only Tag elements which did not contain attribute ‘id=”2″‘; Get only Tag elements which contain only ‘id=”2″‘. For first case I created such code. Don’t know

Assign filename dynamically in a response

in my web application created with Laravel 8, I need to download an .xml file and the file name must be dynamically created, as per the title. this is because the file name is composed following a specific rule and having to include today’s date. $filename = ‘FirstPart_’.date(“Y-m-d”).’_000.xml’ so far to test the response and therefore the download I have

Parse through SOAP response

I am a beginner at SOAP and have been trying to figure how to parse through XML response when I call the SOAP API.I have already tried similar questions like this on stackoverflow but somehow they are not working for me. I want to access Village and VillageName tag in a loop . I am using below code to get

Error framework-extra-bundle Anotation “Unable to parse file […] The XML file is not valid.”

There is a recurring error in my Symfony projects since a few months. Every time a file at the root of the project is edited (even a space add in an a.txt file will reproduce the bug), I get this error. Unable to parse file “[RootPath]vendorsensioframework-extra-bundlesrcDependencyInjection/../Resources/configannotations.xml”: The XML file “[RootPath]vendorsensioframework-extra-bundlesrcDependencyInjection/../Resources/configannotations.xml” is not valid. The error is remove with the command

concatenate array values ​into string?

I have this array, is stored in a variable called $ data : and i want to add to another variable to send to an API but when i echo $body the result its like this: how can I add the string to have an output like this: thanks to all Answer If you’re using XML, it’s better to learn

Get text value of the last children of PHP DOM-XML takes too long time

This post is somewhat related to this post: Increase performance of PHP DOM-XML. Currently takes too long time . So it might be better to visit that post first before delve into this post I have an array which contains 7000+ value This foreach loop gets text value inside <mrk> tags in a given XML file It takes approximately 45

PHP Split XML based on multiple nodes

I honestly tried to find a solution for php, but a lot of threads sound similar, but are not applicable for me or are for completely different languages. I want to split an xml file based on nodes. Ideally multiple nodes, but of course one is enough and could be applied multiple times. e.g. I want to split this by

How to parse xml data from this type of content ( from online URL)

I am trying to parse data from this url xml: https://o2v.nl/example2.xml and what I am trying to get is the [Property] information but I dont know what should be the next step to get [property] tag. What I have done so far is the code My code is: The output string is now as: So what should I do next

Advertisement