Pennington— The Name in Software Engineering Automation

XTRAN Demonstration:  Analyze XML Entity References

XTRAN treats XML as a computer language, in which each "statement" is a tag, a line or segment of nonmarkup text, or an end tag.



* Rules:

The following is an English paraphrase of the XTRAN rules used for this example.  These rules comprise 91 (net) lines of XTRAN's rules language.

    For each XML "statement"
        If nonmarkup text line or segment
            For each entity reference in text
                Tally entity reference occurrence by name
                Record source file and line of this occurrence
    Sort entity names
    For each entity name seen, alphabetically
        Report entity name with tally
        For each occurrence of this entity name
            Report occurrence source file and line


* XML input:  sample.xml

<tag1><tag2/><tag3 att1="att1v" att2="att2v">
This is a line of text, &amp; is followed by a comment.<!-- comment 1 -->
This is the second line of text, &003; with no comment.
</tag3>
<!-- comment 2 -->
This is the third line of text, &amp; is preceded by a comment.
<tag3>Some text &003; in a "tag3".</tag3>
<tag4 attb="attbv1" atta/>
This is more nonmarkup &003; text.<tag4 attb="attbv2"/>
</tag1>


* Output:

Running the rules shown above on the XML input shown above generated the following XTRAN analysis output:

                           XML Entity Reference Usage

&003;  3
    sample.xml(3)
    sample.xml(7)
    sample.xml(9)
&amp;  2
    sample.xml(2)
    sample.xml(5)


COPYRIGHT 2012; reproduction prohibited without permission.  Revised 2009-09-11

XTRAN is a trademark of Pennington Systems Incorporated.

  Pennington Systems Incorporated
2820 N. Pinal Avenue, Suite 12
Casa Grande, Arizona 85122-7927
USA


  Phone:  +1(480)626-5503
Fax:  +1(480)626-7618
Email:  Info@Pennington.com
Web:  http://WWW.Pennington.com