Skip to content
Advertisement

Tag: xml

PHP convert XML to JSON

I am trying to convert xml to json in php. If I do a simple convert using simple xml and json_encode none of the attributes in the xml show. $xml = simplexml_load_file(“states.xml”); echo json_encode(…

PHP XML how to output nice format

Here are the codes: If I print it in the browser I don’t get nice XML structure like I just get And I want to be utf-8 How is this all possible to do? Answer You can try to do this: You can make set these parameter right after you’ve created the DOMDocument as well: That’s probably more concise. Output

Creating an XML sitemap with PHP

I’m trying to create a sitemap that will automatically update. I’ve done something similiar with my RSS feed, but this sitemap refuses to work. You can view it live at http://designdeluge.com/sitemap….

Convert large XML file to CSV in PHP

I have a 50MB XML file. I want to convert it to a CSV file, but most methods I have found exhaust the server memory. Is there a good way to do this using a stream method such as XMLreader. Answer You’d want to use XmlReader to parse the XML, as it works as an event based parser – Eg.

How to use XMLReader in PHP?

I have the following XML file, the file is rather large and i haven’t been able to get simplexml to open and read the file so i’m trying XMLReader with no success in php I’ve unfortunately not found a good tutorial on this for PHP and would love to see how I can get each element content to store in

Accessing @attribute from SimpleXML

I am having a problem accessing the @attribute section of my SimpleXML object. When I var_dump the entire object, I get the correct output, and when I var_dump the rest of the object (the nested tags), I get the correct output, but when I follow the docs and var_dump $xml->OFFICE->{‘@attributes’}, I get an empty object, despite the fact that the

Is there a way to get all of a DOMElement’s attributes?

I’m reading some XML with PHP and currently using the DOMDocument class to do so. I need a way to grab the names and values of a tag’s (instance of DOMElement) attributes, without knowing beforehand what any of them are. The documentation doesn’t seem to offer anything like this. I know that I can get an attribute’s value if I

SOAP-ERROR: Encoding: Violation of encoding rules?

Guys, I’m stuck, banging my head off the desk for the past few hours. I am trying to consume a service, and I have 8 other functions that I call that are almost IDENTICAL in nature to this one, but this one, results in a ‘SOAP-ERROR: Encoding: Violation of encoding rules’ error. Heres the function call (wsdl omitted for security):

Advertisement