Getting That MESS Cleaned Up!
In an earlier post, we learned about xmllint. Today, I want to talk about cleaning up the code for an HTML file.
When we have an xml file, xmllint is used. For an html file, we use the following command in the command line:
When we have an xml file, xmllint is used. For an html file, we use the following command in the command line:
xmllint --html <filename goes here>
Here is an actual command on my command line for running xmllint for my StedmanLesson10.html file.
In the photo above, you see that I start off the command with xmllint.
The next thing is a space and then a --html. The two -- are two hyphen-minus characters that are used to specify long options (Basically there are options that can be used within xmllint. The two hyphen-minus characters are saying an option is going to be used. In this case, that option will be html - because we are going to do an xmllint on an html file).
After that you see a space and then the name of the html file I want the xmllint to be done on.
The outcome of this command can be seen below:
NOTICE in the picture above, that the top line is the command I inputed and the lines following are the xmllint parsings of my file. You are able to see that there were no errors found in the xmllint of my html file and that my html code is shown on the command line.
BUT WAIT...
What if you want to just parse (analyze a string of symbols) a certain tag within the html file?
Let's say, for example, you only just wanted to see all of the <span> tags within the html file... how would you do that?
For that answer, you need to see my post on XPATH And XPATH Expressions. 😊
Follow me as I learn to build my website bit by bit! IronTreeDev.com |
Photo by The Creative Exchange on Unsplash
Comments
Post a Comment