drxyaox153896 2018-05-01 19:49
浏览 513

使用Golang修改xml文件中的数据

I want to change the lastModifiedBy field from Tom Hanks to Jerry Garcia. I used this repo: https://github.com/clbanning/mxj/blob/master/xml.go to parse the xml bytes into a map. However, some fields were left out.

What's an easy way to change that field and only that field? There are hundreds of these files so I need to do it programmatically.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cp:coreProperties 
 xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core- 
 properties" xmlns:dc="http://purl.org/dc/elements/1.1/" 
 xmlns:dcterms="http://purl.org/dc/terms/" 
 xmlns:dcmitype="http://purl.org/dc/dcmitype/" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title></dc:title> 
<dc:subject></dc:subject><dc:creator>John Kerry</dc:creator> 
<cp:keywords></cp:keywords><dc:description></dc:description> 
<cp:lastModifiedBy>TomHanks</cp:lastModifiedBy><cp:revision>6</cp:revision> 
<dcterms:created xsi:type="dcterms:W3CDTF">2018-02- 
20T18:08:00Z</dcterms:created><dcterms:modified 
xsi:type="dcterms:W3CDTF">2018-04-24T19:43:00Z</dcterms:modified> 
</cp:coreProperties>
  • 写回答

2条回答 默认 最新

  • dongliao8069 2018-05-01 19:56
    关注
    <cp:lastModifiedBy>JerryGarcia</cp:lastModifiedBy><cp:revision>6</cp:revision> 
    

    Delete TomHanks and write JerryGarcia

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分