validate of attributes from CSS

Oxygen general issues.
dvezina
Posts: 23
Joined: Sat Mar 08, 2014 12:10 am

validate of attributes from CSS

Post 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
alex_jitianu
Posts: 1009
Joined: Wed Nov 16, 2005 11:11 am

Re: validate of attributes from CSS

Post 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
dvezina
Posts: 23
Joined: Sat Mar 08, 2014 12:10 am

Re: validate of attributes from CSS

Post by dvezina »

Worked like a charm.
Thanks!
ionela
Posts: 402
Joined: Mon Dec 05, 2011 6:08 pm

Re: validate of attributes from CSS

Post 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
Ionela Istodor
oXygen XML Editor and Author Support
Post Reply