Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1106321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:46:29+00:00 2026-05-17T01:46:29+00:00

Hi everyone this is my first question here and im not a programmer. I

  • 0

Hi everyone this is my first question here and im not a programmer.

I would like to generate a sitemap. I am crawling a website with webcrawler (crawler.dev.java.net).
Is there any way to use a sax parser for the data i get?

I also used jtidy and i got the homepage html data converted in an xml file.

im very confused there are so many sax parsers, idont know the difference between them and which one to choose.

I want to have access to the attributes of html tags and i cant do that with webcrawler or i dont know how to do it

Whats the difference between org.xml.sax and all the other packages?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:46:29+00:00Added an answer on May 17, 2026 at 1:46 am

    Java provides a standard way of interacting with SAX parsers through JAXP (see code below). To switch between SAX parsers typically you just need to add the parser jar to your class path the code stays the same.

    You can do sax parsing as follows:

    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    
    import org.xml.sax.Attributes;
    import org.xml.sax.ContentHandler;
    import org.xml.sax.Locator;
    import org.xml.sax.SAXException;
    import org.xml.sax.XMLReader;
    
    public class Demo {
    
        public static void main(String[] args) throws Exception {
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();
            XMLReader xmlReader = sp.getXMLReader();
            xmlReader.setContentHandler(new MyContentHandler());
            xmlReader.parse(input);
    
        }
    
        private static class MyContentHandler implements ContentHandler {
    
            public void setDocumentLocator(Locator locator) {
            }
    
            public void startDocument() throws SAXException {
            }
    
            public void endDocument() throws SAXException {
            }
    
            public void startPrefixMapping(String prefix, String uri)
                    throws SAXException {
            }
    
            public void endPrefixMapping(String prefix) throws SAXException {
            }
    
            public void startElement(String uri, String localName, String qName,
                    Attributes atts) throws SAXException {
            }
    
            public void endElement(String uri, String localName, String qName)
                    throws SAXException {
            }
    
            public void characters(char[] ch, int start, int length)
                    throws SAXException {
            }
    
            public void ignorableWhitespace(char[] ch, int start, int length)
                    throws SAXException {
            }
    
            public void processingInstruction(String target, String data)
                    throws SAXException {
            }
    
            public void skippedEntity(String name) throws SAXException {
            }
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings everyone. This is my first question here at stackoverflow so please bear with
This is my first question. Thanks to everyone who contributes to this site, it's
First, I would to thank everyone for all the help they provide via this
This is not a programming question per se, but here it goes. I am
This is part observation, part question. First the observation: While everyone talks of modular
This question can have different answers because everyone would do it his own way.
Hi to everyone this is my first ask on stackoverflow I've created a simple
Hello everyone I am a newbie to php and this is my first ever
Sorry in advance everyone for this question as I know the cascading select boxes
Hello everyone don't know why this code works on windows but not on linux

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.