PDA

View Full Version : XML file destroyed



saban
11-06-2007, 10:08 AM
Dim i As Integer
Dim strPrepOriginelsWfs As String
Dim objTMXSource As New MSXML2.DOMDocument
Dim objNodeTuvList As MSXML2.IXMLDOMNodeList
Dim objNodeTuv As MSXML2.IXMLDOMNode

Dim strDtdName As String
Dim Cpt As Integer
Dim cpt2 As Integer
Dim strLang As String
Dim strTemp As String

Set objNodeTuvList = objTMXSource.SelectNodes("tmx/body/tu/tuv")
For Each objNodeTuv In objNodeTuvList
If InStr(1, objNodeTuv.XML, strLang) > 0 Then
With objNodeTuv
Select Case strLang
Case "RO-RO"
If optFromOld Then
'On remplace les anciens caractčres par les nouveaux
.Text = Replace(.Text, ChrW(350), ChrW(536))
.Text = Replace(.Text, ChrW(351), ChrW(537))
.Text = Replace(.Text, ChrW(354), ChrW(538))
.Text = Replace(.Text, ChrW(355), ChrW(539))
Else
'On remplace les nouveaux caractčres par les anciens
.Text = Replace(.Text, ChrW(536), ChrW(350))
.Text = Replace(.Text, ChrW(537), ChrW(351))
.Text = Replace(.Text, ChrW(538), ChrW(354))
.Text = Replace(.Text, ChrW(539), ChrW(355))
End If
Next

Call objTMXSource.Save(strFullTMXName

Does anyone have any idea why this code totally ****s up xml document instead of just replacing characters
(it deletes some of the tags some text)- so strange when all that is instructed is to replace characters
Why does it even touches the tags
Any ideas

TonyJollans
11-07-2007, 12:59 PM
I haven't got a proper grip on working with xml. Can you answer me a simple question and/or post a document you think it should work with.

By what process is your document linked to your objTMXSource object?