Proposal: native XML object support.

Ed Saleh medozs at outlook.com
Mon May 20 07:38:49 UTC 2019


With strings and even E4X, you don't get the same experience that react supports. Things like property completion in XML mode, XML internal logic, etc.
________________________________
From: es-discuss <es-discuss-bounces at mozilla.org> on behalf of liorean <liorean at gmail.com>
Sent: Monday, May 20, 2019 3:03:04 AM
To: Jacob Bloom
Cc: ViliusCreator; es-discuss at mozilla.org
Subject: Re: Re: Proposal: native XML object support.

You could already do something like this:

     let
      RawXML=xml`<some-element some-attribute="${some_variable}">some content</some-element>`
     ,XMLApplication=rss`<rss version="2.0">
      <channel>
        <title>RSS Title</title>
        <description>This is an example of an RSS feed</description>
        <link>http://www.example.com/main.html</link>
        <lastBuildDate>Mon, 06 Sep 2010 00:01:00 +0000 </lastBuildDate>
        <pubDate>Sun, 06 Sep 2009 16:20:00 +0000</pubDate>
        <ttl>1800</ttl>
        <item>
          <title>Example entry</title>
          <description>Here is some text containing an interesting description.</description>
          <link>http://www.example.com/blog/post/1</link>
          <guid isPermaLink="false">7bd204c6-1655-4c27-aeee-53f933c5395f</guid>
           <pubDate>Sun, 06 Sep 2009 16:20:00 +0000</pubDate>
        </item>
      </channel>
    </rss> ` // rss example courtesy wikipedia


And all you'd need is an XML parser for EcmaScript tagged templates, or for a specific XML application such as RSS, an application specific handler which would probably be layered on top of such an XML parser. And XML is actually not that hard to parse, in difference to HTML, thanks to its draconic error handling. It's actually the XML application handlers that might get more involved.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190520/00292d80/attachment.html>


More information about the es-discuss mailing list