4

I have an XML file as follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CustomObject>
</CustomObjects>

I apply the XMLTask attr in the following way:

<attr path="/CustomObject" attr="xmlns" value="test"/>

I expect the XML file to now include the attribute xmlns with the value "test"

The actual output is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CustomObject xmlns="">
</CustomObjects>

Has anyone ran into this problem before? or has any indication as what may be the problem?

Chad Nouis
  • 6,861
  • 1
  • 27
  • 28
user3556152
  • 105
  • 8

1 Answers1

0

It looks like xmltask cannot create attributes with the name xmlns. This appears to be a known bug: #8 attr name="xmlns" does not work on Mac.

In XML, xmlns is a reserved attribute name. It refers to the default namespace. For more about default namespaces, see Namespace Defaulting in the Namespaces in XML 1.0 W3C Recommendation.

As an alternative solution, consider using XSLT to add a namespace to the root element.

Community
  • 1
  • 1
Chad Nouis
  • 6,861
  • 1
  • 27
  • 28