Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| lxplan [2026/01/16 14:22] – ssm2017 | lxplan [2026/01/27 12:47] (current) – [js version] ssm2017 | ||
|---|---|---|---|
| Line 117: | Line 117: | ||
| | netnode | Network Device | name, fname, id, sid, have, note, dmode | note, user1, user2, user3, ipaddr, mode, univ | | | netnode | Network Device | name, fname, id, sid, have, note, dmode | note, user1, user2, user3, ipaddr, mode, univ | | ||
| === categories === | === categories === | ||
| - | <sxh> | + | <code> |
| Hide | Hide | ||
| Position | Position | ||
| Line 125: | Line 125: | ||
| Device | Device | ||
| 3D | 3D | ||
| - | </sxh> | + | </code> |
| === sub indices === | === sub indices === | ||
| ^ Key ^ Human Key ^ Subindex ^ Abbr ^ GDTF ^ | ^ Key ^ Human Key ^ Subindex ^ Abbr ^ GDTF ^ | ||
| Line 236: | Line 236: | ||
| ===== template ===== | ===== template ===== | ||
| - | <sxh xml> | + | <code xml> |
| <?xml version=" | <?xml version=" | ||
| <key> | <key> | ||
| Line 305: | Line 305: | ||
| < | < | ||
| </ | </ | ||
| - | </sxh> | + | </code> |
| - | <sxh xml> | + | <code xml> |
| <?xml version=" | <?xml version=" | ||
| <key> | <key> | ||
| Line 1679: | Line 1679: | ||
| < | < | ||
| </ | </ | ||
| - | </sxh> | + | </code> |
| + | ==== Lib maker ==== | ||
| + | made with claude.ai. create symbol with lxplan or import dxf then keep only one layer and then embed the symbol inside a group and then run the python script. | ||
| + | <code python> | ||
| + | import tkinter as tk | ||
| + | from tkinter import filedialog, messagebox, ttk | ||
| + | import xml.etree.ElementTree as ET | ||
| + | import os | ||
| + | class XMLExtractorApp: | ||
| + | def __init__(self, | ||
| + | self.root = root | ||
| + | self.root.title(" | ||
| + | self.root.geometry(" | ||
| + | self.root.resizable(False, | ||
| + | | ||
| + | self.input_file = None | ||
| + | self.tree = None | ||
| + | | ||
| + | self.create_widgets() | ||
| + | | ||
| + | def create_widgets(self): | ||
| + | # Title | ||
| + | title = tk.Label(self.root, | ||
| + | font=(" | ||
| + | title.pack(pady=10) | ||
| + | | ||
| + | # Info label | ||
| + | info = tk.Label(self.root, | ||
| + | | ||
| + | info.pack() | ||
| + | | ||
| + | # Input file frame | ||
| + | input_frame = tk.Frame(self.root) | ||
| + | input_frame.pack(pady=10, | ||
| + | | ||
| + | tk.Label(input_frame, | ||
| + | font=(" | ||
| + | | ||
| + | file_display_frame = tk.Frame(input_frame) | ||
| + | file_display_frame.pack(fill=tk.X, | ||
| + | | ||
| + | self.file_label = tk.Label(file_display_frame, | ||
| + | | ||
| + | self.file_label.pack(side=tk.LEFT, | ||
| + | | ||
| + | browse_btn = tk.Button(file_display_frame, | ||
| + | command=self.browse_file) | ||
| + | browse_btn.pack(side=tk.RIGHT) | ||
| + | | ||
| + | # Output file frame | ||
| + | output_frame = tk.Frame(self.root) | ||
| + | output_frame.pack(pady=10, | ||
| + | | ||
| + | tk.Label(output_frame, | ||
| + | font=(" | ||
| + | | ||
| + | self.output_entry = tk.Entry(output_frame, | ||
| + | self.output_entry.pack(fill=tk.X, | ||
| + | self.output_entry.insert(0, | ||
| + | | ||
| + | # Additional fields frame | ||
| + | fields_frame = tk.Frame(self.root) | ||
| + | fields_frame.pack(pady=10, | ||
| + | | ||
| + | tk.Label(fields_frame, | ||
| + | font=(" | ||
| + | | ||
| + | # Name field (displayed as " | ||
| + | name_frame = tk.Frame(fields_frame) | ||
| + | name_frame.pack(fill=tk.X, | ||
| + | tk.Label(name_frame, | ||
| + | self.name_entry = tk.Entry(name_frame, | ||
| + | self.name_entry.pack(side=tk.LEFT, | ||
| + | | ||
| + | # ID field | ||
| + | id_frame = tk.Frame(fields_frame) | ||
| + | id_frame.pack(fill=tk.X, | ||
| + | tk.Label(id_frame, | ||
| + | self.id_entry = tk.Entry(id_frame, | ||
| + | self.id_entry.pack(side=tk.LEFT, | ||
| + | | ||
| + | # Fname field | ||
| + | fname_frame = tk.Frame(fields_frame) | ||
| + | fname_frame.pack(fill=tk.X, | ||
| + | tk.Label(fname_frame, | ||
| + | self.fname_entry = tk.Entry(fname_frame, | ||
| + | self.fname_entry.pack(side=tk.LEFT, | ||
| + | | ||
| + | # Kind field (dropdown) | ||
| + | kind_frame = tk.Frame(fields_frame) | ||
| + | kind_frame.pack(fill=tk.X, | ||
| + | tk.Label(kind_frame, | ||
| + | | ||
| + | # Dictionary mapping display names to values | ||
| + | self.kind_options = { | ||
| + | "eko / ERS": " | ||
| + | "Zoom Leko / ERS": " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | "DMX Device": | ||
| + | " | ||
| + | "Focus Point": | ||
| + | " | ||
| + | " | ||
| + | "Color Mixing Automated Fixture": | ||
| + | "Color Mixing Rectangular Beam (obsolete rgb)": " | ||
| + | "Color Mixing Rectangular Beam (obsolete rgba)": | ||
| + | "Color Mixing Rectangular Beam": " | ||
| + | "Color Mixing Striplight": | ||
| + | "Color Mixing Leko / ERS": " | ||
| + | "Color Mixing Zoom ERS": " | ||
| + | "Color Mixing DMX Device": | ||
| + | " | ||
| + | } | ||
| + | | ||
| + | self.kind_var = tk.StringVar() | ||
| + | self.kind_dropdown = ttk.Combobox(kind_frame, | ||
| + | values=list(self.kind_options.keys()), | ||
| + | state=" | ||
| + | font=(" | ||
| + | self.kind_dropdown.pack(side=tk.LEFT, | ||
| + | self.kind_dropdown.current(0) | ||
| + | | ||
| + | # Extract button | ||
| + | extract_btn = tk.Button(self.root, | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | extract_btn.pack(pady=20) | ||
| + | | ||
| + | # Status label | ||
| + | self.status_label = tk.Label(self.root, | ||
| + | | ||
| + | self.status_label.pack(pady=5) | ||
| + | | ||
| + | def browse_file(self): | ||
| + | filename = filedialog.askopenfilename( | ||
| + | title=" | ||
| + | filetypes=[(" | ||
| + | ) | ||
| + | if filename: | ||
| + | self.input_file = filename | ||
| + | self.file_label.config(text=os.path.basename(filename), | ||
| + | self.status_label.config(text=" | ||
| + | | ||
| + | def extract_and_convert(self): | ||
| + | # Validate inputs | ||
| + | if not self.input_file: | ||
| + | messagebox.showerror(" | ||
| + | return | ||
| + | | ||
| + | output_filename = self.output_entry.get().strip() | ||
| + | if not output_filename: | ||
| + | messagebox.showerror(" | ||
| + | return | ||
| + | | ||
| + | # Get the directory of the input file and create full output path | ||
| + | input_dir = os.path.dirname(self.input_file) | ||
| + | output_file = os.path.join(input_dir, | ||
| + | | ||
| + | try: | ||
| + | # Parse the LXXPLOT file (XML format) | ||
| + | tree = ET.parse(self.input_file) | ||
| + | root = tree.getroot() | ||
| + | | ||
| + | # Find the shape tag using the xpath: / | ||
| + | shape_element = root.find(" | ||
| + | | ||
| + | if shape_element is None: | ||
| + | messagebox.showerror(" | ||
| + | "Path '/ | ||
| + | return | ||
| + | | ||
| + | # Create the new XML structure: / | ||
| + | new_root = ET.Element(" | ||
| + | kentry = ET.SubElement(new_root, | ||
| + | | ||
| + | # Add name, kind, and fname as siblings of custom with user-provided values | ||
| + | name = ET.SubElement(kentry, | ||
| + | name.text = self.name_entry.get().strip() | ||
| + | | ||
| + | id_elem = ET.SubElement(kentry, | ||
| + | id_elem.text = self.id_entry.get().strip() | ||
| + | | ||
| + | kind = ET.SubElement(kentry, | ||
| + | # Get the value corresponding to the selected display name | ||
| + | selected_display = self.kind_var.get() | ||
| + | kind.text = self.kind_options.get(selected_display, | ||
| + | | ||
| + | fname = ET.SubElement(kentry, | ||
| + | fname.text = self.fname_entry.get().strip() | ||
| + | | ||
| + | custom = ET.SubElement(kentry, | ||
| + | | ||
| + | symbol = ET.SubElement(custom, | ||
| + | group = ET.SubElement(symbol, | ||
| + | shape = ET.SubElement(group, | ||
| + | | ||
| + | # Copy the content from shape element to the new shape element | ||
| + | shape.text = shape_element.text | ||
| + | shape.attrib = shape_element.attrib | ||
| + | | ||
| + | # Copy all child elements from original shape to new shape | ||
| + | for child in shape_element: | ||
| + | shape.append(child) | ||
| + | | ||
| + | # Create and write the new LXKEY file | ||
| + | new_tree = ET.ElementTree(new_root) | ||
| + | ET.indent(new_tree, | ||
| + | new_tree.write(output_file, | ||
| + | | ||
| + | self.status_label.config( | ||
| + | text=f" | ||
| + | fg=" | ||
| + | ) | ||
| + | messagebox.showinfo(" | ||
| + | f" | ||
| + | | ||
| + | except ET.ParseError as e: | ||
| + | messagebox.showerror(" | ||
| + | f" | ||
| + | self.status_label.config(text=" | ||
| + | except Exception as e: | ||
| + | messagebox.showerror(" | ||
| + | self.status_label.config(text=" | ||
| + | |||
| + | if __name__ == " | ||
| + | root = tk.Tk() | ||
| + | app = XMLExtractorApp(root) | ||
| + | root.mainloop() | ||
| + | </ | ||
| + | |||
| + | ==== js version ==== | ||
| + | <code javascript> | ||
| + | < | ||
| + | <html lang=" | ||
| + | |||
| + | < | ||
| + | <meta charset=" | ||
| + | <meta name=" | ||
| + | < | ||
| + | < | ||
| + | body { | ||
| + | font-family: | ||
| + | margin: 20px; | ||
| + | line-height: | ||
| + | } | ||
| + | |||
| + | textarea { | ||
| + | width: 100%; | ||
| + | height: 200px; | ||
| + | margin: 10px 0; | ||
| + | } | ||
| + | |||
| + | button { | ||
| + | padding: 8px 16px; | ||
| + | background-color: | ||
| + | color: white; | ||
| + | border: none; | ||
| + | border-radius: | ||
| + | cursor: pointer; | ||
| + | } | ||
| + | |||
| + | button: | ||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | .test-result> | ||
| + | font-weight: | ||
| + | padding: 5px; | ||
| + | } | ||
| + | |||
| + | .valid { | ||
| + | color: white; | ||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | .invalid { | ||
| + | color: white; | ||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | .no-answer { | ||
| + | color: black; | ||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | .container { | ||
| + | border: 1px solid black; | ||
| + | border-radius: | ||
| + | margin: 5px; | ||
| + | padding: 10px; | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | <div class=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <ul> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | les autres si besoin</ | ||
| + | < | ||
| + | bibliotheque (voir l' | ||
| + | </ul> | ||
| + | </p> | ||
| + | </ | ||
| + | </ | ||
| + | <div class=" | ||
| + | < | ||
| + | < | ||
| + | <input type=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | class=" | ||
| + | < | ||
| + | <button onclick=" | ||
| + | </ | ||
| + | <div id=" | ||
| + | < | ||
| + | <div class=" | ||
| + | <div id=" | ||
| + | < | ||
| + | <div> | ||
| + | <label for=" | ||
| + | <input type=" | ||
| + | </ | ||
| + | <div> | ||
| + | <label for=" | ||
| + | <input type=" | ||
| + | </ | ||
| + | <div> | ||
| + | <label for=" | ||
| + | <input type=" | ||
| + | </ | ||
| + | <div> | ||
| + | <label for=" | ||
| + | <select id=" | ||
| + | <option value=""> | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | <div id=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | Cliquer içi pour editer les champs optionnels | ||
| + | </ | ||
| + | <div id=" | ||
| + | </ | ||
| + | </ | ||
| + | <button id=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | // declaration des variables | ||
| + | var xmlInputContent = ""; | ||
| + | var xmlOutputContent = ""; | ||
| + | var shape = ""; | ||
| + | var isLxxplot = false; | ||
| + | var hasShape = false; | ||
| + | var hasGroup = false; | ||
| + | var filledOptionalFields = undefined; | ||
| + | var filledFields = []; | ||
| + | var isLxxplotDiv = document.getElementById(" | ||
| + | var hasShapeDiv = document.getElementById(" | ||
| + | var hasGroupDiv = document.getElementById(" | ||
| + | var dataFields = document.getElementById(" | ||
| + | var dataTypeSelect = document.getElementById(' | ||
| + | var dynamicFields = document.getElementById(' | ||
| + | |||
| + | // Tableau des options de la liste de sélection | ||
| + | const selectOptions = [ | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | ]; | ||
| + | |||
| + | // Tableau des champs disponibles | ||
| + | const availableFields = [ | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | { id: " | ||
| + | ]; | ||
| + | |||
| + | // reinitialise les resultats du test de fichier | ||
| + | function resetChecks() { | ||
| + | let content = '< | ||
| + | isLxxplotDiv.innerHTML = content; | ||
| + | hasShapeDiv.innerHTML = content; | ||
| + | hasGroupDiv.innerHTML = content; | ||
| + | dataFields.hidden = true; | ||
| + | } | ||
| + | |||
| + | // action quand le document est bien chargé | ||
| + | document.addEventListener(' | ||
| + | resetChecks(); | ||
| + | fillSelectOptions(); | ||
| + | }); | ||
| + | |||
| + | // Remplit la liste déroulante de type d' | ||
| + | function fillSelectOptions() { | ||
| + | dataTypeSelect.innerHTML = '< | ||
| + | selectOptions.forEach((option) => { | ||
| + | const optElement = document.createElement(" | ||
| + | optElement.value = option.id; | ||
| + | optElement.textContent = option.label; | ||
| + | dataTypeSelect.appendChild(optElement); | ||
| + | }); | ||
| + | } | ||
| + | |||
| + | // ecoute si le type d' | ||
| + | dataTypeSelect.addEventListener(" | ||
| + | const selectedOptionId = dataTypeSelect.value; | ||
| + | displayDynamicFields(selectedOptionId); | ||
| + | }); | ||
| + | |||
| + | // Affiche les champs optionnels en fonction du type d' | ||
| + | function displayDynamicFields(selectedOptionId) { | ||
| + | dynamicFields.innerHTML = "";// | ||
| + | |||
| + | // Trouve l' | ||
| + | const selectedOption = selectOptions.find((option) => option.id === selectedOptionId); | ||
| + | |||
| + | if (!selectedOption || !selectedOption.fields) return; | ||
| + | |||
| + | // Récupère les IDs des champs à afficher | ||
| + | const fieldIds = selectedOption.fields.split(";" | ||
| + | |||
| + | // Affiche chaque champ | ||
| + | fieldIds.forEach((fieldId) => { | ||
| + | |||
| + | const field = availableFields.find((f) => f.id === fieldId); | ||
| + | |||
| + | if (field) { | ||
| + | const fieldDiv = document.createElement(" | ||
| + | fieldDiv.innerHTML = ` | ||
| + | <label for=" | ||
| + | <input type=" | ||
| + | `; | ||
| + | dynamicFields.appendChild(fieldDiv); | ||
| + | } | ||
| + | }); | ||
| + | } | ||
| + | |||
| + | // charge le fichier lxxplot | ||
| + | function loadFile() { | ||
| + | const fileInput = document.getElementById(' | ||
| + | const file = fileInput.files[0]; | ||
| + | if (!file) { | ||
| + | alert(" | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | const reader = new FileReader(); | ||
| + | reader.onload = function (e) { | ||
| + | xmlInputContent = e.target.result; | ||
| + | dataFields.hidden = !runChecks(); | ||
| + | }; | ||
| + | reader.readAsText(file); | ||
| + | } | ||
| + | |||
| + | // verifie le contenu du fichier lxxplot | ||
| + | function runChecks() { | ||
| + | isLxxplot = checkIfValidPath("/ | ||
| + | hasShape = checkIfValidPath("/ | ||
| + | if (hasShape) { | ||
| + | getShape(); | ||
| + | } | ||
| + | hasGroup = checkIfValidPath("/ | ||
| + | return (isLxxplot && hasShape && hasGroup); | ||
| + | } | ||
| + | |||
| + | // petit utilitaire pour tester le contenu du fichier lxxplot | ||
| + | function checkIfValidPath(xpathQuery, | ||
| + | resultDiv = document.getElementById(resultDiv); | ||
| + | let status = parseXml(xpathQuery).status; | ||
| + | resultDiv.innerHTML = status ? '< | ||
| + | return status; | ||
| + | } | ||
| + | |||
| + | // petit utilitaire permettant de tester le xml du fichier lxxplot | ||
| + | function parseXml(xpathQuery) { | ||
| + | try { | ||
| + | // Parser le XML | ||
| + | const parser = new DOMParser(); | ||
| + | const xmlDoc = parser.parseFromString(xmlInputContent, | ||
| + | |||
| + | // Exécuter la requête XPath | ||
| + | const xpathResult = document.evaluate( | ||
| + | xpathQuery, | ||
| + | xmlDoc, | ||
| + | null, | ||
| + | XPathResult.ANY_TYPE, | ||
| + | null | ||
| + | ); | ||
| + | |||
| + | let result = []; | ||
| + | let node = xpathResult.iterateNext(); | ||
| + | while (node) { | ||
| + | result.push(node.textContent); | ||
| + | node = xpathResult.iterateNext(); | ||
| + | } | ||
| + | |||
| + | // Afficher le résultat | ||
| + | if (result.length > 0) { | ||
| + | return { " | ||
| + | } else { | ||
| + | return { " | ||
| + | } | ||
| + | } catch (e) { | ||
| + | console.error(" | ||
| + | return { " | ||
| + | } | ||
| + | } | ||
| + | |||
| + | // reuperer la shape depuis le fichier lxxplot | ||
| + | function getShape() { | ||
| + | try { | ||
| + | // Parser le XML | ||
| + | const parser = new DOMParser(); | ||
| + | const xmlDoc = parser.parseFromString(xmlInputContent, | ||
| + | |||
| + | // Exécuter la requête XPath | ||
| + | const xpathResult = document.evaluate( | ||
| + | "/ | ||
| + | xmlDoc, | ||
| + | null, | ||
| + | XPathResult.FIRST_ORDERED_NODE_TYPE, | ||
| + | null | ||
| + | ); | ||
| + | |||
| + | shape = xpathResult.singleNodeValue; | ||
| + | } catch (e) { | ||
| + | console.error(" | ||
| + | return { " | ||
| + | } | ||
| + | } | ||
| + | |||
| + | // action quand on appuie sur le bouton "creer la librairie" | ||
| + | function buildOutput() { | ||
| + | if (checkFilledFields()) { | ||
| + | buildXmlOutput(); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | // verifier que les champs soient bien remplis | ||
| + | function checkFilledFields() { | ||
| + | filledFields = []; | ||
| + | getFilledChildren(' | ||
| + | if (Object.keys(filledFields).length < 3 || dataTypeSelect.value === '' | ||
| + | alert(" | ||
| + | return false; | ||
| + | } | ||
| + | getFilledChildren(' | ||
| + | return true; | ||
| + | } | ||
| + | |||
| + | function getFilledChildren(id) { | ||
| + | // recupere les champs | ||
| + | const divElement = document.getElementById(id); | ||
| + | const inputNodes = divElement.getElementsByTagName(' | ||
| + | |||
| + | // teste les champs un par un | ||
| + | for (let i = 0; i < inputNodes.length; | ||
| + | if (inputNodes[i].value.trim() !== '' | ||
| + | filledFields.push({ " | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | // fabrique le fichier de sortie et l' | ||
| + | function buildXmlOutput() { | ||
| + | // creation du document xml | ||
| + | const xmlDoc = new DOMParser().parseFromString('< | ||
| + | const root = xmlDoc.documentElement; | ||
| + | |||
| + | // creation des elements basiques | ||
| + | const kentryElement = xmlDoc.createElement(' | ||
| + | const customElement = xmlDoc.createElement(" | ||
| + | const symbolElement = xmlDoc.createElement(" | ||
| + | const groupElement = xmlDoc.createElement(" | ||
| + | const kindElement = xmlDoc.createElement(" | ||
| + | kindElement.textContent = dataTypeSelect.value; | ||
| + | |||
| + | // ajout des elements basiques dans l' | ||
| + | groupElement.appendChild(shape); | ||
| + | symbolElement.appendChild(groupElement); | ||
| + | customElement.appendChild(symbolElement); | ||
| + | kentryElement.appendChild(kindElement); | ||
| + | |||
| + | // ajout de chaque champ rempli | ||
| + | filledFields.forEach((item) => { | ||
| + | const newItem = xmlDoc.createElement(item.id); | ||
| + | newItem.textContent = item.value; | ||
| + | kentryElement.appendChild(newItem); | ||
| + | }); | ||
| + | |||
| + | kentryElement.appendChild(customElement); | ||
| + | root.appendChild(kentryElement); | ||
| + | |||
| + | // conversion en chaine de characteres | ||
| + | const xmlString = "<? | ||
| + | console.log(xmlString); | ||
| + | |||
| + | // creation fichier | ||
| + | const blob = new Blob([xmlString], | ||
| + | const url = URL.createObjectURL(blob); | ||
| + | |||
| + | // envoi du fichier | ||
| + | const a = document.createElement(' | ||
| + | a.href = url; | ||
| + | a.download = ' | ||
| + | a.click(); | ||
| + | |||
| + | // nettoyage | ||
| + | URL.revokeObjectURL(url); | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||