Syntax | (xmlGetText xml index) → xml |
---|---|
Arguments | xml: The XML element to get the text data from |
index: The 0-based index of the text to get | |
Returns | The block of text at the specified index in xml |
Category | XML |
Description | “Text” refers to whatever is not part of the XML tags or subelements. This includes the TLisp code contained inside Event elements. Indexes are separated by subelements |
Consider the following XML data:
<Type UNID="&unidHugoSandoval;"> <StaticData> <Data id="MissionAttribute">"hugoSandovalMission"</Data> <Data id="Name">"Hugo Sandoval"</Data> <Data id="Sovereign">&svCommonwealth;</Data> </StaticData> <Events> <OnCharacterCanBeMet> True </OnCharacterCanBeMet> <OnGlobalSystemStopped> (rpgCharacterAscend &unidHugoSandoval;) </OnGlobalSystemStopped> </Events> </Type>
Now consider the following code:
(block (theXML theXMLText0 theXMLText1 theXMLText2 theStaticData theDataText0 theDataText1 theDataText2) (setq theXML (typGetXML &unidHugoSandoval;)) (setq theXMLText0 (xmlGetText theXML 0)) (setq theXMLText1 (xmlGetText theXML 1)) (setq theXMLText2 (xmlGetText theXML 2)) (setq theStaticData (xmlGetSubElement theXML 'StaticData)) (setq theDataText0 (xmlGetText (xmlGetSubElement theStaticData 0) 0)) (setq theDataText1 (xmlGetText (xmlGetSubElement theStaticData 1) 0)) (setq theDataText2 (xmlGetText (xmlGetSubElement theStaticData 2) 0)) )
Return to XML Functions list
Return to Functions list