Hi frends! When I edit XML elements inside XML file, the file is saved well. When I create a new multi-level XML element and add them into the XML file, the contents of the new element is written incorrectly. Chars ">" and "<" inside the new XML element replaced text "<" and ">". See the example below. This element is name "otvet" has internal elements ...
Code which gives the following result
B4X:
<otvet IMEI="2544778" Phon="+77782532177">name>Cargo trans group ghjgghkj</name><time>1469011029517</time><www>www.informbyuro.dggfhh</www><coment>Обращайтесь к разработчикам www.informbyuro.kz. Здесь могла бы быть ваша реклама или краткое описание услуги, но не более 30 букв</coment><phone num="77122754374" /><phone num="+7702342255" /></otvet>
B4X:
strQuery="//object [@ID='" & ID & "']"
xomNull=xomRootOtvet
Log(strQuery)
xomNs=xomNull.Query(strQuery)
xomObj=xomNs.GetNode(0)
xomNew.Initialize("otvet")
atrIMEI.Initialize("IMEI",smsIMEI)
xomNew.AddAttribute(atrIMEI)
atrPhon.Initialize("Phon",smsPhon)
xomNew.AddAttribute(atrPhon)
xomName.Initialize("name")
xomName.AppendChild(smsName)
xomNew.AppendChild(xomName.ToXML)
DateTime.DateFormat="dd/MM/yyyy HH:mm:ss"
strTime=DateTime.Now
xomTime.Initialize("time")
xomTime.AppendChild(strTime)
xomNew.AppendChild(xomTime.ToXML)
If smsWWW<>"" Then
xomWWW.Initialize("www")
xomWWW.AppendChild(smsWWW)
xomNew.AppendChild(xomWWW.ToXML)
End If
If smsComent<>"" Then
xomComent.Initialize("coment")
xomComent.AppendChild(smsComent)
xomNew.AppendChild(xomComent.ToXML)
End If
If smsPhon1<>"" Then
xomPhon.Initialize("phone")
atrNum.Initialize("num",smsPhon1)
xomPhon.AddAttribute(atrNum)
xomNew.AppendChild(xomPhon.ToXML)
End If
If smsPhon2<>"" Then
xomPhon.Initialize("phone")
atrNum.Initialize("num",smsPhon2)
xomPhon.AddAttribute(atrNum)
xomNew.AppendChild(xomPhon.ToXML)
End If
If smsPhon3<>"" Then
xomPhon.Initialize("phone")
atrNum.Initialize("num",smsPhon3)
xomPhon.AddAttribute(atrNum)
xomNew.AppendChild(xomPhon.ToXML)
End If
Log(xomNew.ToXML)
xomObj.AppendChild(xomNew.ToXML)