如何通过c#在文件中存在mathml标记时加载xml文件

时间:2016-03-10 07:41:12

标签: c# xml

这是一个xml文件的例子,在这个文件中给出了一些math ml标签。当加载XML文件时,它们会在加载时给出异常 例外情况是" mml'是未声明的前缀。 16号线,2号线和34号线;

xDocFile = XDocument.Load(xmlfile);
你可以告诉我如何解决它 例如,

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book-part SYSTEM "C:\book-dtd-2.3\book.dtd">
<book-part id="" book-part-type="chapter" book-part-number="appd" xmlns:xlink="http://www.w3.org/1999/xlink">
<body>
<sec id="appd.s1">
<title>Equation 1. Response measure equals end of treatment mean minus the baseline mean</title>
<disp-formula id="appd.eq1">
<mml:math id="appd.eq2" display='block'>
<mml:mrow>
<mml:msubsup>
<mml:mi>y</mml:mi>
<mml:mi>i</mml:mi>
</mml:msubsup>
</mml:mrow>
</mml:math>
</disp-formula>
<p>Response measure equals end of treatment mean minus the baseline mean</p>
</sec>
<title>Equation 8. Likelihood of observed differences, specified as a Gaussian distribution, and standard deviation of estimate derived from the standard error of the treatment effect</title>
<disp-formula id="appd.eq14">
<italic>d</italic>
<italic>
<sub>i</sub>
</italic>~<italic>N</italic>(<italic>&#x003B8;</italic>
<italic>
<sub>i</sub>
</italic>, <italic>&#x003C3;</italic>
<sup>2</sup>)</disp-formula>
<p>Likelihood of observed differences, specified as a Gaussian distribution, and standard deviation of estimate derived from the standard error of the treatment effect</p>
<p>All unknown parameters were given weakly-informative prior distributions and estimated using Markov chain Monte Carlo<xref ref-type="bibr" rid="b4">4</xref> methods via the PyMC 2.3 software package.<xref ref-type="bibr" rid="b5">5</xref> The model was run for 200,000 iterations, with the first 150,000 samples conservatively discarded as burn-in, leaving 50,000 for inference.</p>
</sec>
</body>
</book-part>

1 个答案:

答案 0 :(得分:0)

这是固定代码

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book-part SYSTEM "C:\book-dtd-2.3\book.dtd">
<book-part id="" book-part-type="chapter" book-part-number="appd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="C:\book-dtd-2.3\book.dtd">
  <body>
    <sec id="appd.s1">
      <title>Equation 1. Response measure equals end of treatment mean minus the baseline mean</title>
      <disp-formula id="appd.eq1">
        <mml:math id="appd.eq2" display='block'>
          <mml:mrow>
            <mml:msubsup>
              <mml:mi>y</mml:mi>
              <mml:mi>i</mml:mi>
            </mml:msubsup>
          </mml:mrow>
        </mml:math>
      </disp-formula>
      <p>Response measure equals end of treatment mean minus the baseline mean</p>
    </sec>
    <title>Equation 8. Likelihood of observed differences, specified as a Gaussian distribution, and standard deviation of estimate derived from the standard error of the treatment effect</title>
    <disp-formula id="appd.eq14">
      <italic>d</italic>
      <italic>
        <sub>i</sub>
      </italic>~<italic>N</italic>(<italic>&#x003B8;</italic>
      <italic>
        <sub>i</sub>
      </italic>, <italic>&#x003C3;</italic>
      <sup>2</sup>)
    </disp-formula>
    <p>Likelihood of observed differences, specified as a Gaussian distribution, and standard deviation of estimate derived from the standard error of the treatment effect</p>
    <p>
      All unknown parameters were given weakly-informative prior distributions and estimated using Markov chain Monte Carlo<xref ref-type="bibr" rid="b4">4</xref> methods via the PyMC 2.3 software package.<xref ref-type="bibr" rid="b5">5</xref> The model was run for 200,000 iterations, with the first 150,000 samples conservatively discarded as burn-in, leaving 50,000 for inference.
    </p>
  </body>
</book-part>