我必须创建一个宏来更改给定xml中的某些标记并将其保存。 但保存之后,所有转义字符都会更改,被删除修改一个xml文件并保存后,将"更改为“
初始文件:
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
...
<DataValidation xmlns="urn:schemas-microsoft-com:office:excel">
<Range>R1C26</Range>
<Type>List</Type>
<CellRangeList/>
<Value>"Credit Limit"</Value>
<ErrorMessage>The header row should not be changed.</ErrorMessage>
<ErrorTitle>Header Row</ErrorTitle>
</DataValidation>
保存后:
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
...
<DataValidation xmlns="urn:schemas-microsoft-com:office:excel">
<Range>R1C26</Range>
<Type>List</Type>
<CellRangeList/>
<Value>"Credit Limit"</Value>
<ErrorMessage>The header row should not be changed.</ErrorMessage>
<ErrorTitle>Header Row</ErrorTitle>
</DataValidation>
我的代码是这样的:
Dim xmlDoc As New MSXML2.DOMDocument60
xmlFile = outputFolder & "\" & f
xmlDoc.Load xmlFile
'Make changes here
xmlDoc.Save xmlFile
你能帮助我理清了这一点?对不起 -
我需要发送完全相同的XML,我只是改变一些被翻译的单词。 – Marisa
没有确切的XML。任何有效的XML使用者都将接受XML。 –
谢谢。你知道是否有任何文件比较工具允许我跳过CRLF?因为我需要比较原始文件和修改后的文件,这种格式的变化使得它很难做到。提前致谢。 – Marisa