Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate possibilities to return XPath Reference to XML Element causing the validation error #108

Closed
dlabordus opened this issue Aug 24, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@dlabordus
Copy link

dlabordus commented Aug 24, 2022

Currently when executing a validation the message is returned and also on which line/column the error occurred.
For the engineer it's now hard to fix these issue, because the engineer needs to look in the XML File to see at which line the error occurred to know how to fix the error. Or search in the editors for the element causing the error.

The idea is to return a XPath Expression that can be used to search for the Element/Node in the document.
This way a wizard can be started, if available for the element, to edit the values.

The big issue is how to convert the line number/column number to a XPath Expression.

Acceptance criteria:
Search for solution to make it possible to return a XPath Expression from the schema validation and OCL Rule.
The last one will be a proposal to RiseClipse to make it possible to return the XPath Expression in the message.

Result:

XSD Validation ->
For the Schema validation I found a possible solution to get the Element/Node in the Error Handler.
https://stackoverflow.com/questions/67500546/java-xsd-validator-get-the-node-of-the-element-containing-the-validation-err
The next step will be to convert this Node to a XPath Expression that can be used by the frontend.

RiseClipse Validation ->
If it's possible for RiseClipse to return a XPath Expression in the validation message we need to ask the RiseClipse Team.
I see possibilities in the class 'SCLXMLHandler', here the line number is also added to the EObject. Maybe something can also be done here to store the Element information, see 'org.eclipse.emf.ecore.xmi.impl.XMLHandler' which is extended indirectly by 'SCLXMLHandler'.
But it won't be easy, because there is no Document. We only have the method 'startElement' probably with information about the element being processed.
If we want to support the RiseClipse Team more, the hard thing for now is to have a working development environment.
You probably need to start using Eclipse and see how to compile everything.

@dlabordus dlabordus added the enhancement New feature or request label Aug 24, 2022
@dlabordus dlabordus self-assigned this Aug 24, 2022
@dlabordus dlabordus changed the title Investigate possibilities to return XPath Reference to XML Element causing validation error Investigate possibilities to return XPath Reference to XML Element causing the validation error Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant