Search code examples
xmlprogramming-languagesnative

Are there any programming languages that support xml natively?


If there are any then how deeply is xml integrated into language? What primitives are used to manipulate xml document?

PS. I'm not interested in declarative languages such as SQL, XPath, XSLT :)


Solution

  • Flash's ActionScript 3.0 and JavaScript (ECMAScript languages) are also integrated with XML by E4X.
    So code looks something like this (altough this is a simple example and cooler stuff is possible):

    var sales = <sales vendor="John">
        <item type="peas" price="4" quantity="6"/>
        <item type="carrot" price="3" quantity="10"/>
        <item type="chips" price="5" quantity="3"/>
      </sales>;
    
    alert( sales.item.(@type == "carrot").@quantity );
    alert( sales.@vendor );
    for each( var price in sales..@price ) {
      alert( price );
    }
    

    Here are Adobe's docs for working with XML in AS3.0.