public final class AttributeValueXHTML extends AttributeValue
AttributeValue
class specifically for XHTML
values
This class extends from the base class AttributeValue
.
The specific form of an AttributeValueXHTML
in a ReqIF file is as follows:
<ATTRIBUTE-VALUE-XHTML IS-SIMPLIFIED="isSimplified">
<THE-VALUE>
<reqif-xhtml:div xmlsn:reqif-xhtml="http://www.w3.org/1999/xhtml">...</reqif-xhtml:div>
</THE-VALUE>
<THE-ORIGINAL-VALUE>
<reqif-xhtml:div xmlsn:reqif-xhtml="http://www.w3.org/1999/xhtml">...</reqif-xhtml:div>
</THE-ORIGINAL-VALUE>
...
</ATTRIBUTE-VALUE-XHTML>
The following is the list of XML attributes:
@IS-SIMPLIFIED
optional xsd:boolean
if omitted, false
is implied. If true
, then theOriginalValue
cannot be nullThe XHTML top level content of either THE-VALUE
or THE-ORIGINAL-VALUE
should comprise a single
div
element in the http://www.w3.org/1999/xhtml namespace. Inside this element can be any other ReqIF XHTML
compliant structures.
THE-ORIGINAL-VALUE
is optional if isSimplified
is false
.
Modifier and Type | Method and Description |
---|---|
static org.w3c.dom.Element |
createXHTMLElement(java.lang.String text)
Creates and initializes an
Element object with the ReqIF XHTML namespace
xmlns:reqif-xhtml=<"http://www.w3.org/1999/xhtml"> |
static org.w3c.dom.Element |
createXHTMLElementFromXml(ReqIFFile reqIFFile,
java.lang.String xmlText)
Creates and initializes an
Element object with the specified ReqIF XHTML XML. |
static org.w3c.dom.Element |
createXHTMLElementFromXml(ReqIFFile reqIFFile,
java.lang.String xmlText,
java.util.function.Consumer<ValidationMessage> validationMessageConsumer)
Creates and initializes an
Element object with the specified ReqIF XHTML XML with validation. |
AttributeDefinitionXHTML |
getAttributeDefinitionXHTML()
The
AttributeDefinitionXHTML associated with this attribute value |
DatatypeDefinitionXHTML |
getDatatypeDefinitionXHTML()
The
DatatypeDefinitionXHTML associated with this attribute value |
java.lang.String |
getDisplayText()
Returns a
String representation of the THE-VALUE ReqIF XHTML content. |
java.util.List<ReferencedFile> |
getReferencedFiles() |
org.w3c.dom.Element |
getTheOriginalValue()
Returns the
Element object representing the THE-ORIGINAL-VALUE ReqIF XHTML content element. |
org.w3c.dom.Element |
getTheValue()
Returns the
Element object representing the THE-VALUE ReqIF XHTML content element. |
java.lang.Object |
getValue()
Returns the native value as
Object |
boolean |
isSimplified()
Returns the value of the
@IS-SIMPLIFIED attribute for this object. |
void |
setIsSimplified(boolean isSimplified)
Sets the value of the
@IS-SIMPLIFIED attribute for this object. |
void |
setTheOriginalValue(org.w3c.dom.Element theOriginalValue)
Sets the
Element representing the THE-ORIGINAL-VALUE ReqIF XHTML content. |
void |
setTheOriginalValue(org.w3c.dom.Element theOriginalValue,
java.util.function.Consumer<ValidationMessage> validationMessageConsumer)
Sets the
Element representing the THE-ORIGINAL-VALUE ReqIF XHTML content with validation. |
void |
setTheValue(org.w3c.dom.Element theValue)
Sets the
Element representing the THE-VALUE ReqIF XHTML content with validation. |
void |
setTheValue(org.w3c.dom.Element theValue,
java.util.function.Consumer<ValidationMessage> validationMessageConsumer)
Sets the
Element representing the THE-VALUE ReqIF XHTML content. |
void |
setTheValue(org.w3c.dom.Element theValue,
org.w3c.dom.Element theOriginalValue,
boolean isSimplified)
Sets the
Element representing the THE-VALUE ReqIF XHTML content with validation. |
static boolean |
validate(ReqIFFile reqIFFile,
org.w3c.dom.Element theValue,
java.util.function.Consumer<ValidationMessage> validationMessageConsumer)
Validates the XML contents in the specified
theValue Element parameter against the ReqIF XHTML standard. |
getAttributeDefinition, getAttributeDefinitionLongName, getDatatypeDefinition, getReqIFContent, getReqIFContent, getSpecElementWithAttributes
public java.util.List<ReferencedFile> getReferencedFiles()
public static boolean validate(ReqIFFile reqIFFile, org.w3c.dom.Element theValue, java.util.function.Consumer<ValidationMessage> validationMessageConsumer)
theValue
Element
parameter against the ReqIF XHTML standard.
Validation messages are sent to the Consumer
parameter validationMessageConsumer
reqIFFile
- the ReqIFFile
object against which the validation is to be carried out, not nulltheValue
- the Element
containing the XML to validate, not nullvalidationMessageConsumer
- a consumer of validation messages, not nulltrue
if no validation errors occurred, false
otherwisepublic static org.w3c.dom.Element createXHTMLElement(java.lang.String text) throws javax.xml.parsers.ParserConfigurationException
Element
object with the ReqIF XHTML namespace
xmlns:reqif-xhtml=<"http://www.w3.org/1999/xhtml">text
- the text content to apply to the div
element, can be nullElement
object comprising a single reqif-xhtml:div
element set with the specified text content, not nulljavax.xml.parsers.ParserConfigurationException
- if an error occurs during Element
creationpublic static org.w3c.dom.Element createXHTMLElementFromXml(ReqIFFile reqIFFile, java.lang.String xmlText) throws ValidationException, InvalidValueException, java.lang.Exception
Element
object with the specified ReqIF XHTML XML.
The specified XML must have appropriately specified namespace xmlns:reqif-xhtml=<"http://www.w3.org/1999/xhtml">
reqIFFile
- the ReqIFFile
object, not nullxmlText
- the XML text to convert to an Element
object, not nullElement
object representing the specified XML text, not nulljava.lang.Exception
- if an error occurs during XML Element
creationInvalidValueException
- if either reqIFFile
or xmlText
parameters are nullValidationException
- if the XML does not conform to ReqIF XHTML standardspublic static org.w3c.dom.Element createXHTMLElementFromXml(ReqIFFile reqIFFile, java.lang.String xmlText, java.util.function.Consumer<ValidationMessage> validationMessageConsumer) throws ValidationException, java.lang.Exception
Element
object with the specified ReqIF XHTML XML with validation.
The specified XML must have appropriately specified namespace xmlns:reqif-xhtml=<"http://www.w3.org/1999/xhtml">
reqIFFile
- the ReqIFFile
object, not nullxmlText
- the XML text to convert to an Element
object, not nullvalidationMessageConsumer
- a consumer of validation message objects ValidationMessage
, not nullElement
object representing the specified XML text, not nulljava.lang.Exception
- if an error occurs during XML Element
creationInvalidValueException
- if either reqIFFile
or xmlText
or validationMessageConsumer
parameters are nullValidationException
- if the XML does not conform to ReqIF XHTML standardspublic boolean isSimplified()
@IS-SIMPLIFIED
attribute for this object.
If this flag is true
, THE-ORIGINAL-VALUE
must be specified.
@IS-SIMPLIFIED
attribute for this objectpublic void setIsSimplified(boolean isSimplified) throws InvalidValueException
@IS-SIMPLIFIED
attribute for this object.
When setting this flag to true
, ensure that theOriginalValue
has been set to the original
theValue
content.
isSimplified
- the value to set for the @IS-SIMPLIFIED
attribute for this objectInvalidValueException
- if the flag is set to true
but theOriginalValue
has not be setpublic org.w3c.dom.Element getTheOriginalValue()
Element
object representing the THE-ORIGINAL-VALUE
ReqIF XHTML content element.
This Element
must be set to a copy of the original theValue
before setting isSimplified
to true
.
Element
object representing the THE-ORIGINAL-VALUE
ReqIF XHTML content element, can be nullpublic void setTheOriginalValue(org.w3c.dom.Element theOriginalValue) throws InvalidValueException, ValidationException, NotFoundException
Element
representing the THE-ORIGINAL-VALUE
ReqIF XHTML content.theOriginalValue
- the Element
object representing the THE-ORIGINAL-VALUE
ReqIF XHTML content, can be nullValidationException
- if the theOriginalValue
element does not conform to ReqIF XHTML standardsNotFoundException
- if the AttributeDefinitionXHTML
for this AttributeValueXHTML
was not found in the SpecType
SpecAttributes
collectionInvalidValueException
- if isSimplified
has been set but theOriginalValue
is nullpublic void setTheOriginalValue(org.w3c.dom.Element theOriginalValue, java.util.function.Consumer<ValidationMessage> validationMessageConsumer) throws ValidationException, NotFoundException
Element
representing the THE-ORIGINAL-VALUE
ReqIF XHTML content with validation.theOriginalValue
- the Element
object representing the THE-ORIGINAL-VALUE
ReqIF XHTML content, not nullvalidationMessageConsumer
- a consumer of validation messages, not nullValidationException
- if the theOriginalValue
element does not conform to ReqIF XHTML standardsNotFoundException
- if the AttributeDefinitionXHTML
for this AttributeValueXHTML
was not found in the SpecType
SpecAttributes
collectionpublic org.w3c.dom.Element getTheValue()
Element
object representing the THE-VALUE
ReqIF XHTML content element.Element
object representing the THE-VALUE
ReqIF XHTML content element, not nullpublic void setTheValue(org.w3c.dom.Element theValue) throws ValidationException, NotFoundException
Element
representing the THE-VALUE
ReqIF XHTML content with validation.theValue
- the Element
object representing the THE-VALUE
ReqIF XHTML content, not nullValidationException
- if the theValue
element does not conform to ReqIF XHTML standardsNotFoundException
- if the AttributeDefinitionXHTML
for this AttributeValueXHTML
was not found in the SpecType
SpecAttributes
collectionpublic void setTheValue(org.w3c.dom.Element theValue, org.w3c.dom.Element theOriginalValue, boolean isSimplified) throws ValidationException, NotFoundException
Element
representing the THE-VALUE
ReqIF XHTML content with validation.theValue
- the Element
object representing the THE-VALUE
ReqIF XHTML content, not nulltheOriginalValue
- the Element
object representing the THE-ORIGINAL-VALUE
ReqIF XHTML content, can be nullisSimplified
- boolean
specifying whether THE-VALUE
is a simplified version of the requirement content and consequently THE-ORIGINAL-VALUE
is the original contentValidationException
- if the theValue
element does not conform to ReqIF XHTML standardsNotFoundException
- if the AttributeDefinitionXHTML
for this AttributeValueXHTML
was not found in the SpecType
SpecAttributes
collectionpublic void setTheValue(org.w3c.dom.Element theValue, java.util.function.Consumer<ValidationMessage> validationMessageConsumer) throws ValidationException, NotFoundException
Element
representing the THE-VALUE
ReqIF XHTML content.theValue
- the Element
object representing the THE-VALUE
ReqIF XHTML content, not nullvalidationMessageConsumer
- a consumer of validation messages, not nullValidationException
- if the theValue
element does not conform to ReqIF XHTML standardsNotFoundException
- if the AttributeDefinitionXHTML
for this AttributeValueXHTML
was not found in the SpecType
SpecAttributes
collectionpublic AttributeDefinitionXHTML getAttributeDefinitionXHTML()
AttributeDefinitionXHTML
associated with this attribute valueAttributeDefinitionXHTML
object associated with this object, not nullpublic DatatypeDefinitionXHTML getDatatypeDefinitionXHTML()
DatatypeDefinitionXHTML
associated with this attribute valueDatatypeDefinitionXHTML
object associated with this object, not nullpublic java.lang.String getDisplayText()
String
representation of the THE-VALUE
ReqIF XHTML content.getDisplayText
in class AttributeValue
String
representation of the THE-VALUE
REQIF XHTML content, not nullpublic java.lang.Object getValue()
Object
getValue
in class AttributeValue
theValue
Element
value as Object