cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

How to force the adding of an undeclared attribute

dgopois
12-Amethyst

How to force the adding of an undeclared attribute

Hello,

With an ACL function, is it possible to force the adding an attribute (and its value) to an element although the attribute is not declared in the reference schema ?
My XML document will be not valid against the XSD Schema, but I would like to do it.

 

Kind regards

David

1 ACCEPTED SOLUTION

Accepted Solutions

You can do this by "cheating" using the AOM and Javascript:

javascript("Application.activeDocument.insertionPoint.startContainer.setAttribute("bogus","invalid")");

In this example, it will add bogus="invalid" to the current tag (where the caret is). If you have a specific OID instead of the node where the caret is, you can use something like this:

javascript("Acl.DOMOID('" . $myoid . "').setAttribute('bogus','invalid')");

Of course, you could also do it the conventional way, by turning off context rules before adding the undeclared attribute.

View solution in original post

2 REPLIES 2

You can do this by "cheating" using the AOM and Javascript:

javascript("Application.activeDocument.insertionPoint.startContainer.setAttribute("bogus","invalid")");

In this example, it will add bogus="invalid" to the current tag (where the caret is). If you have a specific OID instead of the node where the caret is, you can use something like this:

javascript("Acl.DOMOID('" . $myoid . "').setAttribute('bogus','invalid')");

Of course, you could also do it the conventional way, by turning off context rules before adding the undeclared attribute.

Hi Clay,

 

Thank you again for your help.

Best regards

David

Top Tags