I want to format XML file in Angular. I tried this:
<div class="element-box">
  <div class="details-wrapper">
    <p><b class="label">Raw Request</b>
      <pre>
        {{apiattempt.raw_request | xmlBeautyfier }}
      </pre>
    </p>
  </div>
</div>
But I get this error:
ERROR in : Template parse errors:
Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags ("
        {{apiattempt.raw_request | xmlBeautyfier }}
      </pre>
    [ERROR ->]</p>
    <p><b class="label">Raw Response</b>{{apiattempt.raw_response | xmlBeautyfier }}</p>
  </div"): 
Do you know how I can fix this?
The <pre> tag is a block level element. When that is placed inside the <p>...</p> it will act like a </p> causing it to close and throwing an error when it gets to your </p>. Either close the <p> before your <pre> or wrap the pre in a different element if you want it wrapped. 
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p
Refer to: https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags
In HTML: p tag is implicity closed with next element. So
Solutions (from best the worst):
Possible solution to investigate: - XHTML requires explicit closing p tag. You can try to use XHTML and let us know if it works. Note: this is a bit of an overkill to your problem... bit always good to learn ;-)
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With