Это видео недоступно.
Сожалеем об этом.

JavaScript Tip: Loading an External XML File

Поделиться
HTML-код
  • Опубликовано: 14 авг 2024
  • If you need access to XML data and it is stored in an external XML file, you will need to load it. In this tutorial we use the XML HttpRequest object to load an external XML file. This tutorial is a follow up to a previous tutorial on working with XML data: • JavaScript Question: H...
    For more resources on JavaScript:
    www.allthingsja...
    Access to EVERY course (get 2 months free): www.skillshare...
    Courses offered on Udemy at a discount:
    Getting Started: www.udemy.com/...
    Advanced Topics: www.udemy.com/...
    Mastering Regular Expressions in JavaScript:
    www.udemy.com/...
    Functional Programming in JavaScript: www.udemy.com/...
    NEW Mastering JavaScript Arrays: www.udemy.com/...
    Tutorials referred to in this video:
    Working with XML Data: • JavaScript Question: H...
    Callbacks: • Understanding JavaScri...

Комментарии • 23

  • @shailabhagwat1921
    @shailabhagwat1921 Год назад +1

    Excelllent

  • @kylerbriskey372
    @kylerbriskey372 3 года назад

    Great video explaining things slowly!

  • @trananhome
    @trananhome 2 года назад

    I have a xml file which I upload it through a button. I want to convert the data of it into a editable one (I want to find and replace automatically some strings in it). What should I do, which method should I use? Looking forward to your response.

    • @AllThingsJavaScript
      @AllThingsJavaScript  2 года назад

      When you load an XML file it becomes a string. So you can replace anything in the string. The difficult part is writing it out to the hard drive. If you are sending it back to a server, no problem. But you won't be able to write to the hard drive with just JavaScript for security reasons.

    • @trananhome
      @trananhome 2 года назад

      @@AllThingsJavaScript thanks very much for your reply. And yes, the only thing I don't know is how to save the changes back to file :((

    • @AllThingsJavaScript
      @AllThingsJavaScript  2 года назад +1

      @@trananhome It must be done with an application, or on a server. Setting up a server with node would do it.

  • @videotimebaby90
    @videotimebaby90 2 года назад

    thank you, very helpful

  • @phanindrakumarpulletikurti
    @phanindrakumarpulletikurti 6 лет назад

    make a video about unit testing and e2e testing

  • @stormdark7007
    @stormdark7007 5 лет назад +1

    hello, I have to display on a web page my contents of my xml file by doing a parser. But my javascript code does not work and nothing is displayed. could you help me? thank you in advance

    • @AllThingsJavaScript
      @AllThingsJavaScript  5 лет назад

      Post your code and any errors you are getting.

    • @stormdark7007
      @stormdark7007 5 лет назад

      @@AllThingsJavaScript
      fichier html:


      Application API





      Application API



      Accueil

      JSON

      XML






      Tests API avec JSON/XML


      $.getJSON( "/home/damien/lappstack-7.1.27-1/apache2/htdocs/Projettut2/xml.json", function( data ) {
      var items = [];
      $.each( data, function( key, val ) {
      items.push( "" + val.title + "" );
      });
      $( "", {
      "class": "my-new-list",
      html: items.join( "" )
      }).appendTo( "body" );
      });
      Fichier xml:

      Lemaire
      Pierre
      245
      Rue Victor Hugo
      60750
      Choisy-au-bac
      FRANCE

      03 44 85 97 32
      06 20 92 31 80

      Plemaire770@gmail.com



      Bodin
      Damien
      7
      Rue des treilles
      62400
      Béthune
      France

      0782905065

      damien.bodin07@gmail.com

      explain:
      in the hml file I have to make a java script in the tag to read on the html page the data of the xml file.

    • @stormdark7007
      @stormdark7007 5 лет назад

      the script that is on the html file does not work because it is for my json file and in fact I have to do the same for the xml file and nothing works because I tried a lot of other script

    • @AllThingsJavaScript
      @AllThingsJavaScript  5 лет назад

      It looks like you are using jQuery for this. So what type of response are you getting? Do you receive an error? If no error, check the data variable of the function and see if you receive any thing in it. That will help narrow down where the problem is. That is the first step.

  • @ronaldsupenieks803
    @ronaldsupenieks803 5 лет назад

    Is it not possible to load in an external XML file without making HTTP requests?

    • @AllThingsJavaScript
      @AllThingsJavaScript  5 лет назад

      You can use fetch: ruclips.net/p/PLTo9PCskHpbGVLVtW0XBUVbfeqT5r-SBh
      You can also use a JavaScript library, but it will do this kind of thing on the backend.

  • @matkomilic201
    @matkomilic201 5 лет назад

    Thanx

  • @pricereiallc2654
    @pricereiallc2654 4 года назад

    You could get more visits if you change your title adding in for newbies.

  • @andalonds
    @andalonds 3 года назад

    why not use a quiet keyboard.

  • @joantonio6331
    @joantonio6331 5 лет назад +5

    Goooosh, this video feels like you are at school..... So slow filled with unnecessary introductions like you are in a theory class... the interesting part start at 4:29