سؤال

After trying to parse an input XML document and produce an output XML document I keep getting an output file that contains only the string "ÿþ>". The output document is created without any errors, and the DOM.parseError displays an error number of 0 (no error I imagine). What is this string and where does it come from?

هل كانت مفيدة؟

المحلول

The three bytes you get is the Byte Order Mark (BOM). You can get rid of the BOM by saving the file in ANSI format as shown in the pre-previous answer to your question related on this topic.

If you can't save as ANSI because your XML contains characters which would get lost, then check how you opened the file. It seems you're reading the content from disk into a string and then load it as XML. Try loading it from disk directly into XML. The StackOverflow answer for VBA Output to file using UTF-16 might also be helpful.

BTW: If the macro you're talking about is

Set Entity = DOM.DocumentElement.getElementsByTagName("EntityId")(0)

then also check the casing: your XML uses entityId but your macro uses EntityId.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top