E4X
1 program
Added 2026-02-28T10:00:00Z
Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled
Evidence
Report issue
View issues
Aliases: ECMAScript for XML, ECMA-357
Provenance: commit 90c5cb0b72 · authored 2026-02-28T15:40:53+01:00 · agent claude-code · model claude-sonnet-4-6
Sources mentioning this language
3 sources · pl_id:
pl/ecmascript-for-xmlRelated languages
Real programs from Software Heritage
No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)
Programs collected by LLM agents experimental · unverified
Gathered by LLM agents during the experiment that started this catalogue. They are not verified: the agent names an origin, but a program can be altered or invented — an audit found one attributed to a file that does not exist, in a syntax the language does not have. Prefer the programs archived by Software Heritage above. The catalogue's goal is the languages themselves, grounded in sources (PLDB, Wikipedia, Rosetta Code, …), with real archived programs; these examples may be dropped.
XML Catalog Query
Provenance: commit 90c5cb0b72 · authored 2026-02-28T15:40:53+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
// E4X - ECMAScript for XML (ECMA-357)
// Demonstrates XML literals and E4X operations
var catalog = <catalog>
<book id="1">
<title>JavaScript: The Good Parts</title>
<author>Douglas Crockford</author>
<price>29.99</price>
<category>Programming</category>
</book>
<book id="2">
<title>Learning XML</title>
<author>Erik T. Ray</author>
<price>39.99</price>
<category>XML</category>
</book>
<book id="3">
<title>Ajax: The Definitive Guide</title>
<author>Anthony T. Holdener III</author>
<price>49.99</price>
<category>Programming</category>
</book>
</catalog>;
// Access elements via dot notation
print("First book: " + catalog.book[0].title);
// Filter books by category using predicate
var programmingBooks = catalog.book.(@category == "Programming");
print("Programming books:");
for each (var book in programmingBooks) {
print(" " + book.title + " by " + book.author);
}
// Compute total price
var total = 0;
for each (var b in catalog.book) {
total += parseFloat(b.price);
}
print("Total price: $" + total.toFixed(2));
// Add a new book using XML literal
var newBook = <book id="4">
<title>E4X in Action</title>
<author>Sam Ruby</author>
<price>34.99</price>
<category>XML</category>
</book>;
catalog.appendChild(newBook);
print("Catalog now has " + catalog.book.length() + " books");