Creating a new link definition

In the following steps you will be creating and/or configuring Spring beans in a Spring context file. A basic knowledge of Spring and the Spring Framework is required.

  1. Open or create a new Spring context file.
  2. Create an link definitionbean. The following example is the link definition for an hyperlink in XHTML pages. Here the link definition specifies that an hrefattribute on any element is to be considered a link to extract. You may map attributes from the element on which such a link is extracted as additional properties for the link. For each entry, the key is the attribute name and the value is the qualified name of a supported link property. The xlink:hrefproperty should always be mapped so that Componize may validate the link.
    <bean id="xhtml.linkDefinition.href" parent="xlink.rdf.linkDefinition.abstract">
      <property name="role" value="hyperlink" />
      <property name="attribute" value="href" />
      <property name="attributeMappings">
        <map>
          <entry key="href" value="{http://www.w3.org/1999/xlink}href" />
        </map>
      </property>
    </bean>
  3. Restart the application server for your changes to take effect.
  4. Optional: You may also define a link definition with an explicit required element name (or list of element names). Here the example is the link definition for image links in XHTML pages. The altattribute is also mapped to the xlink:titlelink property.
    <bean id="xhtml.linkDefinition.img" parent="xlink.rdf.linkDefinition.abstract">
      <property name="role" value="image" />
      <property name="element" value="{http://www.w3.org/1999/xhtml}img" />
      <property name="attribute" value="src" />
      <property name="attributeMappings">
        <map>
          <entry key="alt" value="{http://www.w3.org/1999/xlink}title" />
          <entry key="src" value="{http://www.w3.org/1999/xlink}href" />
        </map>
      </property>
    </bean>