Skip to content

Add XML output support for parse command with ZLF file parsing#28

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/add-parse-zlf-file-functionality
Draft

Add XML output support for parse command with ZLF file parsing#28
Copilot wants to merge 4 commits into
mainfrom
copilot/add-parse-zlf-file-functionality

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 29, 2026

The parse command previously only accepted hex strings and printed to console. It now accepts ZLF files as input and can output parsed frames as structured XML.

Changes

CLI interface

  • Added --output parameter for XML file path
  • Input parameter now accepts either hex strings or .zlf file paths
  • Console output preserved when --output is omitted (backward compatible)

New xml_output module

  • ParsedFrame: Stores structured field data (name, value, type) from parsed frames
  • XmlWriter: Serializes frames to XML with proper escaping and formatting
  • Each frame becomes a <frame> element with <field> sub-elements

ZwParser enhancements

  • Added parse_bytes(&[u8]) method returning ParsedFrame instead of void
  • Extracts header fields, command classes, and parameters into structured data
  • Uses slice references instead of owned vectors to avoid clones during batch processing

ZLF integration

  • Iterates through ZlfReader records and parses each frame's payload
  • Includes ZLF metadata (timestamp, RSSI, region) as additional fields in output

Example output

<?xml version="1.0" encoding="UTF-8"?>
<frames>
  <frame index="0">
    <field name="RawFrame" type="hex">4101020304</field>
    <field name="HeaderName" type="string">BASIC</field>
    <field name="HomeID" type="32 bits">41010203</field>
    <field name="SourceNodeID" type="8 bits">04</field>
  </frame>
</frames>

Usage

# Parse ZLF file to XML
zniff-rs parse --input capture.zlf --output frames.xml

# Parse hex string to XML
zniff-rs parse --input "4101020304" --output output.xml

# Original console behavior still works
zniff-rs parse --input "4101020304"

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 69/build.rs --cfg feature=&#34;use_std&#34; --check-cfg cfg(docsrs,test) (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

I need the parse CLI command to be able to take a ZLF file as input, parse it and parse the Z-Wave frames and then output the parsed frames as an XML file given as another CLI option.
Each frame must have its own element in the XML with sub elements containing each parsed field.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 29, 2026 20:28
Co-authored-by: Salmony <12485638+Salmony@users.noreply.github.com>
Co-authored-by: Salmony <12485638+Salmony@users.noreply.github.com>
…ntation

Co-authored-by: Salmony <12485638+Salmony@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CLI command to parse ZLF files and output XML Add XML output support for parse command with ZLF file parsing Jan 29, 2026
Copilot AI requested a review from Salmony January 29, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants