Adobe 0046100128056 Scripting Guide - Page 204
Scripting the XML-rules Processor Object
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 204 highlights
CHAPTER 13: XML Rules Scripting the XML-rules Processor Object 204 function ProcessPrice(){ this.name = "ProcessPrice"; this.xpath = "//device[@type = 'VCO']/price"; this.apply = function(myElement, myRuleProcessor){ with(myElement){ __skipChildren(myRuleProcessor); var myNewElement = myContainerElement.xmlElements.item(-1) .xmlElements.add(app.documents.item(0).xmlTags.item("Column")); var myElement = myElement.move(LocationOptions.atBeginning, myNewElement); myElement.insertTextAsContent("$", XMLElementPosition.beforeElement); } return true; } } } Once all of the specified XML elements have been "wrapped," we can convert the container element to a table. var myTable = myContainerElement.convertElementToTable(myRowTag, myColumnTag); Scripting the XML-rules Processor Object While we have provided a set of utility functions in glue code.jsx, you also can script the XML-rules processor object directly. You might want do this to develop your own support routines for XML rules or to use the XML-rules processor in other ways. When you script XML elements outside the context of XML rules, you cannot locate elements using XPath. You can, however, create an XML rule that does nothing more than return matching XML elements, and apply the rule using an XML-rules processor, as shown in the following script. (This script uses the same XML data file as the sample scripts in previous sections.) For the complete script, see XMLRulesProcessor.