google / zx

A tool for writing better scripts

Home Page:https://npmjs.com/package/zx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature request] Add xml and html parser package

blikblum opened this issue · comments

Expected Behavior

Provides a package to parse XML and HTML

Actual Behavior

There's no way to parse XML and HTML, as it exists to YAML

Steps to Reproduce the Problem

  1. fetch or read from fs html or xml file
  2. try to parse its content

Use case

Rom management tools like https://www.romvault.com/ export a list of missing roms as xml.

To download the missing roms currently i extract the rom titles using PowerShell command:

[xml]$games = Get-Content '.\fix_MAME226.xml'

$games.datafile.game

Than i feed wget to download the needed files

Having ability to parse xml would make this use case straight forward with zx (and any other use that involves reading xml or html, like simple web page crawler)

Package candidates

https://github.com/fb55/htmlparser2

This is pretty flexible (has a sax and a in memory object tree interfaces) with non opinionated API. Provides DomUtils which is pretty hand to extracting data https://domutils.js.org/modules.html

https://www.npmjs.com/package/fast-xml-parser

Claims to be fast. Downside IMO it has a opinionated interface

Specifications

  • Version: 6.1
  • Platform: any

I don’t think this should be in zx library. As npm libs really easy to install, or npx cmd. So let’s not bloat zx more.

ezoic increase your site revenue