Bin erst heute über den Blog von Peter Hall darüber gestoplert:
http://www.markme.com/mchotin/archives/005614.cfm http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-357.pdf
...
10.1.1 ToString Applied to the XML Type _____________________________________________________________
<order> <customer> <firstname>John</firstname> <lastname>Doe</lastname> </customer> <item> <description>Big Screen Television</description> <price>1299.99</price> <quantity>1</quantity> </item> </order>
_____________________________________________________________
"the E4X programmer can access individual values of the XML value like this:" _____________________________________________________________
// Construct the full customer name var name = order.customer.firstname + " " + order.customer.lastname; // Calculate the total price var total = order.item.price * order.item.quantity;
_____________________________________________________________
...
11.1.4 XML Initialiser _____________________________________________________________
// an XML object representing a person with a name and age var person = <person><name>John</name><age>25</age></person>; // a variable containing an XML object representing two employees var e = <employees> <employee id="1"><name>Joe</name><age>20</age></employee> <employee id="2"><name>Sue</name><age>30</age></employee> </employees>;
for (var i = 0; i < 10; i++) e[i] = <employee id={i}> // compute id value <name>{names[i].toUpperCase()}</name> // compute name value <age>{ages[i]}</age> // compute age value </employee>;
______________________________________________________________
...
11.1.5 XMLList Initialiser _______________________________________________________________
var docfrag = <><name>Phil</name><age>35</age><hobby>skiing</hobby></>; var emplist = <> <employee id="0" ><name>Jim</name><age>25</age></employee> <employee id="1" ><name>Joe</name><age>20</age></employee> <employee id="2" ><name>Sue</name><age>30</age></employee> </>;
______________________________________________________________
...
11.2.1 Property Accessors ______________________________________________________________
// get the first (and only) order [treating single element as a list] var firstOrder = order[0]; _____________________________________________________________
...
11.2.3 XML Descendant Accessor ______________________________________________________________
var e = <employees> <employee id="1"><name>Joe</name><age>20</age></employee> <employee id="2"><name>Sue</name><age>30</age></employee> </employees>;
var names = e..name; // get all the names in e
______________________________________________________________
...
11.2.4 XML Filtering Predicate Operator ______________________________________________________________
_______________________________________________________________
...
12.1 The default xml namespace Statement _______________________________________________________________
// declare some namespaces and a default namespace for the current scope var soap = new Namespace("http://schemas.xmlsoap.org/soap/envelope/";); var stock = new Namespace("http://mycompany.com/stocks";); default xml namespace = soap; // alternately, may specify full URI
// Create an XML initializer in the default (i.e., soap) namespace var message = <Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";> <Body> <m:GetLastTradePrice xmlns:m="http://mycompany.com/stocks";> <symbol>DIS</symbol> </m:GetLastTradePrice> </Body> </Envelope>
______________________________________________________________________________
ralf ...
------------------------------------------------------------- Ralf Siegel - Freelance Developer Recommended Listening: Blonde Redhead - Misery Is A Butterfly http://www.blonde-redhead.com -------------------------------------------------------------
------------------------------------------------------ Archiv : //www.freelists.org/archives/ascoders/ Optionen : //www.freelists.org/list/ascoders ------------------------------------------------------