array2xml icon indicating copy to clipboard operation
array2xml copied to clipboard

Awesome!

Open mimooh opened this issue 7 years ago • 5 comments

Thanks a lot, awesome! :) The example on your github on how to use it is even more awesome! Why isn't everyone making their software manuals that easy!

How could I hardcode this to my xml?

mimooh avatar Feb 15 '18 00:02 mimooh

What do you mean by hardcoding that to your XML? You may clone/download that repo and use it from PHP, but there is nothing to hardcode in XML.

jmarceli avatar Feb 15 '18 07:02 jmarceli

Thanks for a quick answer. Sorry, but github removed the xml from my post and I didn't notice :) The thing is I need to produce an xml with a root element with attribs:

?xml version="1.0" encoding="UTF-8"? works xmlns="http://pbn.nauka.gov.pl/-/ns/bibliography" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" pbn-unit-id="125" xsi:schemaLocation="http://pbn.nauka.gov.pl/-/ns/bibliography PBN-report.xsd "

mimooh avatar Feb 15 '18 09:02 mimooh

I don't think it is possible right now (at least not without some modifications to PHP codebase). I may add such feature, but to be true this is just a quickly created repo which needs some automated tests for any refactoring/improvements.

jmarceli avatar Feb 15 '18 10:02 jmarceli

I thought that perhaps I could hardcode this line for my own use somewhere in my copy of your module. I can live without it, you know - can just always delete and insert the second line of the xml file. But it looks like a feature of plenty xml files in the wild, so a good thing to have in your module. Otherwise, the module is great, thanks for sharing!

mimooh avatar Feb 15 '18 10:02 mimooh

OK. I think you may fork/hardcode some changes around line 41 (https://github.com/jmarceli/array2xml/blob/master/ArrayToXML.php#L41) check the http://php.net/manual/en/function.xmlwriter-start-document.php docs for more info.

jmarceli avatar Feb 15 '18 10:02 jmarceli