Page 1 of 1

InsertXMLFragmentSchemaAware questions

Posted: Thu Aug 17, 2023 10:21 am
by Johann
Hello,

I use Author web 25.1.0.0.

I've created a button to add a specific fragment at the cursor position.

Since I want the insertion of the fragment to be valid, I have several possible approaches:

- initially disable the button when insertion at the cursor will cause a validation error thanks to :

Code: Select all

authorSchemaManager.createWhatElementsCanGoHereContext(caretOffset)
- use the insertXMLFragmentSchemaAware method to ensure that the fragment is positioned in a valid location.

My questions concern the 2nd way.
In the javadoc, for the method insertXMLFragmentSchemaAware it is specified :
If the fragments insertion is not allowed, a dialog will be shown proposing one of following solutions if they apply:
However, I don't see any dialog allowing me to choose the location, the fragment is automatically inserted in a valid location. Is this normal?

Before the fragment is inserted using the insertXMLFragmentSchemaAware method, would it be possible to warn the user of the location (xpath for example) where the fragment is about to be inserted? In fact, I'd like to be able to ask the user to confirm the automatic location found by Oxygen (SchemaAwareHandlerResult schemaAwareHandlerResult) without the fragment being inserted yet.

Thank you,

Johann

Re: InsertXMLFragmentSchemaAware questions

Posted: Fri Aug 18, 2023 10:15 am
by mihaela
Hello,

Web Author automatically uses what it considers to be the best insertion solution, when there is an attempt to insert content that is not valid in a specific context. So the documentation pointed out by you is only available for Oxygen XML Editor, which can ask the user to choose from a list of proposed solutions.

You cannot configure Web Author to ask the user what solution wants to be applied, but you make some customizations in your action If you identify some cases where the insert action behavior is less than optimal. You can read more about this in our documentation:
https://www.oxygenxml.com/doc/versions/ ... zb_vsy_dlb

Best Regards,
Mihaela