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

How to force the adding of an undeclared attribute

SOLVED
Highlighted
Garnet

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

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to force the adding of an undeclared attribute

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
Highlighted

Re: How to force the adding of an undeclared attribute

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

Highlighted

Re: How to force the adding of an undeclared attribute

Hi Clay,

 

Thank you again for your help.

Best regards

David

Announcements