当前位置: 首页 > news >正文

网站建设服务合同是否缴纳印花税阿凡达网站建设

网站建设服务合同是否缴纳印花税,阿凡达网站建设,太原广告设计公司,化妆品网站优化最近在针对某款设备的界面xml进行更新过程中#xff0c;被告知回稿的字串放在了一个excel文件中#xff0c;而我要上传到服务器的界面用语是用xml文件封装的。再经过详细求证了翻译组提供excel文件的原因后#xff0c;我决定用python来完成界面用语xml的更新#xff0c;但是…最近在针对某款设备的界面xml进行更新过程中被告知回稿的字串放在了一个excel文件中而我要上传到服务器的界面用语是用xml文件封装的。再经过详细求证了翻译组提供excel文件的原因后我决定用python来完成界面用语xml的更新但是在使用ElementTree库的时候却发现这个库有点小瑕疵。就是会将xml文件的表头xml/这段中的双引号换成了单引号虽然单双引号在解析xml上没有影响。但是如果上提交代码时有强校验的门禁处理等规则的话就需要额外解释了。为此针对这个问题查看了下源码并分享一种修改方案。 我遇到的情况如下图所示原本要替换message的信息结果执行完替换脚本后发现xml声明表头也被替换了。这个变更在比较软件中会显得很明显。 发生这种事情的原因在于EelementTree#write()中将表头的格式默认写成了单引号。如下源码展示了write()的实现可以发现在_get_wirte()的with循环体中直白的执行了一句写入操作 ?xml version1.0 encoding%s? def write(self, file_or_filename,encodingNone,xml_declarationNone,default_namespaceNone,methodNone, *,short_empty_elementsTrue):Write element tree to a file as XML.Arguments:*file_or_filename* -- file name or a file object opened for writing*encoding* -- the output encoding (default: US-ASCII)*xml_declaration* -- bool indicating if an XML declaration should beadded to the output. If None, an XML declarationis added if encoding IS NOT either of:US-ASCII, UTF-8, or Unicode*default_namespace* -- sets the default XML namespace (for xmlns)*method* -- either xml (default), html, text, or c14n*short_empty_elements* -- controls the formatting of elementsthat contain no content. If True (default)they are emitted as a single self-closedtag, otherwise they are emitted as a pairof start/end tagsif not method:method xmlelif method not in _serialize:raise ValueError(unknown method %r % method)if not encoding:if method c14n:encoding utf-8else:encoding us-asciienc_lower encoding.lower()with _get_writer(file_or_filename, enc_lower) as write:if method xml and (xml_declaration or(xml_declaration is None andenc_lower not in (utf-8, us-ascii, unicode))):declared_encoding encodingif enc_lower unicode:# Retrieve the default encoding for the xml declarationimport localedeclared_encoding locale.getpreferredencoding()write(?xml version1.0 encoding%s?\n % (declared_encoding,))if method text:_serialize_text(write, self._root)else:qnames, namespaces _namespaces(self._root, default_namespace)serialize _serialize[method]serialize(write, self._root, qnames, namespaces,short_empty_elementsshort_empty_elements)可能这是ElementTree在设计初为了方便在双引号中引用字串才将version和encoding改为用单引号展示。因为write()中没有复杂的间接依赖可以直接将该方法复制到自己的工程里。为此针对该处的修改就是重写ElementTree#write()。重新方案如下先将源代码中的?xml version1.0 encoding%s? 替换成 ?xml version\1.0\ encoding\%s\?。 同时针对提示引用缺失的方法增加ElementTree前缀来指明调用路径。这样就可以保证整个write()也可以在自己的工程中被执行。修改后的代码如下 def fix_write(self, file_or_filename,encodingNone,xml_declarationNone,default_namespaceNone,methodNone, *,short_empty_elementsTrue):if not method:method xmlelif method not in ElementTree._serialize:raise ValueError(unknown method %r % method)if not encoding:if method c14n:encoding utf-8else:encoding us-asciienc_lower encoding.lower()with ElementTree._get_writer(file_or_filename, enc_lower) as write:if method xml and (xml_declaration or(xml_declaration is None andenc_lower not in (utf-8, us-ascii, unicode))):declared_encoding encodingif enc_lower unicode:# Retrieve the default encoding for the xml declarationimport localedeclared_encoding locale.getpreferredencoding()write(?xml version\1.0\ encoding\%s\?\n % (declared_encoding,))if method text:ElementTree._serialize_text(write, self._root)else:qnames, namespaces ElementTree._namespaces(self._root, default_namespace)serialize ElementTree._serialize[method]serialize(write, self._root, qnames, namespaces,short_empty_elementsshort_empty_elements)修改后将原来调用ElementTree#write()的地方改成使用fix_write即可同时不要忘了将当前工程的elementTree对象作为第一入参穿进去。修改后的运行结果就会发现没有额外的格式变更了。 def update_fix():tree ET.parse(element_test.xml)root tree.getroot()messages root.findall(message)messages[0].text no, its so cold,lets take a showerfix_write(tree, element_test_update_fix.xml, encodingutf-8, xml_declarationTrue)
http://www.zqtcl.cn/news/638359/

相关文章:

  • 田园综合体建设网站梧州网站建设有哪些
  • 公司做网站的流程茂名网站建设公司
  • 徐州专业网站建设公司wordpress tag找不到
  • 网站互动推广织梦网站主页代码在后台怎么改
  • 福永自适应网站建设微信小程序功能开发
  • 制作一个动态企业网站狠狠做最新网站
  • 手机建立一个免费网站网页设计师培训方法
  • 广州工信部网站查询wordpress mysql类
  • 销售网站内容设计书籍管理网站建设需求文档
  • 韩国网站如何切换中文域名如何备案教程
  • 网站维护的基本概念二维码生成器使用方法
  • 公司网站建设模块简介搭建自己的网站需要什么
  • 想做个网站怎么做给国外网站做流量
  • 长春建站培训班免备案虚拟空间
  • 做面包的公司网站alexa世界排名查询
  • 网站备案后下一步做什么263邮箱注册
  • 燕郊网站制作廊坊网站制作网站
  • 开网站建设网站如何做excel预览
  • p2p网站建设方案电商企业有哪些
  • 建设农场网站天元建设集团有限公司法定代表人
  • 论坛网站建设价格百度广告官网
  • 网站开发有哪些语言ps做登录网站
  • 网站怎么做百度关键字搜索国外服务器做网站不能访问
  • 如何选择品牌网站建设做网站容易吧
  • 广州建网站比较有名的公司提升学历英语翻译
  • php网站开发视频教程厦门网站建设公司首选乐振
  • 网站推广项目微信小程序登陆入口
  • 建设部监理协会网站微信公众平台开发微网站
  • 莆田cms建站模板现在可以做网站么
  • windows 建网站湖北省最新消息今天