我有一个用户试图将数据从Access导出到XML文件中,并且收到无效的XML错误。我们正在研究如何删除无效字符并在此字段中运行:。
此字段不是管道栏,|。当我尝试将此字段粘贴到Notepad ++中时,它会显示ENQ。它似乎不是基于Invalid Characters in XML的无效XML字符。
编辑:它似乎没有出现,所以这里有一个指向我在编辑器中的外观的链接:
答案 0 :(得分:0)
有时候我发现有必要在大海捞针 - 这是一个无法显示的角色。如果要查看字符串中可能包含的字符,可以尝试以下代码。它允许您跳过常见的字符......
Dim YourString As String
Dim blnSkipNbr As Boolean
Dim blnSkipUC As Boolean
Dim blnSkipLC As Boolean
Dim blnSkipSpecial As Boolean
blnSkipNbr = True ' Set to tru to not display numbers
blnSkipUC = True ' Skip UC
blnSkipLC = True ' Skip LC
blnSkipSpecial = True ' Skip special
' 32-47 = Special (space, !, (), etc.)
' 48-57 = 0 to 9
' 65-90 = A to Z
' 97-122 = a to z
YourString = "Now is the time...!#$" & vbCrLf
For i = 1 To Len(YourString)
char = Mid(YourString, i, 1)
Do
If blnSkipNbr = True And Asc(char) >= 48 And Asc(char) <= 57 Then Exit Do
If blnSkipUC = True And Asc(char) >= 65 And Asc(char) <= 90 Then Exit Do
If blnSkipLC = True And Asc(char) >= 97 And Asc(char) <= 122 Then Exit Do
If blnSkipSpecial = True And Asc(char) >= 97 And Asc(char) <= 122 Then Exit Do
Debug.Print "In position " & i & " of string: Char: " & ">" & char & "<" & vbTab & vbTab & "Asc(" & Asc(char) & ")"
Exit Do
Loop
Next i
答案 1 :(得分:0)