public final class ExtensibleAttributes extends AbstractAttributeGroup
Starting in DDMS 3.0, this attribute group can decorate Organization,
Person, Service,
Unknown, Keyword, Category, or the Resource itself.
In DDMS 2.0, this attribute group can only decorate Organization,
Person, Service, or the Resource.
No validation or processing of any kind is performed by DDMSence on extensible attributes, other than the base
validation used when loading attributes from an XML file, and a check to confirm that extensible attributes do not
collide with existing attributes. This class merely exposes a getAttributes() method which returns a
read-only List of XOM Attributes that can be manipulated in business-specific ways.
For example, this ddms:Keyword would have an ExtensibleAttributes instance containing 2 attributes (assuming that the "opensearch" namespace was defined earlier in the file):
<ddms:Keyword ddms:value="xml" opensearch:relevance="95" opensearch:confidence="82" /> XOM attributes can be created as follows:
Attribute attribute = new Attribute("opensearch:relevance", "http://opensearch.namespace/", "95");
Attribute attribute = new Attribute("opensearch:confidence", "http://opensearch.namespace/", "82"); The DDMS documentation does not provide sample HTML/Text output for extensible attributes, so the following approach is used. In general, the HTML/Text output of extensible attributes will be prefixed with the name of the element being marked. For example:
keyword opensearch:relevance: 95
keyword opensearch:confidence: 82
<meta name="subjectCoverage.Subject.keyword.opensearch.relevance" content="95" />
<meta name="subjectCoverage.Subject.keyword.opensearch.confidence" content="82" />
Details about the XOM Attribute class can be found at: http://www.xom.nu/apidocs/index.html?nu/xom/Attribute.html
| Modifier and Type | Class and Description |
|---|---|
static class |
ExtensibleAttributes.AttributeBuilder
Builder for a XOM attribute.
|
static class |
ExtensibleAttributes.Builder
Builder for these attributes.
|
| Constructor and Description |
|---|
ExtensibleAttributes(nu.xom.Element element)
Base constructor
|
ExtensibleAttributes(List<nu.xom.Attribute> attributes)
Constructor which builds from raw data.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTo(nu.xom.Element element)
Convenience method to add these attributes onto an existing XOM Element
|
boolean |
equals(Object obj) |
List<nu.xom.Attribute> |
getAttributes()
Accessor for the attributes.
|
static ExtensibleAttributes |
getNonNullInstance(ExtensibleAttributes extensibleAttributes)
Returns a non-null instance of extensible attributes.
|
String |
getOutput(boolean isHTML,
String prefix)
Outputs to HTML or Text with a prefix at the beginning of each meta tag or line.
|
int |
hashCode() |
boolean |
isEmpty()
Checks if any attributes have been set.
|
protected void |
validate()
Currently, no further validation is performed.
|
getDDMSVersion, getValidationWarnings, getWarnings, validateSameVersionpublic ExtensibleAttributes(nu.xom.Element element)
throws InvalidDDMSException
Will only load attributes from a different namespace than DDMS (##other) and will also skip any Resource attributes that are reserved.
element - the XOM element which is decorated with these attributes.InvalidDDMSExceptionpublic ExtensibleAttributes(List<nu.xom.Attribute> attributes)
throws InvalidDDMSException
attributes - a list of extensible attributesInvalidDDMSException - if any required information is missing or malformedpublic static ExtensibleAttributes getNonNullInstance(ExtensibleAttributes extensibleAttributes) throws InvalidDDMSException
extensibleAttributes - the attributes to return by defaultInvalidDDMSException - if there are problems creating the empty attributes instancepublic void addTo(nu.xom.Element element)
throws InvalidDDMSException
element - the element to decorateInvalidDDMSException - if the attribute already existspublic boolean isEmpty()
protected void validate()
throws InvalidDDMSException
validate in class AbstractAttributeGroupInvalidDDMSException - if any required information is missing or malformedpublic String getOutput(boolean isHTML,
String prefix)
AbstractAttributeGroupgetOutput in class AbstractAttributeGroupisHTML - true for HTML, false for Textprefix - the prefix to addAbstractAttributeGroup.getOutput(boolean, String)public boolean equals(Object obj)
equals in class ObjectObject.equals(Object)public int hashCode()
hashCode in class ObjectObject.hashCode()public List<nu.xom.Attribute> getAttributes()
Copyright 2010 - 2013 by Brian Uri!
Generated on 12/15/2013 10:22 AM
http://ddmsence.urizone.net/