Search code examples
delphimsxml

Delphi XE3, How to set MSXML MaxElementDepth to allow reading deep XML documents


I have an SVG file that for some reason has over 256 depth nested elements and that is preventing Delphi loading the SVG file, as it violates the MaxElementDepth constraint of MSXML (default is 256).

Does anyone know of a way to set the MaxElementDepth value in MSXML higher from within the running program so I can read in the SVG file?

I tried the alternative CoDOMDocument40 which has a method (setProperty) for setting properties, but it reports Invalid property name when I try to set MaxElementDepth.

Other alternative I can think of is to run a command line tool to flatten the hierarchy, but I'd rather not go this way...

Your help much appreciated :-)


Solution

  • It seems you should use CoDOMDocument60 instead of CoDOMDocument40:

    MaxElementDepth Property

    This property is supported in MSXML 3.0 and 6.0. The default value is 0 for 3.0. The default value is 256 for 6.0.