Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
XML Cómo guardar un archivo xml editado

Quiero seleccionar todos los elementos que tienen el atributo 'categoryId' igual a 'VGA-NVD' y guardarlos en un nuevo archivo xml. ingrese la descripción de la imagen aquí

Como puede ver aquí, los productos tienen el atributo 'categoryId' y quiero tomar todos los elementos que tienen en este atributo el valor "VGA-NVD".

Puedo imprimirlos en la consola usando java script:

 <script> src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js"></script> <script src="https://requirejs.org/docs/release/2.3.5/minified/require.js"></script> <script> document.addEventListener('DOMContentLoaded', ()=>{ let url = "cennik.xml"; fetch(url) .then(response=>response.text()) .then(data=>{ let parser = new DOMParser(); let xml = parser.parseFromString(data, "text/xml"); let images = xml.getElementsByTagName('Image'); let houses = xml.getElementsByTagName('Product'); let remove = xml.querySelector('Categories'); let remove2 = xml.querySelector('Producers'); remove2.remove(); for(let i=0; i<houses.length; i++){ var url2 = images[i].getAttribute('url') images[i].setAttribute('url','https://cdn.action.pl/File.aspx?CID=77353&UID=newpoint&PID=9c4b2df98fb7b4c6ec77ef13d552fba6&P='+url2) let houses_cat = houses[i].getAttribute('categoryId'); if(houses_cat=="VGA-NVD"){ } } console.log(xml) }); }) </script>

Esta es la respuesta: ingrese la descripción de la imagen aquí

Llamé a todos los elementos que su 'categoryId' es igual a 'VGA-NVD'. Ahora, cómo guardar esta respuesta en un archivo xml. Si no es posible en java script, ¿qué debo hacer? Gracias por ayudar.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!