We use the MathML DTD to validate a MathML string (see the call to XmlDoc::parseMathML() in Validator::ValidatorImpl::validateMath()). However, this is not sufficient to ensure that this is valid MathML. Consider the following MathML string:
According to the MahML DTD (and https://www.mathmlcentral.com/Tools/ValidateMathML.jsp), it's valid, but... a root element must have either one or two siblings. If there are two siblings then the first sibling must be a degree element with one child corresponding to the degree of the root. The second sibling is what needs to be rooted. If there is only one sibling then it means that we have a square root. In other words:
So, upon successful DTD "validation", we should confirm that it is indeed really valiid by doing some extra checks. When it comes to the root element, we should check that it has one or two siblings, etc.
This means that once a MathML string has been really validated, something like the analyser can do whatever it wants with it wthout having to confirm whether a root element is properly used, etc.
We use the MathML DTD to validate a MathML string (see the call to
XmlDoc::parseMathML()
inValidator::ValidatorImpl::validateMath()
). However, this is not sufficient to ensure that this is valid MathML. Consider the following MathML string:According to the MahML DTD (and https://www.mathmlcentral.com/Tools/ValidateMathML.jsp), it's valid, but... a
root
element must have either one or two siblings. If there are two siblings then the first sibling must be adegree
element with one child corresponding to the degree of the root. The second sibling is what needs to be rooted. If there is only one sibling then it means that we have a square root. In other words:and:
are really valid.
So, upon successful DTD "validation", we should confirm that it is indeed really valiid by doing some extra checks. When it comes to the
root
element, we should check that it has one or two siblings, etc.This means that once a MathML string has been really validated, something like the analyser can do whatever it wants with it wthout having to confirm whether a
root
element is properly used, etc.