15.3. Using `linkType` to define custom, specialized, attribute editors
Prev | 15. linkType | Next

### 15.3. Using `linkType` to define custom, specialized, attribute editors

The `attributeEditor` configuration element allows to extend the Attributes tools by implementing custom, specialized, attribute editors. The link type feature comes with two implementations of interface `com.xmlmind.xmledit.cmd.attribute.SetAttribute.ChoicesFactory`. These two classes allow to quickly and easily specify the value of attributes which are anchor names and/or the value of attributes which are pointers to anchors:

`com.xmlmind.xmleditapp.linktype.RefChoicesFactory`

  This class lists all the anchor names found in the document being edited. Each anchor name is followed by a short description of the element acting as an anchor.

  If the document being edited is part of a document set, this class also lists all the anchor names found in the peer documents.

  DocBook example:

      <attributeEditor attribute="linkend" elementMatches="xref|link">
        <class>com.xmlmind.xmleditapp.linktype.RefChoicesFactory</class>
        <property name="listIfMemberOfDocSet" type="boolean" value="true" />
      </attributeEditor>

      <attributeEditor attribute="id" elementMatches="*">
        <class>com.xmlmind.xmleditapp.linktype.RefChoicesFactory</class>
        <property name="listIfMemberOfDocSet" type="boolean" value="true" />
      </attributeEditor>

`com.xmlmind.xmleditapp.linktype.HrefChoicesFactory`

  This class lists all the anchor names found in the document being edited. An anchor name is prefixed with '`#`'. Each anchor name is followed by a short description of the element acting as an anchor.

  If the document being edited is part of a document set, this class also lists the relative URIs of all peer documents. If the user types ``relative_URI`#` in the Value field of the Attribute tool or in the specialized dialog box displayed by the Edit button, this class will auto-complete ``relative_URI`#` by all the anchor names found in peer document `relative_URI`.

  XHTML example:

      <attributeEditor attribute="href" elementMatches="html:a">
        <class>com.xmlmind.xmleditapp.linktype.HrefChoicesFactory</class>
      </attributeEditor>

  DITA topic example:

      <attributeEditor attribute="href" elementMatches="xref|link">
        <class>com.xmlmind.xmleditapp.linktype.HrefChoicesFactory</class>
      </attributeEditor>

Prev | Up | Next
15.2. Using `linkType` to implement link validation | Home | 16. menu