Skip to content

Commit

Permalink
Properly encode ampersand in XML output
Browse files Browse the repository at this point in the history
The XML output for a table def from Microsoft Access does not correctly encode the ampersand character. This creates XML that is technically invalid, and later fails to parse. #314
  • Loading branch information
joyfullservice committed Apr 6, 2022
1 parent 489143c commit 9a6b084
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Version Control.accda.src/modules/modSanitize.bas
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,13 @@ Public Function SanitizeXML(strPath As String, blnReturnHash As Boolean) As Stri
Perf.OperationStart "Sanitize XML"
curStart = Perf.MicroTimer

' Exporting Table Def as XML does not properly encode ampersand character (See #314)
' Most likely if any ampersands are encoded correctly, all of them will be.
If InStr(1, strFile, "&", vbTextCompare) = 0 Then
' Properly encode any embedded ampersand characters to make valid XML
strFile = Replace(strFile, "&", "&")
End If

' Split into array of lines
varLines = Split(FormatXML(strFile), vbCrLf)

Expand Down

0 comments on commit 9a6b084

Please sign in to comment.