Issue with ValidationProblemsFilter
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Issue with ValidationProblemsFilter
Hello,
We work with the version 24.0.0 of Oxygen sdk.
We need to check the xsd validity of the current document before start an action.
Currently we do it this way :
But sometimes validationProblems.getProblemsList() is null.
How it is possible ? Is it a normal behavior ?
Is there a more efficient way to check the validity of the current document ?
Thanks,
Regards,
Isabelle
We work with the version 24.0.0 of Oxygen sdk.
We need to check the xsd validity of the current document before start an action.
Currently we do it this way :
Code: Select all
final isDocumentXsdValid = false;
authorAccess.getEditorAccess().getParentEditor().addValidationProblemsFilter(new ValidationProblemsFilter() {
public void filterValidationProblems(ValidationProblems validationProblems) {
isDocumentXsdValid = validationProblems.getProblemsList().stream().noneMatch(p -> p.getEngineName().equals("Xerces"));
}
});
authorAccess.getEditorAccess().getParentEditor().checkValid();
How it is possible ? Is it a normal behavior ?
Is there a more efficient way to check the validity of the current document ?
Thanks,
Regards,
Isabelle
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Issue with ValidationProblemsFilter
Hi Isabelle,
If the method "validationProblems.getProblemsList()" returns null it means there are no validation errors found by Oxygen so the document is valid. I will update the Javadoc on the method to state this more clearly.
The "ro.sync.exml.workspace.api.editor.WSEditor.checkValid()" method returns a boolean result but from your code I guess you want to ignore certain validation errors and look only for the Xerces related errors. You should also try to avoid calling "addValidationProblemsFilter" multiple times as you will keep adding listeners on the editor, or after calling "WSEditor.checkValid()" use the "removeValidationProblemsFilter" API to remove your listener.
Regards,
Radu
If the method "validationProblems.getProblemsList()" returns null it means there are no validation errors found by Oxygen so the document is valid. I will update the Javadoc on the method to state this more clearly.
The "ro.sync.exml.workspace.api.editor.WSEditor.checkValid()" method returns a boolean result but from your code I guess you want to ignore certain validation errors and look only for the Xerces related errors. You should also try to avoid calling "addValidationProblemsFilter" multiple times as you will keep adding listeners on the editor, or after calling "WSEditor.checkValid()" use the "removeValidationProblemsFilter" API to remove your listener.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Issue with ValidationProblemsFilter
Hello Radu,
Thanks for the answer.
Is there a difference with null response or empty list response ?
Regards,
Isabelle
Thanks for the answer.
Most of the times, I have "validationProblems.getProblemsList()" initialized with size to 0.
Is there a difference with null response or empty list response ?
Regards,
Isabelle
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service