XML Parsing
<?xml version="1.0"?> <poem xmlns="http://www.megginson.com/ns/exp/poetry"> <title>Roses are Red</title> <l>Roses are red,</l> <l>Violets are blue;</l> <l>Sugar is sweet,</l> <l>And I love you.</l> </poem>
com.example.xml
with the implementation you are
using):java
-Dorg.xml.sax.driver=com.example.xml.SAXDriver MySAXApp
roses.xml
Start document Start element: {http://www.megginson.com/ns/exp/poetry}poem Characters: "\n" Start element: {http://www.megginson.com/ns/exp/poetry}title Characters: "Roses are Red" End element: {http://www.megginson.com/ns/exp/poetry}title Characters: "\n" Start element: {http://www.megginson.com/ns/exp/poetry}l Characters: "Roses are red," End element: {http://www.megginson.com/ns/exp/poetry}l Characters: "\n" Start element: {http://www.megginson.com/ns/exp/poetry}l Characters: "Violets are blue;" End element: {http://www.megginson.com/ns/exp/poetry}l Characters: "\n" Start element: {http://www.megginson.com/ns/exp/poetry}l Characters: "Sugar is sweet," End element: {http://www.megginson.com/ns/exp/poetry}l Characters: "\n" Start element: {http://www.megginson.com/ns/exp/poetry}l Characters: "And I love you." End element: {http://www.megginson.com/ns/exp/poetry}l Characters: "\n" End element: {http://www.megginson.com/ns/exp/poetry}poem End document
4 of 16