Page 1 of 1

Parsing a Schema

Posted: Thu Feb 11, 2010 2:24 am
by dylan
I am about to start development on a tool that will (in Author mode) provide functionality that is similar to the 'surround with' dialog that is displayed when a user selects some text and hits ctrl+spacebar.

The form I am creating needs to display a list of valid tags that can be applied based on the location of the selected text.

Before I begin from scratch, I was wondering if there is a way for me to utilize the functionality behind the 'surround with' dialog?

If not, is there another way to get a list of valid tags other than manually parsing the schema with a package like XSOM?

Thanks!

Re: Parsing a Schema

Posted: Thu Feb 11, 2010 10:23 am
by Radu
Hi Dylan,

I will assume you are using Oxygen and the Author SDK to customize editing in the Author page.
In Oxygen 11.1 new API was added to the AuthorDocumentController to allow access to an AuthorSchemaManager object:

Code: Select all


  public AuthorSchemaManager getAuthorSchemaManager();
The AuthorSchemaManager contains a method to build an elements context like:

Code: Select all


  WhatElementsCanGoHereContext createWhatElementsCanGoHereContext(int offset) throws BadLocationException;
and then require the elements which can appear at that certain offset:

Code: Select all


  List<CIElement> getChildrenElements(WhatElementsCanGoHereContext context);
Regards,
Radu