Filter validation errors by location
Posted: Tue Aug 21, 2018 2:40 pm
I've got a plugin that vetoes document save on validation errors beyond a certain severity, which is working fine. Now a new requirement has come in to completely ignore (for veto purposes) errors that happen within a certain element.
Imagine something like <user-content>, in which users can sometimes include content that doesn't pass DTD validation, but we still want to save it. (To be fixed in a later editing session.) Other parts of the document however are more strictly checked and we block saving until those errors are fixed.
My problem is that with DTD validation I only get line and column info in DocumentPositionedInfo, which I'd need to use to match up with AuthorNodes.
There's two ways I see to resolve this: find AuthorNodes by line/column location or get line/column info for an AuthorNode, but I can't seem to find anything that would do either.
Have you got any ideas of how to do this efficiently? (I can in theory grab the entire content via WSEditor.getContentReader(), parse it and count the lines and columns, but I'd want to avoid it if possible.)
Imagine something like <user-content>, in which users can sometimes include content that doesn't pass DTD validation, but we still want to save it. (To be fixed in a later editing session.) Other parts of the document however are more strictly checked and we block saving until those errors are fixed.
My problem is that with DTD validation I only get line and column info in DocumentPositionedInfo, which I'd need to use to match up with AuthorNodes.
There's two ways I see to resolve this: find AuthorNodes by line/column location or get line/column info for an AuthorNode, but I can't seem to find anything that would do either.
Have you got any ideas of how to do this efficiently? (I can in theory grab the entire content via WSEditor.getContentReader(), parse it and count the lines and columns, but I'd want to avoid it if possible.)