Page 1 of 1

validate of attributes from CSS

Posted: Sun Mar 16, 2014 8:40 pm
by dvezina
I'm setting a @name attribute with contents of a text field. When a user types in "&" I end up with an invalid attribute value.

Code: Select all


LISTING:before{
display:table-row;
padding-top:4px;
padding-bottom:8px;
font-size:120%;
font-weight:bold;
text-align:left;
content:oxy_editor(
type, text,
edit, "@name",
columns, 45,
fontInherit, true
)

Code: Select all

name="Bed & Breakfast"
Does anyone know of a function to transform this into a valid attribute value?

THANKS

Re: validate of attributes from CSS

Posted: Mon Mar 17, 2014 4:41 pm
by alex_jitianu
Hello,

Thank you for reporting this problem. I've added a high priority issue and you'll get notified as soon as it's resolved. Meanwhile, you could resolve the problem at the ro.sync.ecss.extensions.api.AuthorDocumentFilter level on the setAttribute(AuthorDocumentFilterBypass, String, AttrValue, AuthorElement) method. Your code should look something like the one below:

Code: Select all


private final class AuthorDocumentFilterExtension extends AuthorDocumentFilter {
@Override
public void setAttribute(AuthorDocumentFilterBypass filterBypass, String attributeName,
AttrValue value, AuthorElement element) {
AttrValue newValue = new AttrValue(
XmlUtil.escapeAttributeValue(value.getValue()),
value.getValue(),
value.isSpecified());
super.setAttribute(filterBypass, attributeName, newValue, element);
}
}
Best regards,
Alex

Re: validate of attributes from CSS

Posted: Tue Mar 18, 2014 5:17 am
by dvezina
Worked like a charm.
Thanks!

Re: validate of attributes from CSS

Posted: Fri Apr 11, 2014 2:42 pm
by ionela
Hello,

I just wanted to let you know that this problem has been resolved in the latest maintenance build of Oxygen 15.2, 2014040317 (released on April 8th):
Author/Form Controls: Entering XML reserved characters (&, <) in a form control that is editing the value of an attribute, would result in an invalid XML document
You can download it from our web site:
http://www.oxygenxml.com/download.html

The list of bug-fixes can be found here:
http://www.oxygenxml.com/build_history.html#2014040317

You can follow the release/build RSS feed here:
http://www.oxygenxml.com/rssBuildID.xml

Let us know if you encounter further problems with this new build.

Regards,
Ionela