我在解析 XML 文件时遇到问题。我想删除带有 \t\n 等字符的字符串。
XML 文件: http: //ftp.thinkimmo.com/home/immoanzeigen24/immo.xml
{
trim: true,
normalize: true,
attrValueProcessors: [cleanValue, name => name],
valueProcessors: [cleanValue, name => name]
}
清洁值:
const cleanValue = value => {
return value.toString().trim().replace("\t","atest");
};
我试着用我在网上找到的很多正则表达式来清理它——但值总是如下所示:
"verwaltung_objekt": {
"objektadresse_freigeben": "0",
"verfuegbar_ab": "nachaasjkdhkjshadjkashdAbsprache",
"bisdatum": "2016-01-15",
"min_mietdauer": "\n\t\t\t\t",
"max_mietdauer": "\n\t\t\t\t",
}