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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to force the adding of an undeclared attribute

dgopois
13-Aquamarine

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

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.

dgopois
13-Aquamarine
(To:ClayHelberg)

Hi Clay,

 

Thank you again for your help.

Best regards

David

Announcements

Top Tags