Some USoft Blend directives are designed to contain and return a subsystem of XML elements referred to as embedded XML.
Embedded XML is a specialised use of XML. It is specific to the USoft Blend framework. In each case, embedded XML has the structure of an XML document: it contains a single top-level node (the document node).
Example
This example shows XML embedded in a pc:Dialog element.
<pc:Dialog>
<Form w="250">
<Title>USoft Blend dialog</Title>
<Label dx="5" dy="10" w="40" >This is a USoft Blend dialog.</Label>
<Button dy="20" newline="true"><Result>OK</Result>OK</Button>
</Form>
</pc:Dialog>
|
In some cases you can pass embedded XML as part of your script. The example of this help topic shows that in pc:Dialog, you can pass embedded XML to specify the visual aspects and the behaviour of the dialog.
|
Some directives return embedded XML as an output value. For example, pc:Directory returns embedded XML that describes the files and folders of a directory:
<Directory dirpath="c:\temp\" dirname="temp"
lastwrite="2019/0109100614">
<Directory dirpath="c:\temp\mydir2" dirname="mydir2"
lastwrite="2019/0109100620">
<File filepath="c:\temp\mydir2\myfile3.txt" filename="myfile3.xml"
lastwrite="2019/0109093257" />
<File filepath="c:\temp\mydir2\myfile4.txt" filename="myfile4.txt"
lastwrite="2019/0109100021" />
</Directory>
<File filepath="c:\temp\myfile1.xml" filename="myfile1.xml"
lastwrite="2019/0109093257" />
</Directory>
|
|
To change the embedded XML that you get as output, use the special pc:return attribute on the directive. Values of pc:return take the root node of the embedded XML as the root node (for absolute location path values) and as the context node (for relative location path values), so that the two following location paths return the same result:
<pc:Directory filepath="c:\temp" pc:return="/Directory/File" />
|
<pc:Directory filepath="c:\temp" pc:return="Directory/File" />
|
|
To refer, later in your Blend script, to information in the embedded XML that you get as output, use an assign:variable attribute on the directive.
The following example selects the /Directory/File nodes from the embedded XML returned by pc:Directory. You can refer to these nodes later in your script by writing $myfiles. Values of assign:variable take the root node of the embedded XML as the root node (for absolute location path values) and as the context node (for relative location path values), so that the following 2 location paths return the same result:
<pc:Directory filepath="c:\temp" assign:myfiles="/Directory/File" />
|
<pc:Directory filepath="c:\temp" assign:myfiles="Directory/File" />
|
|
USoft Blend automatically suppresses the output of embedded XML if you use a pc:return or assign:variable attribute on the directive. This behaviour is based on the idea that if you have a reason to use pc:return or assign:variable, then you are unlikely to be interested in seeing the standard return XML as well.
As a result, if you simply want to suppress the return XML altogether, you can write one of the following.
<pc:Directory filepath="c:\temp" pc:return="" />
|
<pc:Directory filepath="c:\temp" assign:myfiles="" />
|
|
You can read, configure, and edit embedded XML programmatically, for example, in a <pc:defs> section of your script. You can then mobilise it when you need it, for example, to produce a certain type of dialog with <pc:Dialog>. If you work in this way, embedded XML has the role of a variable set.
|
See also
Guide to expressions and data types
Literal expressions
Dates
string literals
Path expressions
XML expressions
Embedded XML
XPath expressions
Node set expressions
Booleans
Strings
Numbers
Function calls
Variable references
Implicit XPath datatype conversion
Evaluated expressions vs. literals
SQL expressions
|