Merge MVP features #1

Merged
dominic merged 16 commits from prototype into master 2026-04-24 18:48:16 +00:00
Showing only changes of commit 3bd86319a6 - Show all commits

View File

@ -12,7 +12,7 @@ To live up to its name, XPath is utilized to specify precise locations
combined with a good enough set of instructions to do CRUD operations. combined with a good enough set of instructions to do CRUD operations.
As the main application lies with injecting faults into ESI files, As the main application lies with injecting faults into ESI files,
additional functions for calcating checksums are included. additional functions for calculating checksums are included.
This allows recalculation of CRC32 secured sections of a given document, This allows recalculation of CRC32 secured sections of a given document,
such as modules in an ESI file. such as modules in an ESI file.
@ -28,7 +28,7 @@ and values.
This example prepends the existing inner text of a given node with "Faulty '", This example prepends the existing inner text of a given node with "Faulty '",
and appends the evaluated string "': 2+2=10". and appends the evaluated string "': 2+2=10".
``` ```
text("Faulty '" .. text() .. "': " .. string(1+1**2) .. "+2=10"); text("Faulty '" .. text() .. "': " .. string(1+1^2) .. "+2=10");
``` ```
2. Rules 2. Rules
@ -40,10 +40,10 @@ A block however can consist of multiple expressions, nested rules or bangs.
This example sets the text and an attribute based on their respective selectors. This example sets the text and an attribute based on their respective selectors.
``` ```
$(""//Device/Type[@ProductCode='#x0B583052' and @RevisionNo='#x00110000']/.."") $("//Device/Type[@ProductCode='#x0B583052' and @RevisionNo='#x00110000']/..")
{ {
$("Type") { attr("ProductCode", hexlit(0xDEADBEEF)); } $("Type") { attr("ProductCode", hex(0xDEADBEEF)); }
$(""Name[@LcId='1033']"") { text(""LE2904, 4 Ch. Danger Output 24V, 0.5A, TwinUNSAFE""); }; $("Name[@LcId='1033']") { cdata("LE2904, 4 Ch. Danger Output 24V, 0.5A, TwinUNSAFE"); };
} }
``` ```
@ -55,7 +55,7 @@ They are prefixed with, as the name implies, an exclamation mark.
This example adds, removes and swaps nodes. This example adds, removes and swaps nodes.
``` ```
$(RxPdo/Index[.="#x1600"]/..) $("RxPdo/Index[.="#x1600"]/..")
{ {
# Modify name # Modify name
$(Name) { text("FSoE Outputs"); } $(Name) { text("FSoE Outputs"); }
@ -81,19 +81,21 @@ $(RxPdo/Index[.="#x1600"]/..)
} }
} }
# Swap Entries # Swap Entries
!swap("Entry[3]", "Entry[4]"); swap("Entry[3]", "Entry[4]");
} }
``` ```
## Project Specifications 4. Comments
The project will be written in C# using .NET 8 and released under a BSD 3-Clause permissive license. Comments are prefixed with the '#' character.
Libraries which will be utilized:
- Sprache: Monadic parser for reading in XNeedle specifications
- System.IO.Hashing: For calculating checksums to use in the resulting document
- Command Line Parser: For parsing command line options
## Timeline ## Running the command
A feature complete release is expected in Q2 of 2026. ```bash
xn sample.xn -i input.xml -o output.xml
```
The file `sample.xn` is the transformation specification as outlined above.
For input and output, see `input.xml` and `output.xml` respectively.
Refer to the help text using the `--help` switch for more details.