Create a MediaTypeProperty instance.
Parameters:
| Name |
Type |
Attributes |
Description |
data |
object
|
<optional>
|
Initial property values.
Properties
| Name |
Type |
Attributes |
Description |
name |
string
|
null
|
<optional>
|
Property name. |
value |
string
|
null
|
<optional>
|
Property value. |
|
- Source:
Methods
toElement(doc) → {Element}
Serialize the media type property to XML.
Parameters:
| Name |
Type |
Description |
doc |
XMLDocument
|
XML document used to create elements. |
- Source:
Returns:
Serialized XML element.
-
Type
-
Element
toJSON() → {object}
Return a JSON-serializable representation of the media type property.
- Source:
Returns:
Plain media type property data.
-
Type
-
object
validate(pathopt) → {Array.<object>}
Validate the media type property state.
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
path |
string
|
<optional>
|
mediaType.property
|
Base path used in validation errors. Defaults to
`mediaType.property`. |
- Source:
Returns:
Validation errors for invalid fields.
-
Type
-
Array.<object>
Create a MediaTypeProperty from a `property` XML element.
Parameters:
| Name |
Type |
Description |
element |
Element
|
XML element to parse. |
- Source:
Returns:
Parsed media type property instance.
-
Type
-
MediaTypeProperty
parse(element, parseWarningsopt, pathopt) → {MediaTypeProperty|null}
Parse a `property` XML element, dropping it when invalid.
Nested child elements are not supported and are treated as lossy input.
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
element |
Element
|
null
|
|
|
XML element to parse. |
parseWarnings |
Array.<object>
|
<optional>
|
|
Lossy parse warnings. |
path |
string
|
<optional>
|
mediaType.properties
|
Field path used in warnings and validation. |
- Source:
Returns:
Parsed property or null when invalid.
-
Type
-
MediaTypeProperty
|
null