else
{
attrExpr = getElementsByLocalName + ".attributes[\"" + attrName.getLocalPart() + "\"]";
}
BindingExpression be = attributeBindings.get(attrName);
be.setDestinationE4X(e4x);
be.setDestinationXMLAttribute(true);
be.setDestinationLValue(attrExpr);
be.setDestinationProperty(destinationProperty + "[" + node.getIndex() + "]");
be.setDestination(xml);
xml.setHasBindings(true);
if (e4x)
{
PrefixMapping.pushNamespaces(be, namespaces);
if (nsUri.length() > 0)
{
be.addNamespace(nsUri, nsId);
}
}
}
}
try
{
if (e4x)
{
node.toStartElement((StringWriter) serializer);
}
else
{
QName qname = new QName(node.getNamespace(), node.getLocalPart(), node.getPrefix());
((XMLStringSerializer) serializer).startElement(qname, new AttributesHelper(node));
}
if (node.getChildCount() == 1 && node.getChildAt(0) instanceof CDATANode)
{
CDATANode cdata = (CDATANode) node.getChildAt(0);
if (cdata.image.length() > 0)
{
if (cdata.inCDATA)
{
//in CDATA Section, leave exactly as is
if (e4x)
{
((StringWriter) serializer).write("<![CDATA[" + cdata.image + "]]>");
}
else
{
((XMLStringSerializer) serializer).writeString(cdata.image);
}
}
else
{
//not in CDATA section so extract bindings and cleanup binding escapes
BindingExpression be = textParser.parseBindingExpression(cdata.image, cdata.beginLine);
if (be != null)
{
if (be.isTwoWayPrimary() && !allowTwoWayBind)
{
log(cdata, new AbstractBuilder.TwoWayBindingNotAllowed());
}
else
{
String destinationProperty = createExpression(destinationPropertyStack);
be.setDestinationLValue(getElementsByLocalName);
be.setDestinationProperty(destinationProperty + "[" + node.getIndex() + "]");
be.setDestination(xml);
be.setDestinationXMLNode(true);
xml.setHasBindings(true);
if (e4x)
{
be.setDestinationE4X(true);
PrefixMapping.pushNamespaces(be, namespaces);
}
}
}
else if (e4x)