<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rodolfo M. Raya</title>
    <description>The latest articles on DEV Community by Rodolfo M. Raya (@rodolfo_mraya).</description>
    <link>https://dev.to/rodolfo_mraya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3988848%2F9120cdb7-9665-4035-bdcb-882d31d197a7.png</url>
      <title>DEV Community: Rodolfo M. Raya</title>
      <link>https://dev.to/rodolfo_mraya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rodolfo_mraya"/>
    <language>en</language>
    <item>
      <title>Closing the XML Gap in TypeScript (for Localization Workflows)</title>
      <dc:creator>Rodolfo M. Raya</dc:creator>
      <pubDate>Wed, 17 Jun 2026 10:39:21 +0000</pubDate>
      <link>https://dev.to/rodolfo_mraya/closing-the-xml-gap-in-typescript-for-localization-workflows-ghg</link>
      <guid>https://dev.to/rodolfo_mraya/closing-the-xml-gap-in-typescript-for-localization-workflows-ghg</guid>
      <description>&lt;p&gt;If you’ve ever tried to process XML in Node.js or TypeScript, you’ve probably run into a limitation: parsing is easy, but validation against DTD or XML Schema is not.&lt;/p&gt;

&lt;p&gt;That becomes a real problem when working with localization standards like TMX, XLIFF or SRX where structure and validity are not optional, they define whether your data is usable.&lt;/p&gt;

&lt;p&gt;This is the gap I ran into and eventually decided to close.&lt;/p&gt;

&lt;h2&gt;
  
  
  The old setup: Java for XML
&lt;/h2&gt;

&lt;p&gt;Localization standards such as TMX, XLIFF, SRX and TBX are all XML-based. When I started working with them more than 20 years ago, Java was the most practical choice. Its XML tooling wasn’t perfect, but it was reliable enough for parsing and validation.&lt;/p&gt;

&lt;p&gt;That worked well for a long time.&lt;/p&gt;

&lt;p&gt;The problem wasn’t XML; it was everything around it.&lt;/p&gt;

&lt;p&gt;Java desktop UI options didn’t evolve in a way that fit my needs. I used SWT for years, but it became less maintained, and alternatives like Swing or JavaFX didn’t appeal to me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Moving to TypeScript
&lt;/h2&gt;

&lt;p&gt;Around 2018, I shifted toward building user interfaces with HTML, CSS and JavaScript. Eventually, TypeScript became the obvious choice because it provides a safer development model with static checks.&lt;/p&gt;

&lt;p&gt;That solved the UI side.&lt;/p&gt;

&lt;p&gt;But it created a new problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;UI in TypeScript&lt;/li&gt;
&lt;li&gt;XML processing still in Java&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Maintaining two stacks for a single workflow wasn’t ideal.&lt;/p&gt;

&lt;h2&gt;
  
  
  The missing piece: XML validation in TypeScript
&lt;/h2&gt;

&lt;p&gt;At the time, there were XML parsers in JavaScript, but none supported:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DTD validation&lt;/li&gt;
&lt;li&gt;XML Schema validation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For localization formats, that’s a hard requirement. Without validation, you can’t guarantee that a TMX or XLIFF file is structurally correct.&lt;/p&gt;

&lt;p&gt;So, I started building &lt;a href="https://github.com/maxprograms-com/TypesXML" rel="noopener noreferrer"&gt;TypesXML&lt;/a&gt;, a native XML parser and validator for TypeScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  A minimal example
&lt;/h2&gt;

&lt;p&gt;Here’s what basic XML parsing looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;DOMBuilder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;SAXParser&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;typesxml&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DOMBuilder&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;parser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SAXParser&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setContentHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parseFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;example.xml&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getDocument&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same parser can be configured to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;validate against DTD&lt;/li&gt;
&lt;li&gt;validate against XML Schema&lt;/li&gt;
&lt;li&gt;resolve XML catalogs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes it possible to process XML in Node.js with the same level of control traditionally associated with Java libraries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building the missing stack
&lt;/h2&gt;

&lt;p&gt;Creating a full XML stack took time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DOM and SAX-style parsing came first&lt;/li&gt;
&lt;li&gt;DTD validation followed&lt;/li&gt;
&lt;li&gt;XML Schema validation was the final step&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;XML Schema support is significantly more complex, but it’s essential for formats like XLIFF.&lt;/p&gt;

&lt;h2&gt;
  
  
  Supporting pieces: language data
&lt;/h2&gt;

&lt;p&gt;Localization workflows also depend heavily on language codes.&lt;/p&gt;

&lt;p&gt;BCP47 defines the standard, but the official data is distributed as a large text file. To make it easier to use in TypeScript, I built &lt;a href="https://github.com/maxprograms-com/TypesBCP47" rel="noopener noreferrer"&gt;TypesBCP47&lt;/a&gt;, a companion library that parses that data and exposes it in a structured way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Proof of concept: rewriting existing tools
&lt;/h2&gt;

&lt;p&gt;To validate the approach, I rewrote existing tools in TypeScript:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/maxprograms-com/SRXEditor" rel="noopener noreferrer"&gt;SRXEditor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/maxprograms-com/TMXValidator" rel="noopener noreferrer"&gt;TMXValidator&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;process large XML files&lt;/li&gt;
&lt;li&gt;validate against official grammars&lt;/li&gt;
&lt;li&gt;maintain performance comparable to the original Java versions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That confirmed that TypeScript can handle real-world localization workloads.&lt;/p&gt;

&lt;h2&gt;
  
  
  XLIFF support
&lt;/h2&gt;

&lt;p&gt;XLIFF uses XML Schema, which required implementing a full schema validator.&lt;/p&gt;

&lt;p&gt;With that in place, I built &lt;a href="https://github.com/maxprograms-com/TypesXLIFF" rel="noopener noreferrer"&gt;TypesXLIFF&lt;/a&gt;, a library for parsing, generating, and validating XLIFF 2.x files.&lt;/p&gt;

&lt;p&gt;It supports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;XML Schema validation&lt;/li&gt;
&lt;li&gt;validation against the XLIFF specification&lt;/li&gt;
&lt;li&gt;a typed object model&lt;/li&gt;
&lt;li&gt;JSON conversion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this enables
&lt;/h2&gt;

&lt;p&gt;With these pieces in place, it’s now possible to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validate TMX, XLIFF, and SRX directly in Node.js&lt;/li&gt;
&lt;li&gt;Build localization pipelines entirely in TypeScript&lt;/li&gt;
&lt;li&gt;Remove the need for a separate Java backend&lt;/li&gt;
&lt;li&gt;Keep both UI and processing in the same language&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What’s next
&lt;/h2&gt;

&lt;p&gt;TBX support is in progress, along with updates to other tools to move them fully to TypeScript.&lt;/p&gt;

&lt;p&gt;Some Java code still exists in older components, but new development is now centered on TypeScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing thoughts
&lt;/h2&gt;

&lt;p&gt;For a long time, XML processing in localization workflows effectively required Java.&lt;/p&gt;

&lt;p&gt;That’s no longer the case.&lt;/p&gt;

&lt;p&gt;If you’re working with XML-based formats in Node.js, especially in localization or structured data pipelines, you can now handle parsing, validation, and processing entirely in TypeScript.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>xml</category>
      <category>opensource</category>
      <category>javascriptlibraries</category>
    </item>
  </channel>
</rss>
