PHP - String could not be parsed as XML when using SimpleXMLElement

bfenixz

New Member
I have a string field in database with value:\[code\]<ProductOrderItem><Product><ProductOffering><id>1</id></ProductOffering><ComponentProduct><ProductOffering><Id>10</Id></ProductOffering><CharacteristicValue><Characteristic><Name>Color</Name></Characteristic><Value>black</Value></CharacteristicValue><CharacteristicValue><Characteristic><Name>IMEI</Name></Characteristic><Value>imei100</Value></CharacteristicValue></ComponentProduct><ComponentProduct><ProductOffering><Id>11</Id></ProductOffering><CharacteristicValue><Characteristic><Name>MSISDN</Name></Characteristic><Value>063</Value></CharacteristicValue><CharacteristicValue><Characteristic><Name>IMSI</Name></Characteristic><Value>064</Value></CharacteristicValue></ComponentProduct></Product></ProductOrderItem>\[/code\]when I try:\[code\]$xml = new SimpleXMLElement($field);\[/code\]I am getting exception:String could not be parsed as XMLI validated XML in Notepad++ and it says "No Error Detected".I really must have this XML value in some field from that string field.Where is my problem?Thank youUpdate:My field now has value:\[code\]<?xml version="1.0" encoding="utf-8"?><ProductOrderItem><Product><ProductOffering><id>1</id></ProductOffering><ComponentProduct><ProductOffering><Id>10</Id></ProductOffering><CharacteristicValue><Characteristic><Name>Color</Name></Characteristic><Value>black</Value></CharacteristicValue><CharacteristicValue><Characteristic><Name>IMEI</Name></Characteristic><Value>imei100</Value></CharacteristicValue></ComponentProduct><ComponentProduct><ProductOffering><Id>11</Id></ProductOffering><CharacteristicValue><Characteristic><Name>MSISDN</Name></Characteristic><Value>063</Value></CharacteristicValue><CharacteristicValue><Characteristic><Name>IMSI</Name></Characteristic><Value>064</Value></CharacteristicValue></ComponentProduct></Product></ProductOrderItem>\[/code\]But still same exception.
 
Back
Top