Validating an xml file dating a tantra
This works great if the XML file follows the same structure for each tag representing a card having a Card tag.
Inside that with the Player tag, the Name, Team, Year and Card Company all within the appropriate level.
To use this tool, I'll copy the contents of my XML file in there and then copy and paste out the XSD file generated. I then recommend downloading the Power Shell Community Extensions module where you'll find the Test-Xml function. You'll then find once you fix the error and make that Mickey Mantle card look like all the others Test-Xml will then return a True value indicating that the XML file does, indeed, match the XSD.
This is a function that easily allows you to compare a XML with with a XSD schema file. This can be a complicated topic so if you'd like to learn more about validating XML files with XSD I highly recommend checking out this w3schools article.
Although plain text, XML isn't just some unstructured mess of data.
It follows a purposeful structure and thus information can be expected to be where you think it is.
Catch up on Adam's articles at adamtheautomator.com, connect on Linked In or follow him on Twitter at @adbertram or the Tech Snips Twitter account @techsnips_io.However, what if I'm inputting a card and make a typo?I've got this awesome new Mickey Mantle rookie card and I can't wait to get it into my inventory and the new Card entry results in something like this: I accidently didn't include the Name tag as a child of the Player tag but rather made the Name tag a child of the Card tag. I try to get all of the player names again but this time I get something that looks like this: That's not right! This could have been prevented if we would have validated the XML file using a XSD file before assigning it to the $Cards value. The schema is the structure of the XML file and how it should laid out.Adam also founded the popular Tech Snips e-learning platform.He mainly focuses on Dev Ops, system management and automation technologies, as well as various cloud platforms mostly in the Microsoft space.