I have a xml like below with xmlns -
<ChannelInfo xmlns="Vijayabank_43_vijayBank1">
<RegionName xmlns="Vijayabank_43_vijayBank1_Prime">
<Width xmlns="Width">768</Width>
<Height xmlns="Height">614</Height>
<Top xmlns="Top">100</Top>
<Left xmlns="Left">20</Left>
<Audio xmlns="Audio">1</Audio>
</RegionName>
<RegionName xmlns="Vijayabank_43_vijayBank1_SubPrime">
<Width xmlns="Width">452</Width>
<Height xmlns="Height">614</Height>
<Top xmlns="Top">100</Top>
<Left xmlns="Left">808</Left>
<Audio xmlns="Audio">0</Audio>
</RegionName>
<RegionName xmlns="Vijayabank_43_vijayBank1_Banner1">
<Width xmlns="Width">1240</Width>
<Height xmlns="Height">54</Height>
<Top xmlns="Top">714</Top>
<Left xmlns="Left">20</Left>
<Audio xmlns="Audio">0</Audio>
</RegionName>
</ChannelInfo>
I want to get it converted into json like below with xmlns in php -
"ChannelInfo": {
"-xmlns": "Vijayabank_43_vijayBank1",
"RegionName": [
{
"-xmlns": "Vijayabank_43_vijayBank1_Prime",
"Width": {
"-xmlns": "Width",
"#text": "768"
},
"Height": {
"-xmlns": "Height",
"#text": "614"
},
"Top": {
"-xmlns": "Top",
"#text": "100"
},
"Left": {
"-xmlns": "Left",
"#text": "20"
},
"Audio": {
"-xmlns": "Audio",
"#text": "1"
}
},
{
"-xmlns": "Vijayabank_43_vijayBank1_SubPrime",
"Width": {
"-xmlns": "Width",
"#text": "452"
},
"Height": {
"-xmlns": "Height",
"#text": "614"
},
"Top": {
"-xmlns": "Top",
"#text": "100"
},
"Left": {
"-xmlns": "Left",
"#text": "808"
},
"Audio": {
"-xmlns": "Audio",
"#text": "0"
}
},
{
"-xmlns": "Vijayabank_43_vijayBank1_Banner1",
"Width": {
"-xmlns": "Width",
"#text": "1240"
},
"Height": {
"-xmlns": "Height",
"#text": "54"
},
"Top": {
"-xmlns": "Top",
"#text": "714"
},
"Left": {
"-xmlns": "Left",
"#text": "20"
},
"Audio": {
"-xmlns": "Audio",
"#text": "0"
}
}
]
}
}
I have tried with simple_load_string() it throws warning like namespace warning :xmlns: URI DailyXml is not absolute . I want xmlns attribute.
How to solve this?Is there any other way to achieve it.?