Your XML friend XPATH command line xmllint

March 5th, 2011 mysurface Posted in Text Manipulation, xmllint | Hits: 338116 | 108 Comments »

Do you have a large XML to analyze? to query for info? Maybe you are using a XML viewer, a string search for that. But if your XML have a proper structure and you have understand enough for the structure, you may want to consider to use XPATH.

[Q] What is XPATH?
XPath is a “language” for finding information in an XML document. Something like SQL, it has its own syntax to help you to query for your info in an XML. To know more about XPATH, can check out this XPATH tutorial.

[Q] Is there any XPATH command that I can use to query my XML?
xmllint, which comes with libxml2.

xmllint provides you a shell where you can continuously to query your XML.

xmllint --shell myXML.xml

Shell mode is also a good way for you to learn up XPATH, type ‘help’ in the xmllint shell shows you a list of command it support.

Take books.xml sample as example.

To query all the books title, you can do this in the shell.

> cat //title 
<title lang="en">Everyday Italian</title>
<title lang="en">Harry Potter</title>
<title lang="en">XQuery Kick Start</title>
<title lang="en">Learning XML</title>

xmllint shell support grep where you can search with string keywords

> grep XML
/comment() : c--       20
/bookstore/book[4]/title : t--       12 Learning XML

grep in shell is not XPATH syntax, for XPATH to do something similar to grep, you can use contains().

> cat //*[contains(*,"XML")]

XPATH supports many functions to enlighten your query.

[Q] I wanna use the XPATH result for further manipulation, can I get it with xmllint?
--xpath option.

You can do this.

xmllint --xpath //title books.xml

And.... xmllint can do more than that.

I hope you enjoy reading this, bye.

108 Responses to “Your XML friend XPATH command line xmllint”

  1. Interesting justification. I really like to read it Martha

  2. nice post

  3. The buck stops with all the guy who signs the checks.
    Failure or success in operation is caused more with the mental attitude even than by mental capacities.

  4. Thanks this is exactly what I needed.

    I googled for XPath tools and got a lot of fancy online and offline apps, some fancy looking Firefox plugins (which all crashed) and finally found this post!

    xmllint is unbeatale when it comes to simplicity & ease of use.

    Thanks again!

  5. I’ve primarily been using xmllint for formatting XML documents, but had no idea you could parse XML documents and later issue XPath commands. Until now, I was pretty much using XML Copy Editor to issue XPath commands.
    Thank you very much for this!!!

  6. ?? ????? ???????} {?????????????? ?????????? ???????????????????????????????AHA?| ???????????????????????? ?????????????????????thats?? ???????? ???

  7. Beats vim. I wish I knew about this when trying to decipher the open xml format used in Microsoft docx files.

  8. Xpath is not working, is there anything needed to install xpath

  9. Total time from cooking to spoiling for any homestyle pot roast is 105 hours and 36 minutes (almost 5 days).
    The US Food and Drug Administration (FDA) approved the first
    IPL hair removal system in July 1997.

    The next dead drop is underneath the Old Bridge just beyond Imperial City.
    Write down all allergies and prevent any
    food that might cause them. can Beer Go bad big

  10. The problem is that 99.9% of XML has a namespace and in order to run xmllint with that you have to use the –shell option and pass the namespace… not so simple… an update could eliminate thousands of posts on this topic :D

  11. Actually no matter if someone doesn’t be aware of then its up to other users that
    they will assist, so here it happens.

  12. I’m gone to convey my little brother, that he should also go to see this website on regular basis
    to take updated from hottest information.

  13. nike air jordan mens on sale
    I leave a response each time I like a post on a site or I have something to contribute to the discussion. Usually it’s
    caused by the fire communicated in the article I
    browsed. And on this article Your XML friend XPATH command
    line xmllint ? Linux by Examples. I was moved enough to drop a comment
    :-P I do have a couple of questions for you if you tend not to
    mind. Could it be simply me or does it look like like some of the comments look like they
    are coming from brain dead individuals? :-P And, if you are writing at other sites,
    I’d like to keep up with you. Could you make a list the complete urls of
    all your social sites like your Facebook page, twitter feed,
    or linkedin profile?

  14. nba 2011 finals

    I leave a comment each time I like a post on a website or I have
    something to valuable to contribute to the discussion. It is caused by the fire
    communicated in the post I browsed. And after this article Your XML friend XPATH command line xmllint ?
    Linux by Examples. I was excited enough to drop a thought :
    ) I actually do have some questions for you if you
    do not mind. Could it be just me or does it look like like
    some of these comments look like coming from brain dead folks?
    :-P And, if you are posting at other places, I would like to keep up with you.

    Could you make a list every one of all your community pages like
    your twitter feed, Facebook page or linkedin profile?

  15. Choose a matte-finish lipstick or blot your lips on a video
    will assist you in and out off this kind of tough
    fabric; straight contours requires hard fabric. You can pair the idea of the family section of their mens range would
    have a little bit in finding specific items. Stellie Bellies will trade you
    your skirt clothes will end uup finding some
    great suspenders and stockings.

  16. An additional approach is plumbing parts plus through the
    installation of such systems troublesome and costly. What do plumbing parts plus you think?
    Always Ask The Right QuestionsKnowing what questions to ask your potential plumber
    lots of questions, check their references.

  17. Thank you for sharing your info. I really appreciate your efforts and I will be waiting for
    your next write ups thank you once again.

  18. Good info. Lucky me I discovered your site by accident
    (stumbleupon). I have book marked it for later!

  19. Manufacturers of incontinence supplies understand that men and women have very different needs when it comes to incontinence underwear so they have designed incontinence underwear that meets those needs.
    These cameras also help employers keep a thorough check
    on what their employees are doing besides being a great aid in crimes solving situations.
    A VGA camera is considered as an early evolution of film cameras.

  20. Thank you, I’ve recently been searching for info about this topic for ages and yours is the best I’ve discovered
    so far. But, what in regards to the conclusion? Are you certain concerning the supply?

  21. You can use Facebook to market your articles or blogs actually.

  22. If you are going for finest contents like I do, only go
    to see this web page every day for the reason that
    it presents quality contents, thanks

  23. I really like your blog.. very nice colors & theme. Did you make this
    website yourself or did you hire someone to do it for you?
    Plz answer back as I’m looking to design my own blog and would
    like to know where u got this from. kudos

  24. This is very interesting, You’re a very professional blogger.
    I have joined your rss feed and look ahead
    to searching for more of your great post.
    Additionally, I’ve shared your web site
    in my social networks

  25. Plant in the spring, care for the plants throughout the summer time, and pick the fruits or vegetables
    in the autumn.

  26. Good post. I’m experiencing some of these issues
    as well..

    Also visit my web site gta v psp free download (Patsy)

  27. Just want to say your article is as astonishing.

    The clarity for your publish is just spectacular and that i could assume you are knowledgeable in this
    subject. Well along with your permission let me to clutch your feed to keep updated with forthcoming post.
    Thanks one million and please continue the gratifying work.

    My weblog :: home business opportunities

  28. It’s hard to find well-informed people on this topic, but you
    sound like you know what you’re talking about!

  29. Truly no matter if someone doesn’t understand afterward its up to other people
    that they will assist, so here it occurs.

    Visit my webpage – Athletic Greens green drink powder

  30. Although female and male addiction share many similarities, female addiction is distinctly different.
    You can compose it to present yourself in the best light but it’s far better
    that the photo doesn’t look too staged. Let’s examine some
    of the main factors that contribute to the development of cysts, and then the best
    things we can do to avoid them.

  31. Some gifted individuals san diego electricians may be able to start your
    electrician or electrical contractor. An electric contractor is properly insured and
    bonded. There are many instances in which you will be also.
    The company that he works for treats him well, but completion of the construction job but do a little better.
    Even if it weren’t for the potentially deadly electrical current.

  32. Even if you have a business that is trustworthy and
    reputable, you might face problem in being able to find
    potential buyers. Visually-compelling, interactive dashboards, reports, and
    data mashups deliver insights and empower
    users, resulting in greater adoption. In most cases building and starting a business means taking many risks, which is exactly why many people don’t go into business.

    My website :: czyli ekonomia od podstaw

  33. Hey! Do you use Twitter? I’d like to follow you
    if that would be okay. I’m definitely enjoying your blog and look forward
    to new updates.

  34. Hello, constantly i used to check blog posts here in the early hours in the daylight, for the reason that i enjoy to find out more and more.

  35. Though they may allow you to purchase ETF’s or mutual
    funds that trade in line with all the price of silver, gold,
    and additional valuable metals, this really is not
    the same because owning physical gold.

  36. Fabulous, what a blog it is! This web site presents useful information to us, keep it up.

    my blog :: after effects optical flares

  37. I really like your blog.. very nice colors & theme. Did you make this website yourself
    or did you hire someone to do it for you?

    Plz answer back as I’m looking to construct my own blog
    and would like to know where u got this from. thanks

  38. On remar?ue tout de suite que vous connaissez très bien ce que vous avancez

    Check out my webpage: rousses cochonnes

  39. Thank you a lot for sharing this with all of us you really recognise what you’re speaking about!
    Bookmarked. Kindly also visit my web site =). We could
    have a hyperlink trade contract among us

  40. I’m gone to inform my little brother, that he should also pay a quick
    visit this website on regular basis to get updated from newest information.

  41. Wonderful site you have here but I was curious if you knew of any user discussion forums that cover the same topics talked about in this
    article? I’d really love to be a part of community where I can get advice from other
    experienced individuals that share the same interest.
    If you have any recommendations, please let me know.
    Appreciate it!

  42. This piece of writing will help the internet visitors for setting up
    new website or even a blog from start to end.

    My favorite webpage regarding engineering: top surround sound system

  43. I’m not sure why but this blog is loading very slow for me.
    Is anyone else having this issue or is it a issue on my end?
    I’ll check back later and see if the problem still exists.

  44. I do not even know how I ended up here, but I
    thought this post was great. I don’t know who you are but definitely
    you’re going to a famous blogger if you aren’t already ;) Cheers!

  45. It’s hard to find educated people in this particular subject, but you seem
    like you know what you’re talking about! Thanks

  46. Appreciation to my father who stated to me on the topic of this
    blog, this web site is in fact remarkable.

  47. You stand to lose a part of your video in the event
    you include changes from inside to outside activities and that’s
    not a good point. Amazon accepts these coupons
    because they benefit Amazon, and you their returning customer.
    Some argue that I could make more money if I printed a quantity
    of books, stored them, and sold them directly to the customer.

  48. I got this web site from my friend who informed me regarding this web
    site and at the moment this time I am visiting this web page and reading very informative content at this time.

  49. Hi! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my blog to rank for somke targeted keywords but I’m not sdeing
    very good gains. If you know of any please share. Kudos!

    Here is my web-site: cheats for dragons of
    atlantis (

  50. Very rapidly this web site will be famous among all
    blogging people, due to it’s good posts

  51. Het is ook goed voor je een aantal tips van ervaren en goed opgeleide slotenmakers.
    Sommige groepen bovendien belang de vingerafdrukken van de slotenmakers voor het doel dat ze geen misbruik maken van hun capaciteiten en voer wet schendingen. Indien u belangrijke documenten moet u bescherm uw bezittingen.

  52. I do not even know how I ended up here, but I thought this post was good.
    I don’t know who you are but definitely you’re going to a famous blogger
    if you aren’t already ;) Cheers!

  53. This is my first time pay a visit at here and i am genuinely
    pleassant to read all at single place.

  54. Numerous evil people today will carry this to their edge.
    This can be done by sending a command to the cellphone by an SMS.
    A big advantage that is very beneficial to many people that choose to consult
    with an experienced investigator to retrieve deleted text and other erased data from their Win – CE cell
    phone is it only takes about 48 hours to recover the
    data, and sometimes even less.

  55. All such sites are real good and trustworthy choices for the users to
    shift in the New Pirate Bay. When you will be making a juice from dark,
    leafy greens, try including a little cucumber.
    Once the windows password reset, the Windows program restarts itself
    and that means you are able to join without password.

  56. I was in search of this. Actually rejuvenating information. Thank you.

  57. For most up-to-date information you have to pay
    a quick visit world-wide-web and on internet I found this site as a most excellent site for hottest updates.

  58. Whats up are using WordPress for your site platform? I’m new to the blog world but I’m trying to get
    started and set up my own. Do you need any html coding expertise
    to make your own blog? Any help would be greatly appreciated!

  59. The just launched Nokia N900 is ready to be a new heartthrob in the mobile market with
    its smart features and stylish design. Aside from that, it also has a feature that allows you to set an alarm on a given time frame instead of
    a specific time. This may enable surveillance at evening over a wide radius.

  60. As the admin of this site is working, no hesitation very rapidly it will be renowned, due to its feature contents.

  61. My family members all the time say that I am wasting
    my time here at net, except I know I am getting familiarity daily by reading thes
    nice articles.

  62. J? suis clairement en accord avec vous

    Takee a look at my web site :: salopes blanches

  63. ?????? ????,?????? ????,?????? ????,?????? ????,
    ?????? ????,?????? ????,?????? ????,

  64. N’hésitez plus après utilisez une promotion Boulanger ou bien sûrs soldes en contrepartie obtenir de vraies bonnes
    amitiés. Nos visiteurs sont prouvés consommateurs avisés après
    viennent régulièrement sur notre emploi comme à l’égard de trouver un code promo Boulanger auparavant d’acheter sur
    internet. Toi pouvez récupérer votre commande directement chez magasin supposé que
    vous êtes impatients, in extenso dans profitant du tas certains euros sur votre mappemonde fidélité B+ supposé
    que vous êtes un acheteur régulier en tenant Boulanger.
    Elle a été mise en ligne le 19 janvier 2011 et elle était fort jusqu’au 31 mars 2011.
    Journée avec réduction en même temps que livraison offres
    négatif CEWE (25 texte.

  65. By using a smooth bottom with a bow in the middle,
    perpendicular to the length of the car, and skirts along the side will create a low-pressure area behind the bow.

    According to the US Bureau of Labor Statistics, employment for automotive engineering jobs will grow as fast as the
    average of all other occupations through to the year 2014.

    And among the different types of direct mail, Automotive Direct Mail
    is the most commonly read and responsive type.

    Here is my site – Alex Ber –

  66. Ce poste est rempli de vérité

    Look into my ?omepaghe :: XXX

  67. Other individuals opted for a a lot more free
    of charge form style, with short skirts and dresses in a
    simple, straight design and style with out a waistline.

  68. Euhhh êtes vou? certain de cce que vo?s avancez ?

    Feell ftee to visit mmy ?ite; sexe en hd

  69. Straightforward vintage wedding gown varies from floor length, ankle length, tea-length
    and even shorter!

  70. Pu??-je recopier deux trois paragraphe? sur mon site perso

    Also visit my pa?e – jeune baiseuse

  71. C? post est vraiment plsin de vérités

    My webpage jeune bombasse

  72. Regarder attentivement s’il y a beaucoup fluctué au cours de conditionnement de base
    maigrir rapidement comme la course,. Ils peuvent causer des ballonnements,
    mauvaise digestion, et augmentdnt le métabolsme basal, BMR.
    Parmi les maigrir rapidement régimes amaigrissants ne font maigrir.
    Lorsque cela se produit dans plus de calories que votre corps est
    stocké sous la supervision d’un instructeur de gymnase professionnel ou peut-être un préparateur physique.

    Crudites quee lle maigrir rapidement régime qu’une personne fait, l’important
    reste de ne pas regarder l’ensemble du poids.

    Feel free to surf to myy page; avis sur lipo 13 et carbuloss

  73. I must thank you for the efforts you’ve put in writing this site.

    I am hoping to view the same high-grade blog posts from you later on as well.
    In fact, your creative writing abilities has encouraged
    me to get my own blog now ;)

  74. This is my first time visit at here and i am really happy to read everthing at single place.

  75. Un ?oste vraiment rempli de vérités

    my we?-site whooty

  76. There are 3 very different plans to choose from, which include, HMO, PPO and
    POS plans. The capsules offered for sale over the Internet by and bottled as Moringa Zinga is not affiliated with
    Zija in any way whatsoever. Bike paths, parks,
    and sports areas can be implemented with federal and state grant monies.

  77. Hi, yup this post is really nice and I have learned lot of
    things from it concerning blogging. thanks.

  78. ?e terminerai de voir t?ut ça dans la journée

    Feeel free to surf to my webpage :: africaine chaude

  79. Very good.

  80. Thanks for a marvelous posting! I truly enjoyed reading
    it, you will be a great author. I will remember to bookmark your blog and
    will often come back sometime soon. I want to encourage
    continue your great writing, have a nice evening!

  81. Brianna Wu is a target of the entire mess and pretending
    that really Who 3? means GG is ignoring the girl is
    actually insulting the intelligence of people who’ve really been viewing this catastrophe unfolding for 90 days now and possess SEEN HOW THIS SHIT WORKS.
    Plus you will find a lot of people that have zero interest in such a thing game-related.

  82. The index has started or continued lower from breaks above the upper trend line many times in September and or October.
    Although chart formations are making it seem somewhat more possible a drop that reaches crash proportions could be
    seen, it still seems somewhat remote at this time.
    Does the BLS really think value shoppers would buy filet mignon at $17.

  83. Hence the launch of this device has given the users an opportunity of taking these amazing
    features like the hot cakes. The camera also has some basic features, such as- Video-calling, geo-tagging, face, smile detection, etc.
    Cellular phones certainly are a revolutionary piece of engineering which has created snail mail pretty much
    obsolete and is creating property telephones a factor in the previous.

  84. P?ste follement plaisant

    my web bloog – film hardcore gratuit

  85. helo there ?nd thank you for your info?mation ? I have definitely picked up
    anything neww from right here. I did howeveer expertise several technical issue? using this sit?, since Iexperi?nced to reload the we? site many times previous to I could get it to load properly.
    I had been wondering if your web hosting is O??
    Nott that I am complaining, buut sloww load?ng instances times
    will sometimes afdect your placement in ?oogle and can damage
    your high-quality score if ads and marketing with Adwords.
    Well I’m adding this RSS to my e-mail and could look out for much more
    of yokur respective exciting content. Ensaur? that you updat? this g?in soon.

    My website

  86. Very great post. I just stumbled upon your blog and wanted to say that I have really loved browsing your blog posts.
    In any case I’ll be subscribing to your rss feed and I am hoping you write again very soon!

  87. Hello it’s me, I am also visiting this site on a regular basis, this site
    is truly good and the viewers are actually sharing nice thoughts.

  88. Integrate decor into your layout decision-making course of action. Or use indirect lighting around the perimeter of the ceiling-wall junction. When it comes to 831 Ecotec Plus boilers it produces maximum
    of 24.

    my weblog bathroom wall decorations

  89. For most up-to-date information you have to pay a visit web and on the web I found this web page as
    a finest website for newest updates.

  90. In multiple footage from joyce crawley elegance our homesindividuals dial a schokohrrutige young man a nigger, you best carry it, for those who going to choose a savage result. Holy shit. sam, or perhaps realized a tahitian person? surely rather than, Because if you had you understand they wear just fly off the management any time you are labelled with the help of lingo as disparaging as regarding it,your main one now named, nevertheless it really had us all untamed. they unhappy my lifestyle we

  91. Fastidious answer back in return of this matter
    with genuine arguments and describing the whole thing concerning

  92. I used to be suggested this website by means of my cousin. I am no longer certain whether or not this put up is written by means of him
    as nobody else realize such certain approximately my problem.

    You are amazing! Thank you!

  93. yo

  94. Cual Alquiler Coche Aeropuerto España Remosta Este Espolón Arbitrario

  95. This was really nice to readr. Thanks for this information.

  96. If you opt for a secured credit card, make confident you get
    an updated credit score every month with your statement.

  97. Thanks for sharing your thoughts about linux by example.


  98. Scorching on the heals of Thor comes Justice League Part A single,
    the very first DCEU group-up flick which will see Batman, Superman, Wonder
    Girl, The Flash, Aquaman and Cyborg function with each other to
    battle negative guys.

  99. Hello all, here every one is sharing such know-how, thus it’s pleasant to
    read this website, and I used to go to see this website all the time.

  100. If you want to get a great deal from this paragraph then you
    have to apply these strategies to your won blog.

  101. Im in the beats & instrumental business and one of the things I find is useful to keep ahead of competitors is on-site optimazation. Therefore, this knowledge is much appreciated!

  102. Simply because knowledge is extremely critical to both kids and grownups to
    catch around the world, DAPP Malawi of Humana People to People makes educating achievable.

    Though several countries around the world have already got
    exceptional schooling platforms, many other places and developing nations are afflicted by a significant lack of educat-ed and effectively quali-fied instructors.
    Quite a few countries which are in serious need of skilled teachers.
    DAPP Malawi creates measures to supply teacher training programs within these nations and many others to assist expanding regions strengthen their knowledge program.
    Coaching instructors is usually a main superiority making sure that learners could be taught with the appropriate quality and level with regard to their age range.

    Farmers Club plans can be found at many schools around the globe.

    DAPP Malawi aids to service all of the Humana People to People organizations in supplying the instructing projects at a lot
    of colleg-es. Africa is home to 32 teacher training institutions and India
    contains 22 institutions that offer this course.
    Malawi supplys one school with 2 advanced schooling degree projects while Humana People to People
    go on to aid other third world countries with
    their hunt for advanced schooling. These colleges and many more are
    based on contributions and help from DAPP Malawi.

    While developing nations could have lecturers contained in their classes, they aren’t
    constantly fully-trained capable to offer their students with the material they certainly have to know.
    Through standard learning comprehension to math knowledge and physical education, teacher training projects will offer each teacher valuable information they could fix in the class.

    Dedicated, passionate and prideful are simply a few ways to express the teachers taking benefit of
    the excellent training services.

  103. Hi, I desire to subscribe for this weblog to get newest updates,
    therefore where can i do it please help.

  104. I’ve been exploring for a bit for any high quality articles or blog posts in this sort
    of space . Exploring in Yahoo I ultimately stumbled upon this site.
    Reading this information So i’m happy to exhibit that I have an incredibly just right
    uncanny feeling I found out just what I needed. I most without a doubt will make
    sure to don?t put out of your mind this website and give it a look
    on a constant basis.

  105. In my view, if all site owners and bloggers made good content as you did, the internet will be much more useful than ever before.

  106. I see you don’t monetize your page, don’t waste your traffic, you
    can earn extra cash every month. If you want to read about this
    method, simply search in gooogle: dracko’s tricks

  107. Although an Android app can be made available by developers through their sites, most Android apps are uploaded and published
    on the Android Market, an online shop dedicated to these programs.
    The Android Market includes both free and expensive programs.

    Android apps are written in the Java programming language and utilize Java core libraries.
    They are compiled to Dalvik executables to run on the Dalvik virtual machine, which will be
    a virtual machine especially designed for mobile devices.

  108. nice post, This is the best record that you have given to the public, I am happy and hope that I can make your article as valuable new knowledge for me and all.

Leave a Reply