Example 2 |
Top Previous Next |
In this example, we've configured the filter to scan through an XML file for the text 'Technical' or 'Network' in the <AlertType> tag. It will then temporarily store the information from the <Incident> and <Description> tags in the Temp variable. This collected data is then being passed to a statically named group in PageGate: techsupervisors.
Note: Lines prefaced with # are comment lines for description purposes. The filter ignore any lines that begin with #
<InputFile> <Name> Parameter </Name> <Delete> True </Delete> </InputFile>
<Debug> False </Debug>
<OutputFile> <Name> c:\PageGateData\ASCII\%InputFileNameBase%.asc </Name> </OutputFile>
# This section of the Filters tells the script to look for # any lines that have<AlertType>Technical</AlertType> and # set the Flag variable to True if it is found <Filter> <Search> <Section> All </Section> <Type> Literal </Type> <Text> <AlertType>Technical</AlertType> </Text> </Search> <Replace> <Section> Flag </Section> <Scope> Section </Scope> <Type> Or </Type> <Text> True </Text> </Replace> </Filter>
# This section of the Filters tells the script to look for any # lines that have the<AlertType>Network</AlertType> and # set the Flag variable to True if it is found <Filter> <Search> <Section> All </Section> <Type> Literal </Type> <Text> <AlertType>Network</AlertType> </Text> </Search> <Replace> <Section> Flag </Section> <Scope> Section </Scope> <Type> Or </Type> <Text> True </Text> </Replace> </Filter>
# This Filter section tells the script to abort if no instances of # the two search strings can be found: <Filter> <Search> <Section> Flag </Section> <Type> Literal </Type> <Text> False </Text> </Search> <Replace> <Section> Flag </Section> <Scope> Section </Scope> <Type> And </Type> <Text> False </Text> </Replace> <Continue> False </Continue> </Filter>
# This section of the filter tells the script to grab data # contained in the <Incident> tag.
<Filter> <Search> <Section> All </Section> <Type> Literal </Type> <Text> <Incident>*</Incident> </Text> </Search> <Replace> <Section> Temp </Section> <Scope> Section </Scope> <Type> Literal </Type> <Text> %Match% </Text> </Replace> </Filter>
# This section of the filter tells the script to grab data from # the <Description> tag
<Filter> <Search> <Section> All </Section> <Type> Literal </Type> <Text> <Description>*</Description> </Text> </Search> <Replace> <Section> Temp </Section> <Scope> Section </Scope> <Type> Literal </Type> <Text> %Temp% %Match% </Text> </Replace> </Filter>
# This section of the filter removes the tag # <Incident> from the message. <Filter> <Search> <Section> Temp </Section> <Type> Literal </Type> <Text> <Incident> </Text> </Search> <Replace> <Section> Temp </Section> <Scope> Match </Scope> <Type> Literal </Type> <Text>
</Text> </Replace> </Filter>
# This section of the filter removes the tag # </Incident> from the message.
<Filter> <Search> <Section> Temp </Section> <Type> Literal </Type> <Text> </Incident> </Text> </Search> <Replace> <Section> Temp </Section> <Scope> Match </Scope> <Type> Literal </Type> <Text>
</Text> </Replace> </Filter>
# This section of the filter removes the tag # <Description> from the message.
<Filter> <Search> <Section> Temp </Section> <Type> Literal </Type> <Text> <Description> </Text> </Search> <Replace> <Section> Temp </Section> <Scope> Match </Scope> <Type> Literal </Type> <Text>
</Text> </Replace> </Filter>
# This section of the filter removes the tag # </Description> from the message.
<Filter> <Search> <Section> Temp </Section> <Type> Literal </Type> <Text> <Incident> </Text> </Search> <Replace> <Section> Temp </Section> <Scope> Match </Scope> <Type> Literal </Type> <Text>
</Text> </Replace> </Filter>
# This Filter tells the script to output the file in the standard # PageGate GetASCII file format for direct processing:
<Filter> <Search> <Section> Flag </Section> <Type> Literal </Type> <Text> True </Text> </Search> <Replace> <Section> All </Section> <Scope> Section </Scope> <Type> Literal </Type> <Text> TechSupervisors\013\010CAD\013\010%Temp% </Text> </Replace> </Filter>
|