Import project from XML05.zip to Eclipse. Look at examples in
pl.mimuw.xml.rooms
package. Run them on example file rooms1.xml.
Program DOMFormatter prints out a given document (element tags and text nodes only, we do not handle special characters, etc.).
String.trim
The following lines of code turn validation against XML Schema on.
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(new StreamSource("school.xsd")); factory.setSchema(schema); DocumentBuilder db = factory.newDocumentBuilder();
projector
to false
, to true
and run the program each time.ErrorHandler
and setErrorHandler
to register it before parsing.The following line of code makes the parser namespace aware.
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder db = factory.newDocumentBuilder();
Basing on CountSeats_DOM_Specialized create a program that...