Forum Replies Created
- AuthorPosts
- February 20, 2019 at 6:04 pm in reply to: Replace text in multimple files ONLY in a specific XML tag #25436Simon McMahonParticipant
Ahh, yes Stefan, working from the end of the line is a good idea. Thank you very much.
Simon McMahonParticipantHi Yataka, I have another replace in files problem. I tried to record a macro to do the following
Replace this line:
<xsl:output method=”html” encoding=”UTF-8″ indent=”yes” doctype-public=”-//W3C//DTD XHTML 1.0 Transitional//EN” doctype-system=”http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”/>With this line:
<xsl:output method=”xml” encoding=”UTF-8″ indent=”yes” />In over 100 .XSL files.
I thought given the ” quotes in the strings I would need to use a double quote to refer to each string, but this has failed.
Can you suggest the correct macro? My not working example is below. I can send you some sample .XSL files if you need them to test,
Thanks, Simon
// Replace in Files – XML header line (JavaScript)
editor.ReplaceInFiles( “”<xsl:output method=”html” encoding=”UTF-8″ indent=”yes” doctype-public=”-//W3C//DTD XHTML 1.0 Transitional//EN” doctype-system=”http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”/>””,””<xsl:output method=”xml” encoding=”UTF-8″ indent=”yes” />””, “C:\\temp\\*.xsl”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );Simon McMahonParticipantThanks Yutaka, that has worked. My string is now by way of example:
editor.ReplaceInFiles( “<“,”<“, “C:\\temp\\*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “>”,”>”, “C:\\temp\\*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “&”,”&”, “C:\\temp\\*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );Simon McMahonParticipantHi I have emailed the files as requested.
xmlFilesForChange.zip
fix-special-characters-in-files(original2).zipSimon McMahonParticipantHi there, I have a problem with my existing Macro not working for replace in files across 80+ XML files. Here is a sample of the current macro which fails to run.
editor.ReplaceInFiles( “<“,”<“, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “>”,”>”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “&”,”&”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “"”,”\x22″, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “'”,”\x27″, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “–”,”-“, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “&”,”and”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “ ”,” “, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “&”,”and”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “<![CDATA[“,””, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “]]>”,””, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “<category></category>”,”<category>Event XML Upload</category>”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “]]>”,””, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “&”,”and”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “#8216;”,”‘”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “#8217;”,”‘”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “#8230;”,”…”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “#8220;”,”‘”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “#8221;”,”‘”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “#8212;”,”-“, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “#39;”,”‘”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “and'”,”‘”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “<p>andnbsp;</p>”,””, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “<organisation><p>”,”<organisation>”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );
editor.ReplaceInFiles( “</p></organisation>”,”</organisation>”, “*.xml”, eeReplaceBackup, eeEncodingSystemDefault, “*.bak”, “C:\\xmlBackup” );Can you suggest correct syntax so it will run on version 14.9.3
- AuthorPosts