cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schmidt, Maik, MTC-DTM, ST" <Maik.Schm...@PASSO.DE>
Subject Small bug in XSPUtil.toMarkup?
Date Wed, 04 Oct 2000 12:34:44 GMT
Yo!

I think, I have found a small bug in XSPUtil.toMarkup, that leads to
problems with attribute values containing XML's special characters '<', '>'
and '&'.

So, if you call XSPUtil.toMarkup on a document containing the element
'<Service name="Park&Ride"/>', the function won't work properly, i.e.,
returning the string '<Service name="Park&amp;Ride"/>'.

In my opinion the problem is in the Method doMarkup:

case Node.ELEMENT_NODE: {
  Element element = (Element) node;

  buffer.append("<" + element.getTagName());

  NamedNodeMap attributes = element.getAttributes();
  int attributeCount = attributes.getLength();

  for (int i = 0; i < attributeCount; i++) {
    Attr attribute = (Attr) attributes.item(i);

    buffer.append(" ");
    buffer.append(attribute.getName());
    buffer.append("=\"");
    buffer.append(attribute.getValue());  //  This one has to be
'buffer.append(encodeMarkup(attribute.getValue()));'?
    buffer.append("\"");
  }

Best regards,

  Maik


Mime
View raw message