Class XmlAttribute

java.lang.Object
com.northconcepts.datapipeline.xml.builder.XmlAttribute

public class XmlAttribute extends Object
An attribute of an XmlElement whose name and value are expressions, optionally written only when a condition is true.
  • Constructor Details

    • XmlAttribute

      public XmlAttribute(String name, String value)
      Creates an attribute whose name and value are expressions; quote literal text, as in 'id'.
    • XmlAttribute

      public XmlAttribute(String name, String value, String condition)
      Creates an attribute that is written only when the logical expression condition is true.
  • Method Details

    • getName

      public XmlExpression getName()
    • getValue

      public XmlExpression getValue()
    • getCondition

      public XmlLogicalExpression getCondition()
      Returns the condition that must be true for the attribute to be written, or null if it is always written.
    • write

      public void write(ExpressionContext context, CodeWriter writer) throws IOException
      Writes the attribute as name="value", both XML-escaped, unless its condition is false.
      Throws:
      IOException