Adobe 0046100128056 Scripting Guide - Page 185
XML Rules Examples, Setting up a sample document
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 185 highlights
CHAPTER 13: XML Rules XML Rules Examples 185 XML rules script XML rule XPath condition apply() XML rules XML element glue code __processRuleSet XPath condition XML element XML rule processor XPath evaluation __processChildren XML element XML structure iteration __skipChildren XML Rules Examples Because XML rules rely on XPath statements to find qualifying XML elements, XML rules are closely tied to the structure of the XML in a document. This means it is almost impossible to demonstrate a functional XML-rules script without having an XML structure to test it against. In the remainder of this chapter, we present a series of XML-rules exercises based on a sample XML data file. For our example, we use the product list of an imaginary integrated-circuit manufacturer. Each record in the XML data file has the following structure: The scripts are presented in order of complexity, starting with a very simple script and building toward more complex operations. Setting up a sample document Before you run each script in this chapter, import the XMLRulesExampleData.xml data file into a document. When you import the XML, turn on the Do Not Import Contents of Whitespace-Only Elements option in the XML Import Options dialog box. Save the file, then choose File > Revert before running each sample script in this section. Alternately, run the following script before you run each sample XML-rule script (see the XMLRulesExampleSetup.jsx script file):