# BDT.C macro in the TMVAGui Error in \<TXMLEngine::ParseFile\>: XML syntax error at line

**URL:** <https://root-forum.cern.ch/t/bdt-c-macro-in-the-tmvagui-error-in-txmlengine-parsefile-xml-syntax-error-at-line/29593>\
**Category:** TMVA\
**Created:** [July 2, 2018, 5:47am UTC](https://root-forum.cern.ch/t/bdt-c-macro-in-the-tmvagui-error-in-txmlengine-parsefile-xml-syntax-error-at-line/29593 "2018-07-02T05:47:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gusai](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/65b543/32.png) [@gusai](https://root-forum.cern.ch/u/gusai)\
**Post date:** [July 2, 2018, 5:47am UTC](https://root-forum.cern.ch/t/bdt-c-macro-in-the-tmvagui-error-in-txmlengine-parsefile-xml-syntax-error-at-line/29593/1 "2018-07-02T05:47:02Z")

</div>

Dear Experts,

I’m not able to visualise the BDT using the macro in the GUI due to this error:

Error in TXMLEngine::ParseFile: XML syntax error at line 91  
test1— Found 0 decision trees in weight file  
— Reading Tree 0 from weight file: /afs/cern.ch/work/g/gusai/public/UTA-MVA/weights/TMVAClassification\_BDT.weights.xml  
\*\*\* ERROR: requested decision tree: 0, but number of trained trees only: 0

Not sure if my weight file is correct or if this is a problem in the parser.  
I’m using the TMVA as installed on root 6.06/06 on lxplus or on my mac with same results/errors.  
I’m training a BDT with MC samples (weighted events, which include also some negative weights)

my setup, with the weights and output files is accessible here: /afs/cern.ch/work/g/gusai/public/UTA-MVA

This is the file I’m looking at:  
TMVA::TMVAGui(“TMVA\_Output\_mc15\_13TeV.387231.MGPy8EG\_A14N23LO\_TT\_directTT\_500\_327\_MET100.root\_njets\>=2&&nbjets\>=1&&ptlep1\>20000&&ptlep2\>15000\_file.root”);

Many thanks for any comment a/o advice.  
Giulio

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [July 2, 2018, 4:17pm UTC](https://root-forum.cern.ch/t/bdt-c-macro-in-the-tmvagui-error-in-txmlengine-parsefile-xml-syntax-error-at-line/29593/2 "2018-07-02T16:17:52Z")

</div>

Hi,

I’m looking into this. In the mean while, I wonder if it’s the large pdf histogram that confuses the xml parser. Could you try try manually editing the xml-file to remove the everything inside the `MVAPdfs` tag? (If you do, remember to backup the original!)

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![kialbert](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/kialbert/32/16537_2.png) [@kialbert](https://root-forum.cern.ch/u/kialbert)\
**Post date:** [July 2, 2018, 8:50pm UTC](https://root-forum.cern.ch/t/bdt-c-macro-in-the-tmvagui-error-in-txmlengine-parsefile-xml-syntax-error-at-line/29593/3 "2018-07-02T20:50:25Z")

</div>

Hi,

I can confirm that if you manually remove the mentioned xml-tag from the weight file you can generate the BDT plot.

The problem, I think, is that the xml-file is too large for the parser to handle (a fix for this is to be integrated the development version of root).

To reduce the output file size, you can tune the size of the generated histogram using e.g. `CreateMVAPdfs:NbinsMVAPdf=X` in the options to your method. More information can be found in the [TMVA User’s Guide](https://root.cern.ch/download/doc/tmva/TMVAUsersGuide.pdf) Chapter 8 and Code Example 60.

Cheers,  
Kim

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [July 3, 2018, 9:10am UTC](https://root-forum.cern.ch/t/bdt-c-macro-in-the-tmvagui-error-in-txmlengine-parsefile-xml-syntax-error-at-line/29593/4 "2018-07-03T09:10:33Z")

</div>

> [@kialbert](#):
>
> The problem, I think, is that the xml-file is too large for the parser to handle (a fix for this is to be integrated the development version of root).

Hi,

It is a real problem in TXMLEngine class of ROOT. I already submit a fix for it: [https://github.com/root-project/root/pull/2280](https://github.com/root-project/root/pull/2280). Seems to be, problem was existing since beginning, but appears only on very recent Linux distributions.

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![gusai](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/65b543/32.png) [@gusai](https://root-forum.cern.ch/u/gusai)\
**Post date:** [July 3, 2018, 9:12am UTC](https://root-forum.cern.ch/t/bdt-c-macro-in-the-tmvagui-error-in-txmlengine-parsefile-xml-syntax-error-at-line/29593/5 "2018-07-03T09:12:20Z")

</div>

Dear Kim,

many thanks for looking into the issue. Reducing the Nbins solve this to me.

Thanks and cheers,  
Giulio
