Package org.xml.sax.helpers

Examples of org.xml.sax.helpers.DefaultHandler


    public OrganisationEntry[] listOrganisations() {
        ensureIvyConfigured(getSettings());
        try {
            URL content = new URL(ivyroot + "content.xml");
            final List ret = new ArrayList();
            XMLHelper.parse(content, null, new DefaultHandler() {
                public void startElement(String uri, String localName, String qName,
                        org.xml.sax.Attributes attributes) throws SAXException {
                    if ("organisation".equals(qName)) {
                        String org = attributes.getValue("name");
                        if (org != null) {
View Full Code Here


        assertTrue("XML doesn't contain artifact is-local attribute",
            xml.indexOf(expectedIsLocal) != -1);
        assertTrue("XML doesn't contain the organisation", xml.indexOf(expectedOrg) != -1);

        // check that the XML is valid
        XMLHelper.parse(new ByteArrayInputStream(buffer.toByteArray()), null, new DefaultHandler(),
            null);
    }
View Full Code Here

        // Now create a validating doc builder and set it.
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(true);
        DocumentBuilder builder = factory.newDocumentBuilder();
        builder.setErrorHandler(new DefaultHandler() {
            public void error(SAXParseException ex) throws SAXException
            {
                throw ex;
            }
        });
View Full Code Here

        factory.setNamespaceAware(true);
        SAXParser parser = factory.newSAXParser();
       
        parser.parse(
                    new File("src/test/org/apache/commons/digester/document-with-relative-dtd.xml"),
                    new DefaultHandler());
    }
View Full Code Here

   
  /** Creates a new instance of XmlRecordInput */
  public XmlRecordInput(InputStream in) {
    try{
      valList = new ArrayList<Value>();
      DefaultHandler handler = new XMLParser(valList);
      SAXParserFactory factory = SAXParserFactory.newInstance();
      SAXParser parser = factory.newSAXParser();
      parser.parse(in, handler);
      vLen = valList.size();
      vIdx = 0;
View Full Code Here

                    parameters = (SourceParameters) parameters.clone();
                }
                parameters.setSingleParameterValue("content", content);
                source = SourceUtil.getSource(location, typeParameters,
                                              parameters, resolver);
                SourceUtil.toSAX(source, new DefaultHandler());
            }
        } catch (SourceException se) {
            throw SourceUtil.handle(se);
        } catch (IOException ce) {
            throw new ProcessingException(ce);
View Full Code Here

    * @return DOCUMENT_ME
    */
   public static TopicSpace parse( InputStream is )
   {
      // Use an instance of ourselves as the SAX event handler
      DefaultHandler handler = new TopicSpaceParser(  );

      // Parse the input with the default (non-validating) parser
      stack = new java.util.Stack(  );
      try
      {
View Full Code Here

                }

                SAXParserFactory factory = SAXParserFactory.newInstance();
                try {
                    SAXParser saxParser = factory.newSAXParser();
                    saxParser.parse( dest, new DefaultHandler() );
                } catch (IOException e) {
                    e.toString();
                    throw new BuildException(e, getLocation());
                } catch (ParserConfigurationException e) {
                    e.toString();
View Full Code Here

        // Now create a validating doc builder and set it.
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(true);
        DocumentBuilder builder = factory.newDocumentBuilder();
        builder.setErrorHandler(new DefaultHandler() {
            public void error(SAXParseException ex) throws SAXException
            {
                throw ex;
            }
        });
View Full Code Here

        assertEquals(s1, s2);
        Parser parser = tc.getParser("application/vnd.ms-powerpoint");
        Metadata metadata = new Metadata();
        InputStream stream = new FileInputStream(file);
        try {
            parser.parse(stream, new DefaultHandler(), metadata);
        } finally {
            stream.close();
        }
        assertEquals("Sample Powerpoint Slide", metadata.get(Metadata.TITLE));
    }
View Full Code Here

TOP

Related Classes of org.xml.sax.helpers.DefaultHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.