Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Adding a textfield type form field - the dc:title element

We can use the information in our table to fill out the "Element Form" pane. We can start with the title element.

In this part of the form you can enter values for Identifier, Type, Title, Description, Default Value, and Required. These can be defined as follows:

Identifier: Identifies An ID for this form field. It is the Drupal form array key for this element. Typically you would just enter the name of the element you are describing.

Type: Used to determine the type of form field. The form field type for this field (textfield, textarea, select, etc.)

Title: The label of the form field as it appears on your form. Typically you would just enter the name of the element you are describing.

Description: The description of the form fieldelement that this Element Form is about.

Default Value: The value of the form field that will be displayed to be display or selected initially for this element if the form has not been submitted yet.

Required: Indicates whether or not the element is required. This automatically validates for empty fields, and flags inputs as required. Fields with a type Type of "file" are not allowed to be required.

...

The rest of the form deals with where each element is created, read, updated, and deleted in the XML tree. This is where it would be useful to understand how XML works and to have a basic understanding of XPATHXPath.

Reviewing our OAI DC XML sample record we can determine the location/context of the title element.

Code Block
languagehtml/xml
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" 
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/
[http://www.openarchives.org/OAI/2.0/oai_dc.xsd]">
<dc:title>Pioneer days & shanty ways</dc:title>

The full XPATH XPath in this XML document for the dc:title element would be:

Code Block
/oai_dc:dc/dc:title

where /oai_dc:dc is the parent element and dc:title is the child element. The Create dialogue is where we enter the information needed for creating an element in our form. We’ll be entering information into the Path Context, Path, Type, and Value properties in our example. If you had an order-based schema, you would also fill in the Schema field. Here are some definitions for each of those properties:

Path Context: the context in at which the path XPath action with be executed in.

  • document - the XPath query is run from the root element of the document
  • parent - the XPath query is run from the node created/read by its parent’s form field
  • self - only applies to Delete and Update actions and applies to the node selected by the Read action.

Path: An XPath to this element’s parent object. This is used to determine whether where this element is inserted.

...

Type: The type of node that will be created. If XML is specified, an XML snippet is expected in the value Value field.

Value: If the type Type is either Element or Attribute, "element" or "attribute," the name of the element or attribute is expected here. If the type Type is "XML," an XML snippet is expected in which %value% indicates where the value of the form field will be inserted whereever the string %value% is used in the XML snippet.

Review the image below and think about how your other OAI DC elements will be created based on this pattern.

...