korusdipl / grit-i18n

Automatically exported from code.google.com/p/grit-i18n
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Policy descriptions with XML special characters fail to parse #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Include the "&" char in one of the policy descriptions in chrome 
(chrome/app/policy/policy_templates.json)
2. Generate the policy_templates target

An intermediate XML representation fails to be built due to the special "&" 
character. This leads to build failures on the try bots when new policies are 
introduced (e.g. http://goo.gl/6CAmL):

Traceback (most recent call last):
  File "../tools/grit/grit.py", line 15, in <module>
    grit.grit_runner.Main(sys.argv[1:])
  File "/mnt/data/b/build/slave/linux_chromeos_clang/build/src/tools/grit/grit/grit_runner.py", line 207, in Main
    toolobject.Run(options, args[1:])
  File "/mnt/data/b/build/slave/linux_chromeos_clang/build/src/tools/grit/grit/tool/build.py", line 118, in Run
    self.res.RunGatherers(recursive = True)
  File "/mnt/data/b/build/slave/linux_chromeos_clang/build/src/tools/grit/grit/node/base.py", line 321, in RunGatherers
    child.RunGatherers(recursive=recursive, debug=debug)
  File "/mnt/data/b/build/slave/linux_chromeos_clang/build/src/tools/grit/grit/node/base.py", line 321, in RunGatherers
    child.RunGatherers(recursive=recursive, debug=debug)
  File "/mnt/data/b/build/slave/linux_chromeos_clang/build/src/tools/grit/grit/node/base.py", line 321, in RunGatherers
    child.RunGatherers(recursive=recursive, debug=debug)
  File "/mnt/data/b/build/slave/linux_chromeos_clang/build/src/tools/grit/grit/node/structure.py", line 153, in RunGatherers
    self.gatherer.Parse()
  File "/mnt/data/b/build/slave/linux_chromeos_clang/build/src/tools/grit/grit/gather/policy_json.py", line 239, in Parse
    self._AddItems(self.data['policy_definitions'], 'policy', None, 2)
  File "/mnt/data/b/build/slave/linux_chromeos_clang/build/src/tools/grit/grit/gather/policy_json.py", line 213, in _AddItems
    self._AddPolicyKey(item1, item_type, parent_item, key, depth + 1)
  File "/mnt/data/b/build/slave/linux_chromeos_clang/build/src/tools/grit/grit/gather/policy_json.py", line 178, in _AddPolicyKey
    self._GetDescription(item, item_type, parent_item, key))
  File "/mnt/data/b/build/slave/linux_chromeos_clang/build/src/tools/grit/grit/gather/policy_json.py", line 72, in _ParseMessage
    node = minidom.parseString(xml).childNodes[0]
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 1928, in parseString
    return expatbuilder.parseString(string)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 16

Original issue reported on code.google.com by joaodasilva@chromium.org on 25 Jan 2012 at 12:49

GoogleCodeExporter commented 9 years ago
Upon further tests I realized the input data is indeed meant to be XML.

Original comment by joaodasilva@chromium.org on 25 Jan 2012 at 2:03