I am new to shell scripting.
Requirement:
I want to check if the XML is well formed or not. I don't have a schema or something to validate it against. I just want to check that it's well formed.
Ex of correct XML for me:
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
Incorrect XML for me:
<heading>Reminder</head>
<body>Don't forget me this weekend!</>
What I have tried so far:
I wrote a shell script command
xmllint --valid filename.xml // replaced the filename.xml with my file.
Error I am getting:
valid_xml.xml:2: validity error : Validation failed: no DTD found !
The XML which I used for which I am getting error:
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>