ComfyUI Node

XML Style Injector

Swap the artist and style in your NewBie XML without touching the markup

By SuzumiyaAkizuki·Created 9 months ago·Updated 19 days ago· 107
XML Style Injector
    • xml_output
    • style_save_metadata
    xml_input
    mode
    preset
    artist_add
    style_add

    Once the LLM formatter hands you a NewBie XML prompt, the next thing you'll want to do is audition styles - try this artist, drop that vibe, compare. Editing the <img> block by hand between every generation is exactly how you learn to hate XML. XML Style Injector is the shortcut: feed it a prompt and pick a preset, and it rewrites the <artist> and <style> tags for you, in place.

    It sits right after the formatter in a chain. Wire the formatter's xml_out into the injector's xml_input, pick a preset from the dropdown (those come from the styles object in LPF_config.json, and the pack ships with a few dozen already), optionally prepend extra tags with artist_add and style_add, and the node does the rest.

    How the two modes behave. In NewBie mode it finds the <img>...</img> block, parses it with lxml, and replaces the existing <artist> and <style> elements. No matching tag? It creates one under <general_tags>. Leave the field empty and it leaves the original content alone. In Anima mode it works on plain text instead: strips out any existing @artist markers, appends a "use the fixed style of @x and @y" line, and tacks the style string onto the end. There's one honest warning from the developer baked in here: Anima-mode injection is adapted but "strongly not recommended" - an artist string that works for NewBie doesn't necessarily transfer to Anima, so if you're on Anima, mostly don't bother.

    Inputs and outputs. The three required inputs are xml_input, mode (which must match the formatter's mode - a mismatch is the classic mistake), and the preset dropdown. artist_add and style_add are the optional additive fields. Outputs: xml_output, the modified prompt ready for the NewBie text encoder, and style_save_metadata, which isn't for the image at all - wire it into Style Preset Saver to save your current combo as a reusable preset. That second output is a nice touch: it turns "I like this look" into "I can call this look up forever."

    Two things to keep in mind. Presets are read from the config file when the node is created, so if you hand-edit LPF_config.json (or save via Style Preset Saver), recreate the node to see the new entries in the dropdown. And the injector is a pure text transform - it doesn't know anything about your image, so a preset that looks great on one character can look off on another. That's not a bug; that's prompt engineering.

    CategoryNewBie LLM Formatter

    Inputs (5)

    NameTypeDefaultDescription
    xml_inputSTRING
    modeCOMBO2 options: NewBie, Anima
    presetCOMBO2 options: [Both] 空样式,请在下方文本框中自行书写, 空样式,请在下方文本框中自行书写
    artist_addoptSTRING
    style_addoptSTRING

    Outputs (2)

    NameTypeDescription
    xml_outputSTRING
    style_save_metadataSTRING