XML Import for TEI XML Data into Flex 4

Intro

At NKU, our group has had two goals: (1) to go global, and (2) to build a 3D learning management system (LMS) in Flex. Two different data base systems are being developed for the LMS – a flat file and MYSQL. In both cases, complex XML structures are required. Not just the simple examples typically found on the web or Flex training tutorial sites. Sas Jacobs in his book on XML and E4X treats working with XML, Flash, and Flex in great detail.

In an upcoming seminar, we demonstrate such a complex data structure, the TEI database:

The Text Encoding Initiative (TEI) is a consortium which collectively develops and maintains a standard for the representation of texts in digital form. Its chief deliverable is a set of Guidelines which specify encoding methods for machine-readable texts, chiefly in the humanities, social sciences and linguistics.

The upcoming seminar is free to the public and its description is given below:

Creating a Data-Driven Website (March 24):
Using Roxanne Kent-Drury’s 3D English course website as an example, learn how to create a searchable Flex interface using PHP to interact with the interface and a MYSQL (open source) database. You’ll also learn about CRUD– how to store and change information in your database.

The code required to import this complex XML flat-file into Flex is shown below:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221;
layout=”absolute” creationComplete=”xmlService.send()”>
<mx:HTTPService id=”xmlService” url=”assets/yearsley1788P5.xml”
resultFormat=”e4x”/>
<mx:VBox x=”10″ y=”10″ height=”335″ width=”393″>

<mx:Label text=”Output” fontWeight=”bold”/>
<mx:TextArea id=”output_txt” width=”369″ height=”295″
text=”{xmlService.lastResult}”/>
</mx:VBox>
</mx:Application>

Source

To see a sample of the TEI XML file click the more button below:

TEI Sample

<?xml version=”1.0″ encoding=”UTF-8″?>
<?oxygen RNGSchema=”PA.rnc” type=”compact”?>
<TEI xmlns=”http://www.tei-c.org/ns/1.0″&gt;
<teiHeader>
<fileDesc>
<titleStmt>

<title type=”sub”>Written for my Son, and Spoken by him at
his first putting on Breeches
</title>

<author type=’writer’>Barber, Mary ( )</author>
<sponsor>Northern Kentucky University</sponsor>
<sponsor>Seventeenth- and Eighteenth-century Women Poets Flex/Demo Project</sponsor>
<respStmt>
<resp>General Editor, </resp>
<name xml:id=”RKD”>Roxanne Kent-Drury</name>
</respStmt>
<respStmt>
<resp>Editor</resp>
<name xml:id=”RKD”>Roxanne Kent-Drury</name>
</respStmt>
</titleStmt>
<editionStmt>
<edition>
<date>2009-00-00</date>
</edition>
</editionStmt>
<extent>TEI formatted filesize uncompressed: approx. TBS kbytes</extent>
<publicationStmt>
<idno>EL1755Li-MB-2P5</idno>
<publisher>Steely Library, Northern Kentucky University</publisher>
<pubPlace>Highland Heights, KY</pubPlace>
<date>2009-02-07</date>
<availability status=”restricted”>
<p> This file is intended for demonstration/development purposes only. Northern Kentucky University makes a claim of copyright only to original contributions made by the participants in this project and and
other members of the university community. Northern Kentucky University makes no claim of copyright to the original text. Permission is
granted to download, transmit or otherwise reproduce, distribute or display the contributions to this work claimed by Northern Kentucky
University for non-profit educational purposes, provided that this header is included in its entirety. This declaration
constitues the Creative Commons License <seg corresp=”http://creativecommons.org/licenses/by-nc-sa/3.0/”>Attribution
Non-commercial Share-alike</seg>. For inquiries about commercial uses, please contact:
<address>
<addrLine>Arne Almquist, Assoc Provost</addrLine>
<addrLine>Steely Library</addrLine>
<addrLine>Northern Kentucky University</addrLine>
<addrLine>Highland Heights, KY 41099</addrLine>
<addrLine>United States of America</addrLine>
<addrLine>EMail: almquista@nku.edu</addrLine> </address>
</p>
</availability>
</publicationStmt>

<seriesStmt TEIform=”seriesStmt”>
<title TEIform=”title”>Seventeenth- and Eighteenth-Century Women Poets/Flex Demo Project</title>
<respStmt TEIform=”respStmt”>
<name TEIform=”name”>Roxanne Kent-Drury,</name>
<resp TEIform=”resp”>General Editor.</resp>
</respStmt>
</seriesStmt>
<sourceDesc default=”NO” TEIform=”sourceDesc”>
<biblStruct default=”NO” TEIform=”biblStruct”>
<monogr TEIform=”monogr”>
<editor n=”1″ role=”editor” TEIform=”editor”>
<name reg=”Thornton, Bonnell” date=”1724-1768″ place=”UK” TEIform=”name”>Bonnell Thornton</name>
</editor>
<editor n=”2″ role=”editor” TEIform=”editor”>
<name reg=”Colman, George” date=”1732-1794″ place=”UK” TEIform=”name”>George Colman</name>
</editor>
<title level=”m” TEIform=”title”>Poems by Eminent Ladies </title>
<imprint TEIform=”imprint”>
<pubPlace TEIform=”pubPlace”>London, UK</pubPlace>
<publisher TEIform=”publisher”>R. Baldwin</publisher>
<date TEIform=”date”>17550000</date>
</imprint>
</monogr>
</biblStruct>
<p TEIform=”p”>Two other London editions were published in <xref doc=”thornton1773″ workcode=”thornton1755″ targOrder=”U” from=”ROOT” to=”DITTO” TEIform=”xref”>1773</xref> and 1780; <xref doc=”thornton1780″ targOrder=”U” from=”ROOT” to=”DITTO” TEIform=”xref”>the 1780 edition</xref> differs enough to be considered a new collection.</p>
</sourceDesc>

</fileDesc>
<encodingDesc>
<editorialDecl>
<p>This document follows the rules specified for TEI use by NINES.</p>
<p>All quotation marks and apostrophes have been transcribed as entity references.</p>
<p>Any dashes occurring in line breaks have been removed.</p>
<p>Because of web browser variability, all colons and hyphens have been typed on the U.S. keyboard; dashes have been rendered as two
hyphens.</p>
<p>Page numbers appear at the beginning of each page, no matter where originally placed.</p>
</editorialDecl>
<tagsDecl>
<rendition xml:id=”indent1″>Indented 5 spaces from margin in original</rendition>
<rendition xml:id=”indent2″>Indented 10 space from marin in original</rendition>
<rendition xml:id=”italic”>Italicized</rendition>
<rendition xml:id=”alignr”>Aligned right</rendition>
</tagsDecl>
<classDecl>
<taxonomy xml:id=”ps”>
<bibl>Primary or Secondary</bibl>
<category xml:id=”ps1″>
<catDesc>primary</catDesc>
</category>
<category xml:id=”ps2″>
<catDesc>secondary</catDesc>
</category>
</taxonomy>

<taxonomy xml:id=”g”>
<bibl>Genre and Material Form</bibl>
<category xml:id=”g1″>
<catDesc>pageimage</catDesc>
</category>
<category xml:id=”g2″>
<catDesc>biography</catDesc>
</category>
<category xml:id=”g3″>
<catDesc>biographical essay</catDesc>
</category>
<category xml:id=”g4″>
<catDesc>poetry pamphlet</catDesc>
</category>
<category xml:id=”g5″>
<catDesc>poetry book</catDesc>
</category>
<category xml:id=”g6″>
<catDesc>poem</catDesc>
</category>
<category xml:id=”g7″>
<catDesc>story</catDesc>
</category>
<category xml:id=”g8″>
<catDesc>drama</catDesc>
</category>
<category xml:id=”g9″>
<catDesc>table of contents</catDesc>
</category>
<category xml:id=”g10″>
<catDesc>table of illustrations</catDesc>
</category>
<category xml:id=”g11″>
<catDesc>picture</catDesc>
</category>
<category xml:id=”g12″>
<catDesc>index</catDesc>
</category>
<category xml:id=”g13″>
<catDesc>notes</catDesc>
</category>
<category xml:id=”g14″>
<catDesc>frontispiece</catDesc>
</category>
<category xml:id=”g15″>
<catDesc>inscription page</catDesc>
</category>
<category xml:id=”g16″>
<catDesc>book boards</catDesc>
</category>
<category xml:id=”g17″>
<catDesc>titlepage</catDesc>
</category>
<category xml:id=”g18″>
<catDesc>preface</catDesc>
</category>
<category xml:id=”g19″>
<catDesc>advertisement</catDesc>
</category>
<category xml:id=”g20″>
<catDesc>foreword</catDesc>
</category>
<category xml:id=”g21″>
<catDesc>acknowledgments</catDesc>
</category>
<category xml:id=”g22″>
<catDesc>collection literary annual</catDesc>
</category>
<category xml:id=”g23″>
<catDesc>collection miscellany</catDesc>
</category>
<category xml:id=”g24″>
<catDesc>collection anthology</catDesc>
</category>
<category xml:id=”g25″>
<catDesc>collection beauties</catDesc>
</category>
<category xml:id=”g26″>
<catDesc>collection juvenile</catDesc>
</category>
<category xml:id=”g27″>
<catDesc>collection religious</catDesc>
</category>
<category xml:id=”g28″>
<catDesc>collection travels</catDesc>
</category>
<category xml:id=”g29″>
<catDesc>mixed</catDesc>
</category>
<category xml:id=”g30″>
<catDesc>essay</catDesc>
</category>
<category xml:id=”g31″>
<catDesc>review</catDesc>
</category>
<category xml:id=”g32″>
<catDesc>letter</catDesc>
</category>
<category xml:id=”g33″>
<catDesc>fragment poem</catDesc>
</category>
<category xml:id=”g34″>
<catDesc>fragment story</catDesc>
</category>
<category xml:id=”g35″>
<catDesc>fragment novel</catDesc>
</category>
<category xml:id=”g36″>
<catDesc>literary criticism book</catDesc>
</category>
<category xml:id=”g37″>
<catDesc>literary criticism collection</catDesc>
</category>
<category xml:id=”g38″>
<catDesc>bibliography</catDesc>
</category>
<category xml:id=”g39″>
<catDesc>engraving</catDesc>
</category>
<category xml:id=”g40″>
<catDesc>reproduction</catDesc>
</category>
<category xml:id=”g41″>
<catDesc>figure</catDesc>
</category>
<category xml:id=”g42″>
<catDesc>graph</catDesc>
</category>
<category xml:id=”g43″>
<catDesc>map</catDesc>
</category>
<category xml:id=”g44″>
<catDesc>table</catDesc>
</category>
<category xml:id=”g45″>
<catDesc>musical score</catDesc>
</category>
<category xml:id=”g46″>
<catDesc>music</catDesc>
</category>
<category xml:id=”g47″>
<catDesc>satire</catDesc>
</category>
<category xml:id=”g48″>
<catDesc>political pamphlet</catDesc>
</category>
<category xml:id=”g49″>
<catDesc>political cartoon</catDesc>
</category>
<category xml:id=”g50″>
<catDesc>periodical</catDesc>
</category>
<category xml:id=”g51″>
<catDesc>historical monograph</catDesc>
</category>
<category xml:id=”g52″>
<catDesc>historical essay</catDesc>
</category>
<category xml:id=”g53″>
<catDesc>philosophical treatise</catDesc>
</category>
<category xml:id=”g54″>
<catDesc>philosophical essay</catDesc>
</category>
<category xml:id=”g55″>
<catDesc>religious pamphlet</catDesc>
</category>
<category xml:id=”g56″>
<catDesc>sermon</catDesc>
</category>
<category xml:id=”g57″>
<catDesc>theology</catDesc>
</category>
<category xml:id=”g58″>
<catDesc>religious book</catDesc>
</category>
<category xml:id=”g59″>
<catDesc>essay on education</catDesc>
</category>
<category xml:id=”g60″>
<catDesc>educational treatise</catDesc>
</category>
<category xml:id=”g61″>
<catDesc>list of subscribers</catDesc>
</category>
<category xml:id=”g62″>
<catDesc>allegory</catDesc>
</category>
<category xml:id=”g63″>
<catDesc>introduction</catDesc>
</category>
<category xml:id=”g64″>
<catDesc>slipcase</catDesc>
</category>
<category xml:id=”g65″>
<catDesc>dedication</catDesc>
</category>
<category xml:id=”g66″>
<catDesc>picture of building</catDesc>
</category>
<category xml:id=”g67″>
<catDesc>floorplans</catDesc>
</category>
<category xml:id=”g68″>
<catDesc>photograph</catDesc>
</category>
<category xml:id=”g69″>
<catDesc>translation</catDesc>
</category>
<category xml:id=”g70″>
<catDesc>manuscript</catDesc>
</category>
<category xml:id=”g71″>
<catDesc>novel</catDesc>
</category>
<category xml:id=”g72″>
<catDesc>travel essay</catDesc>
</category>
</taxonomy>

<taxonomy xml:id=”keyword”>
<category xml:id=”lcsh”>
<catDesc>Library of Congress Subject Headings, reduced to one word before hyphen</catDesc>
</category>
</taxonomy>

<taxonomy>
<category xml:id=”BL”>
<catDesc>British Library Shelf Mark</catDesc>
</category>
</taxonomy>
</classDecl>
</encodingDesc>
<profileDesc>
<textClass>
<keywords scheme=”#lcsh”>
<list type=”simple”>
<item>family</item>
<item>child</item>
<item>mother</item>
</list>
</keywords>

<catRef target=”#ps1″ scheme=”#ps”/>
<catRef target=”#g6″ scheme=”#g”/>
</textClass>
</profileDesc>
<revisionDesc>

<change n=”1″ when=”20090207″ who=”#RKD”>
<label>Changed by</label>
<name xml:id=”RKD”>Roxanne Kent-Drury</name>
<list>
<item>XML coding; XSL application: Oxygen</item>
</list>
</change>
</revisionDesc>
</teiHeader>
<text>

<body>
<div type=”title”>
<pb n=”10″/>
<head>
<bibl>
<title xml:id=”anchor1″>Written for my Son, and Spoken by him at
his first putting on Breeches.</title>
</bibl>

</head>

</div>
<div type=”poem”>
<lg type=”stanza”>

<l rend=”indent1″>What is it our mamma&apos;s bewitches,</l>
<l rend=”indent1″>To plague us little boys with breeches?</l>
<l rend=”indent1″>To tyrant Custom we must yield,</l>
<l rend=”indent1″>Whilst vanquish&apos;d Reason flies the field.</l>
<l rend=”indent1″>Our legs must suffer by ligation,</l>
<l rend=”indent1″>To keep the blood from circulation;</l>

<pb n=”11″/>

<l rend=”indent1″>And then our feet, tho&apos; young and tender,</l>
<l rend=”indent1″>We to the shoemaker&apos;s surrender;</l>
<l rend=”indent1″>Who often makes our shoes so strait,</l>
<l rend=”indent1″>Our growing feet they cramp and fret;</l>
<l rend=”indent1″>Whilst, with contrivance most profound,</l>
<l rend=”indent1″>Across our insteps we are bound;</l>
<l rend=”indent1″>Which is the cause, I make no doubt,</l>
<l rend=”indent1″>Why thousands suffer in the gout.</l>
<l rend=”indent1″>Our wiser ancestors wore brogues,</l>
<l rend=”indent1″>Before the surgeons brib&apos;d thee rogues,</l>
<l rend=”indent1″>With narrow toes, and heels like pegs,</l>
<l rend=”indent1″>To help to make us break our legs.</l>
<l rend=”indent1″>Then, ere we know to use our fists,</l>
<l rend=”indent1″>Our mother&apos;s closely bind our wrists;</l>
<l rend=”indent1″>And never think our cloaths are neat,</l>
<l rend=”indent1″>Till they&apos;re so tight we cannot eat.</l>
<l rend=”indent1″>And, to increase our other pains,</l>
<l rend=”indent1″>The hatband helps to cramp our brains.</l>
<l rend=”indent1″>The cravat finishes the work,</l>
<l rend=”indent1″>Like bowstring sent from the Grand Turk.</l>
<l rend=”indent1″>Thus dress, that should prolong our date,</l>
<l rend=”indent1″>Is made to hasten on our fate.</l>
<l rend=”indent1″>Fair privilege of nobler natures,</l>
<l rend=”indent1″>To be more plagu&apos;d than other creatures!</l>
<l rend=”indent1″>The wild inhabitants of air</l>
<l rend=”indent1″>Are cloath&apos;d by heav&apos;n with wondrous care:</l>
<l rend=”indent1″>Their beauteous, well-compacted feathers</l>
<l rend=”indent1″>Are coats of mail against all weathers;</l>
<l rend=”indent1″>Enamell&apos;d, to delight the eye;</l>
<l rend=”indent1″>Gay as the bow that decks the sky,</l>

<pb n=”12″/>

<l rend=”indent1″>The beasts are cloath&apos;d with beauteous skins:</l>
<l rend=”indent1″>The fishes arm&apos;d with scales and fins;</l>
<l rend=”indent1″>Whose lustre lends the sailor light,</l>
<l rend=”indent1″>When all the stars are hid in night</l>
<l rend=”indent1″>O were our dress contriv&apos;d like these,</l>
<l rend=”indent1″>For use, for ornament, and ease!</l>
<l rend=”indent1″>Man only seems to sorrow born,</l>
<l rend=”indent1″>Naked, defenceless, and forlorn.</l>
<l rend=”indent1″>Yet we have Reason to supply</l>
<l rend=”indent1″>What nature did to man deny:</l>
<l rend=”indent1″>Weak Viceroy! Who thy pow&apos;r will own,</l>
<l rend=”indent1″>When Custom has usurp&apos;d thy throne?</l>
<l rend=”indent1″>In vain did I appeal to thee,</l>
<l rend=”indent1″>Ere I would wear his livery;</l>
<l rend=”indent1″>Who, in defiance to thy rules,</l>
<l rend=”indent1″>Delights to make us act like fools.</l>
<l rend=”indent1″>O’er human race the tyrant reighs,</l>
<l rend=”indent1″>And binds them in eternal chains.</l>
<l rend=”indent1″>We yield to his despotic sway,</l>
<l rend=”indent1″>The only monarch all obey.</l>

</lg>

</div>
</body>
</text>
</TEI>

3 Responses to XML Import for TEI XML Data into Flex 4

  1. […] system. And learning management, in any dimension, means distributing and collecting data. TEI is a very good “first example” of a non-trivial XML file. In future posts, we’ll use it to […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: