9

What are all the programming languages that support XML literals natively or via extension? I know of VB.NET, Scala, and Factor. Any others?

missingfaktor
  • 90,905
  • 62
  • 285
  • 365
  • 1
    It seems a little odd to count languages where somebody had to write an extension to the compiler in C++, but not count languages which were flexible enough that someone could write an extension to the language in itself. – Ken Oct 12 '10 at 16:12
  • @Ken: +1, good point. Added Factor to the list. Thanks. – missingfaktor Oct 12 '10 at 16:22
  • I don't know of a library that does it, but Common Lisp supports reader macros, which enables you to define your own syntax. – Ken Oct 13 '10 at 14:12

5 Answers5

7

ECMAscript.

Ken
  • 1,159
  • 1
  • 9
  • 13
5

XSLT comes to mind. And yes, it is a programming language.

Fred Foo
  • 355,277
  • 75
  • 744
  • 836
5

Racket provides support for XML literals via XML Boxes. It also provides a very convenient S-expression based syntax for literal XML called X-expressions.

Sam Tobin-Hochstadt
  • 4,983
  • 1
  • 21
  • 43
4

Facebook published a PHP Extension that allows XML document fragments to be embedded in PHP code.

From the documentation page linked to above:

XHP is a PHP extension which augments the syntax of the language such that XML document fragments become valid PHP expressions. This allows you to use PHP as a stricter templating engine and offers much more straightforward implementation of reusable components.

Dominic Barnes
  • 28,083
  • 8
  • 65
  • 90
2

Perl? I've never used it, but XML::Literal looks like a way to do XML literals in Perl.

Ken
  • 1,159
  • 1
  • 9
  • 13