Page 1 of 1

Possible to determine available attributes on not yet insert

Posted: Mon Oct 06, 2014 11:06 pm
by ArbitraryName
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.

Re: Possible to determine available attributes on not yet in

Posted: Tue Oct 07, 2014 12:14 pm
by alex_jitianu
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