Class XmlElementField
- java.lang.Object
-
- org.beanio.internal.parser.format.xml.XmlFieldFormat
-
- org.beanio.internal.parser.format.xml.XmlElementField
-
- All Implemented Interfaces:
FieldFormat,XmlNode
public class XmlElementField extends XmlFieldFormat
AFieldFormatfor a field in an XML formatted stream parsed as an element of its parent.- Since:
- 2.0
-
-
Field Summary
-
Fields inherited from interface org.beanio.internal.parser.format.xml.XmlNode
XML_TYPE_ATTRIBUTE, XML_TYPE_ELEMENT, XML_TYPE_NONE, XML_TYPE_TEXT
-
-
Constructor Summary
Constructors Constructor Description XmlElementField()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringextractText(XmlUnmarshallingContext context)Extracts a field from a record during unmarshalling.java.lang.StringgetLocalName()Returns the XML local name for this node.java.lang.StringgetNamespace()Returns the namespace of this node.java.lang.StringgetPrefix()Returns the namespace prefix for marshaling this node, ornullif the namespace should override the default namespace.intgetType()Returns the XML node type.voidinsertText(XmlMarshallingContext ctx, java.lang.String fieldText)Inserts a field into the record during marshalling.booleanisNamespaceAware()Returnstrueif a namespace was configured for this node, and is therefore used to unmarshal and marshal the node.booleanisNillable()Returns whether this field is nillable.booleanisRepeating()Returns whether this node may repeat in the context of its immediate parent.voidsetLocalName(java.lang.String localName)Sets the element name.voidsetNamespace(java.lang.String namespace)Sets the namespace of this element.voidsetNamespaceAware(boolean namespaceAware)Sets whether this element is namespace aware.voidsetNillable(boolean nillable)Sets whether this element is nillable.voidsetPrefix(java.lang.String prefix)Sets a prefix to use for the namespace during marshalling.voidsetRepeating(boolean repeating)Sets whether this element repeats within the context of its parent.voidtoParamString(java.lang.StringBuilder s)Called byXmlFieldFormat.toString()to append attributes of this field.-
Methods inherited from class org.beanio.internal.parser.format.xml.XmlFieldFormat
extract, getName, getPadding, getSize, insertField, insertValue, isLazy, setLazy, setName, setPadding, toString
-
-
-
-
Method Detail
-
extractText
public java.lang.String extractText(XmlUnmarshallingContext context)
Description copied from class:XmlFieldFormatExtracts a field from a record during unmarshalling.- Specified by:
extractTextin classXmlFieldFormat- Parameters:
context- theXmlUnmarshallingContextholding the record- Returns:
- the extracted field text
-
insertText
public void insertText(XmlMarshallingContext ctx, java.lang.String fieldText)
Description copied from class:XmlFieldFormatInserts a field into the record during marshalling.- Specified by:
insertTextin classXmlFieldFormat- Parameters:
ctx- theXmlMarshallingContextholding the recordfieldText- the field text to insert
-
isRepeating
public boolean isRepeating()
Description copied from interface:XmlNodeReturns whether this node may repeat in the context of its immediate parent.- Returns:
- true if this node repeats, false otherwise
-
setRepeating
public void setRepeating(boolean repeating)
Sets whether this element repeats within the context of its parent.- Parameters:
repeating- true if repeating, false otherwise
-
getType
public int getType()
Description copied from interface:XmlNodeReturns the XML node type.- Returns:
- one of
XmlNode.XML_TYPE_NONE,XmlNode.XML_TYPE_ELEMENT,XmlNode.XML_TYPE_ATTRIBUTE, orXmlNode.XML_TYPE_TEXT
-
getLocalName
public java.lang.String getLocalName()
Description copied from interface:XmlNodeReturns the XML local name for this node.- Returns:
- the XML local name
-
setLocalName
public void setLocalName(java.lang.String localName)
Sets the element name.- Parameters:
localName- the element name
-
getNamespace
public java.lang.String getNamespace()
Description copied from interface:XmlNodeReturns the namespace of this node. If there is no namespace for this node, or this node is not namespace aware,nullis returned.- Returns:
- the XML namespace of this node
-
setNamespace
public void setNamespace(java.lang.String namespace)
Sets the namespace of this element.- Parameters:
namespace- the namespace
-
getPrefix
public java.lang.String getPrefix()
Description copied from interface:XmlNodeReturns the namespace prefix for marshaling this node, ornullif the namespace should override the default namespace.- Returns:
- the namespace prefix
-
setPrefix
public void setPrefix(java.lang.String prefix)
Sets a prefix to use for the namespace during marshalling.- Parameters:
prefix- the namespace prefix
-
isNillable
public boolean isNillable()
Description copied from interface:FieldFormatReturns whether this field is nillable.- Returns:
- true if nillable, false otherwise
-
setNillable
public void setNillable(boolean nillable)
Sets whether this element is nillable.- Parameters:
nillable- true if nillable, false otherwise
-
isNamespaceAware
public boolean isNamespaceAware()
Description copied from interface:XmlNodeReturnstrueif a namespace was configured for this node, and is therefore used to unmarshal and marshal the node.- Returns:
trueif this node uses a namespace for matching and formatting this node
-
setNamespaceAware
public void setNamespaceAware(boolean namespaceAware)
Sets whether this element is namespace aware.- Parameters:
namespaceAware- true if namespace aware, false otherwise
-
toParamString
public void toParamString(java.lang.StringBuilder s)
Description copied from class:XmlFieldFormatCalled byXmlFieldFormat.toString()to append attributes of this field.- Overrides:
toParamStringin classXmlFieldFormat- Parameters:
s- the text to append
-
-