Parse XML using the standard Java DOM parser

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ธ.ค. 2024

ความคิดเห็น • 19

  • @medvfx3370
    @medvfx3370 3 ปีที่แล้ว +1

    Amazing tutorial man, very in-depth and very clear
    thanks a lot.

  • @TheFlyguy31
    @TheFlyguy31 8 ปีที่แล้ว +4

    Wow! You know your stuff!

  • @madhanv8979
    @madhanv8979 2 ปีที่แล้ว

    Hi Paul, what if I want to get all the title from each tag?

  • @Mr43808
    @Mr43808 8 ปีที่แล้ว +1

    it was helpful, thanks!

  • @aparnausa3619
    @aparnausa3619 ปีที่แล้ว

    I want to write or replace the text of the text tag in the xml , can you explain how ?

    • @PaulGestwicki
      @PaulGestwicki  ปีที่แล้ว

      Once you have the document in memory and have a handle on an element, you should be able to call its setTextContent method, just like I have used getTextContent here.

  • @kavitakumawat4929
    @kavitakumawat4929 3 ปีที่แล้ว +1

    helpful! thanks mahn! :)

  • @moha-mantriofhousingarchit6487
    @moha-mantriofhousingarchit6487 7 ปีที่แล้ว

    Hi Paul , what if I've XML string rather then XML File. how do I parse it and store into Maps?
    for Ex:String vehicleInfo = "
    BMW
    Yamaha
    GMC
    "
    need to store the tag name as a Key and tag value as a Value into the map.
    Thanks in advance.

    • @PaulGestwicki
      @PaulGestwicki  7 ปีที่แล้ว

      You could turn the string into a stream and hand that to the XML parser, then either walk the DOM or handle the SAX events to build your map. ByteArrayInputStream is part of the standard library, but you can find even more alternatives on StackOverflow. That's probably the best place for this kind of question, really.

    • @moha-mantriofhousingarchit6487
      @moha-mantriofhousingarchit6487 7 ปีที่แล้ว

      +Paul Gestwicki ,Thanks a lot Paul, really appreciate it.

  • @chaitalivishal
    @chaitalivishal ปีที่แล้ว

    How to handle nested xml like I have 5 reports each have 10 tags and out of 10tags have 3-4 subtags.
    Eg.
    12345
    ....
    Same as Rep 1
    I have total 5 Rep tags

    • @PaulGestwicki
      @PaulGestwicki  ปีที่แล้ว

      The same principles hold. Walk through the tree one step at a time, casting the results into the right types to get the API calls you need. One useful technique for exploring the API is to use the integrated debugger. You can set a breakpoint then try different API calls while the application is paused, allowing you to figure out what combination of calls gets to the data you seek.

  • @syedwaseemahmed1749
    @syedwaseemahmed1749 7 ปีที่แล้ว

    Hi,
    I have to convert xml files 3.01 version and into another 2.2.5 versision xml file.
    Is it possible in java to make a tool for version conversion????
    Thank's a lot
    sd.waseem

    • @PaulGestwicki
      @PaulGestwicki  7 ปีที่แล้ว

      I'm sure it's possible: it's just structured data transformation. I can't say much more about it though.

    • @syedwaseemahmed1749
      @syedwaseemahmed1749 7 ปีที่แล้ว

      Thanks for the quick reply.can You Plz give some reference fro that???

  • @zoomemes4336
    @zoomemes4336 6 ปีที่แล้ว

    oh god why I am still using java?