At first, PHP code:
Which generates XML like this:
<?xml version="1.0" encoding="UTF-8"?>
<main xmlns:cns1="http://ift.tt/XK4jCC" xmlns:i="http://ift.tt/1wHhT8D" xmlns="http://ift.tt/XK4m1b">
<firstChild xmlns:cns1="http://ift.tt/XK4jCC" xmlns:i="http://ift.tt/1wHhT8D">
<cns1:elements>
<cns1:element>
<cns1:elementValue303>101</cns1:elementValue303>
<cns1:elementValue608>304</cns1:elementValue608>
</cns1:element>
<cns1:element>
<cns1:elementValue735>147</cns1:elementValue735>
<cns1:elementValue901>4505</cns1:elementValue901>
</cns1:element>
</cns1:elements>
<cns1:otherTag>some_value</cns1:otherTag>
<cns1:emptyTag i:nil="true"/>
</firstChild>
</main>
Document is expected to look like this:
<?xml version="1.0" encoding="UTF-8"?>
<main xmlns="http://ift.tt/XK4m1b">
<firstChild xmlns:cns1="http://ift.tt/XK4jCC" xmlns:i="http://ift.tt/1wHhT8D">
<cns1:elements>
<cns1:element>
<cns1:elementValue303>101</cns1:elementValue303>
<cns1:elementValue608>304</cns1:elementValue608>
</cns1:element>
<cns1:element>
<cns1:elementValue735>147</cns1:elementValue735>
<cns1:elementValue901>4505</cns1:elementValue901>
</cns1:element>
</cns1:elements>
<cns1:otherTag>some_value</cns1:otherTag>
<cns1:emptyTag i:nil="true"/>
</firstChild>
</main>
The problem is at <main> tag. Why it has cns1 and i namespace declarations? They should be only at firstChild element. What i need to change to get needed structure?
No comments:
Post a Comment