With Xerces-J 2:
$ java sax.Counter -v greeting2.xml greeting2.xml: 701 ms (1 elems, 1 attrs, 0 spaces, 12 chars)
With xmllint/libxml:
$ xmllint --schema greeting.xsd greeting2.xml <?xml version="1.0"?> <GREETING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="greeting.xsd"> Hello XML! </GREETING> greeting2.xml validates