0

I will have to produce this XML using simpleXML in php:

<fr:program name="fundref">
  <fr:assertion name="funder_name">ABC Inc.
    <fr:assertion name="funder_identifier">http://dx.doi.org/10.13039/xxxxxxxxxx</fr:assertion>
  </fr:assertion>    
  <fr:assertion name="award_number">BXDFSDS</fr:assertion>
</fr:program>

I tried:

$fundRef = $myXML->addChild('fr', '', 'program');

But this is creating:

<fr xmlns="program" name="fundref">

Thank you.

Milos Cuculovic
  • 19,631
  • 51
  • 159
  • 265

1 Answers1

0

You need to determine namespace like this

$myXML->addChild('fr:program', '', 'http://ololo.com/ns/1.0');

This should help PHP's SimpleXML: How to use colons in names

Community
  • 1
  • 1