Possible to determine available attributes on not yet insert

Post here questions and problems related to oXygen frameworks/document types.
ArbitraryName
Posts: 16
Joined: Tue Aug 05, 2014 8:36 pm

Possible to determine available attributes on not yet insert

Post by ArbitraryName » Mon Oct 06, 2014 11:06 pm

I am looking to create a generic UI where it would be useful for me to be able to determine the possible attributes on a given element about to be inserted. It looks like AuthorSchemaManager has some useful functions that apply to elements already existing in a document, but I need to introspect the options before insertion. Is there any way to do this through the SDK? I see createWhatAttributesCanGoHereContext(AuthorElement element) but am unsure as to how I might create an AuthorElement.

alex_jitianu
Posts: 687
Joined: Wed Nov 16, 2005 11:11 am

Re: Possible to determine available attributes on not yet in

Post by alex_jitianu » Tue Oct 07, 2014 12:14 pm

Hello,

You can get the possible attribute of an element (without it being actually in the document) like this:

Code: Select all


WhatElementsCanGoHereContext whatElementsCanGoHereContext = authorSchemaManager.createWhatElementsCanGoHereContext(offset);
List<CIElement> whatElementsCanGoHere = authorSchemaManager.whatElementsCanGoHere(whatElementsCanGoHereContext);
for (CIElement ciElement : whatElementsCanGoHere) {
// TODO Look for the CIElement of interest (the one that will be inserted)
if ("p".equals(ciElement.getName())) {
// Then get its attributes like this:
List<CIAttribute> attributes = ciElement.getAttributes();
}
}
Best regards,
Alex

Post Reply