Sax parser problem plz help

hi !!!!!!!!!!!!
Im using a SAX parser to parse an xml file im successful in doing it i got tit parse after parising i want the value of a particular tag for example i have a tag as
<filtername>datasource</filtername>
i want datasource after parsing the xml and without using DOM concept how do i do it please help

hi i have a parser for start parsing and for start element
when im doing this i get the complete xml parsed after the xml is parsed how do i get it i still could not get how to soak the characters .....
private void startParsing()
          try
               InputStream instream = getClass().getClassLoader().getResourceAsStream(contextFile);
               InputSource in = new InputSource(instream);
               SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
               XMLReader reader = parser.getXMLReader();
               reader.setContentHandler(this);
               reader.parse(in);
          catch(ParserConfigurationException pce)
               System.out.println(pce);
          catch(SAXException se)
               System.out.println(se);
          catch(IOException ie)
               System.out.println(ie);
     public void startElement(String uri,String localName,String qName,Attributes attributes)
          System.out.format("uri : %s localName %s qName %s %n",uri,localName,qName);
so now i have an attribut but i need content of the opening and closingtag like
attribute is name
<name>jack</name>
im successfull in getting name but now i want jill ....

Similar Messages

  • SAX parser problem in JDK1.5

    I have parse the xml file using SAX in jdk1.5 environment. During the parsing, it missed the some text content.
    for example
    <employeeid>
    <empid>1001</empid>
    <empid>1002</empid>
    </employeeid>
    If i have parse the above xml file using SAX in jdk1.5 environment. The output is
    1001
    100
    during the parsing , SAX parser misses digit of 2.
    if i have parse the above xml file using SAX in jdk1.4 environment , it is working fine.
    what is the problem in jdk1.5
    please help
    bala

    What I expect the problem to be was discussed recently in a topic titled "SAX Parser Problems" that was started on March 14 at 6:59 AM by JackoBS.
    Read that and see if it fixes your problem. If so, it is not a JDK1.5 problem, but a user error.
    Dave Patterson

  • Audio Clip problem plz help..

    There is some problem with my code. It is actually for simply playing a wav file.
    It gives errors on two lines....
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.*;
    public class MediaPlayerDemo extends JFrame
         AudioClip clip; //Error Here
         public MediaPlayerDemo(String title)
              super(title);
         clip = getAudioClip(getCodeBase(),"access.wav"); //Error Here
         clip.loop();
         public static void main(String args[])
              MediaPlayerDemo m = new MediaPlayerDemo("Title");
              m.setSize(400,400);
              m.setVisible(true);
    }

    "Audio Clip problem plz help"
    You have to learn to help yourself.
    Have you done anything to try to fix the errors yourself?
    AudioClip clip; //Error Here
    the error generated here is self-explanatory.
    if you can't fix this, you should get a good book on java basics and start again.
    the other error is also easy to fix.

  • Classpath problem plz help me

    hi!
    i am unable to run my RMI server program .Name of My server class is SumServer.java,it implements SumInterface.java all the files(.class,.java and stub) are at location c:\javaprog\rmi\sum.
    I have not put them in any package.
    value of classpath is
    classpath=c:\jdk1.4\lib;.;c:\javaprog\rmi\sum
    i go in sum folder and run the program
    c:\javaprog\rmi\sum > SumServer
    it gives me following exception.plz help me out.
    Thx in advance.
    Exception occur.Unable to register serverjava.rmi.ServerException: RemoteExcepti
    on occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
    java.lang.ClassNotFoundException: SumServer_Stub

    Deepa lakshmi wrote:
    Hi,
    Am new to weblogic.
    Am using the tools are,
    Weblogic8.1 version
    MySql5.0,mysql-connector-java-3.1.12-bin.jar file
    While test configuration of connection pooling am getting the error is "JDBC Driver is not on the classpath".
    How can i solve this problem
    plz help me
    regards
    DeepaEdit the start-weblogic script. Near the bottom, you will see
    lines that create a CLASSPATH for the weblogic server. Add a
    script line that adds the mysql driver to the classpath there.
    Joe

  • SAX parsing problem

    Thanks for reading this msg!
    I am using SAX parsing XML , everthing is looks OK but only one I don't get it, one element out put is being splited but all other no problem even same data...
    XML element :
    <item> RO(contains 160 FT)</item>
    after parsing the data is like this: 'RO(c', 'ontains 160 FT)'
    Thanks for your help!

    This is a FAQ, search the forums or look at the API documentation
    http://java.sun.com/j2se/1.4.2/docs/api/org/xml/sax/ContentHandler.html#characters(char[],%20int,%20int)
    Pete

  • Sax parser problem

    hi,
    i am assuming the problem is with sax parser but i cant be sure. I am parsing a xml file (about 1.4MB) with some data in it. the parser i have created reads the xml file correctly for the most part but when at some point the
    "public void characters(char buf[], int offset, int len) throws SAXException"
    function stops working correctly....i.e it doesnt fully read read the data between the "<start>" and "</start>" element. say it reads about 100 id's correctly---for 101 ID it does this. This is just an example. Since, the problem might be with how :
    "public void characters(char buf[], int offset, int len) throws SAXException"
    function is reading the data i was wondering if anybody else had encountered this problem or please let me know if i need to change something in the code: here's a part of the code :
    Bascially i have created three classes to enter data into three mysql tables and as i parse the data i fill up the columns by matching the column header with the tagName.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.*;
    import java.io.*;
    import java.util.ArrayList;
    import java.lang.Object;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import java.util.*;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    public class Echo03 extends DefaultHandler
    StringBuffer textBuffer;
    int issuedValue, prodValue;
    OrdHeader header = new OrdHeader();
    OrdDetail detail = new OrdDetail();
    Member memInfo = new Member();
    //new addition to store the dynamic value of the products
    TestOrdheader prod = new TestOrdheader();
    int counter;
    String tag, newTag;
    SetValue setVal = new SetValue();
    String test;
    public static void main(String argv[])
    if (argv.length != 1) {
    System.err.println("Usage: cmd filename");
    System.exit(1);
    // Use an instance of ourselves as the SAX event handler
    DefaultHandler handler = new Echo03();
    // Use the default (non-validating) parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
    // Set up output stream
    out = new OutputStreamWriter(System.out, "UTF8");
    // Parse the input
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse( new File(argv[0]), handler);
    } catch (Throwable t) {
    t.printStackTrace();
    System.exit(0);
    static private Writer out;
    private String indentString = " "; // Amount to indent
    private int indentLevel = 0;
    //===========================================================
    // SAX DocumentHandler methods
    //===========================================================
    public void startDocument()
    throws SAXException
    nl();
    nl();
    emit("START DOCUMENT");
    nl();
    emit("<?xml version='1.0' encoding='UTF-8'?>");
    header.assign();
    public void endDocument()
    throws SAXException
    nl(); emit("END DOCUMENT");
    try {
    nl();
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    public void startElement(String namespaceURI,
    String lName, // local name
    String qName, // qualified name
    Attributes attrs)
    throws SAXException
    indentLevel++;
    nl(); //emit("ELEMENT: ");
    String eName = lName; // element name
    if ("".equals(eName)) eName = qName; // namespaceAware = false
    if (qName.equals("Billing")){
    issuedValue = 1;
    }else if (qName.equals("Shipping")){
    issuedValue = 2;
    }else if (qName.equals("ShippingTotal")){
    issuedValue = 3;
    //check to see if "Product" is the name of the element thats coming next
    if (qName.equals("Product")){
    if (issuedValue != 3){
    prodValue = 1;
    prod.addCounter();
    }else{
    prodValue = 0;
    tag = eName;
    if (attrs != null) {
    for (int i = 0; i < attrs.getLength(); i++) {
    String aName = attrs.getLocalName(i); // Attr name
    if ("".equals(aName)) aName = attrs.getQName(i);
    nl();
    emit(" ATTR: ");
    emit(aName);
    emit("\t\"");
    emit(attrs.getValue(i));
    emit("\"");
    if (attrs.getLength() > 0) nl();
    public void endElement(String namespaceURI,
    String sName, // simple name
    String qName // qualified name
    throws SAXException
    nl();
    String eName = sName; // element name
    if ("".equals(eName)){
    eName = qName; // not namespaceAware
    if ("Order".equals(eName)){          
    //enter into database
         databaseEnter();
    textBuffer = null;
    indentLevel--;
    public void characters(char buf[], int offset, int len)
    throws SAXException
    nl();
    try {
    String s = new String(buf, offset, len);
    if (!s.trim().equals("")){
    settag(tag, s);
    s = null;
    }catch (NullPointerException E){
    System.out.println("Null pointer Exception:"+E);
    //===========================================================
    // Utility Methods ...
    //===========================================================
    // Wrap I/O exceptions in SAX exceptions, to
    // suit handler signature requirements
    private void emit(String s)
    throws SAXException
    try {
    out.write(s);
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    // Start a new line
    // and indent the next line appropriately
    private void nl()
    throws SAXException
    String lineEnd = System.getProperty("line.separator");
    try {
    out.write(lineEnd);
    for (int i=0; i < indentLevel; i++) out.write(indentString);
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    ===================================================================
    ///User defined methods
    ===================================================================
    private String strsplit(String splitstr){
    String delimiter = new String("=");
    String[] value = splitstr.split(delimiter);
    value[1] = value[1].replace(':', ' ');
    return value[1];
    public void settag(String tag, String s){         
    String pp_transid = null, pp_respmsg = null,pp_authid = null, pp_avs = null, pp_avszip = null;
    if ((tag.equals("OrderDate")) || (tag.equals("OrderProcessingInfo"))){
    if (tag.equals("OrderDate")){
    StringTokenizer st = new StringTokenizer(s);
    String orddate = st.nextToken();
    String ordtime = st.nextToken();
    header.put("ordDate", orddate);
    header.put("ordTime", ordtime);
    }else if (tag.equals("OrderProcessingInfo")){
    StringTokenizer st1 = new StringTokenizer(s);
    int tokenCount = 1;
    while (tokenCount <= st1.countTokens()){
    switch(tokenCount){
    case 1:
    String extra = st1.nextToken();
    break;
    case 2:
    String Opp_transid = st1.nextToken();
    pp_transid = strsplit(Opp_transid);
    break;
    case 3:
    String Opp_respmsg = st1.nextToken();
    pp_respmsg = strsplit(Opp_respmsg);
    break;
    case 4:
    String Opp_authid = st1.nextToken();
    pp_authid = strsplit(Opp_authid);
    break;
    case 5:
    String Opp_avs = st1.nextToken();
    pp_avs = strsplit(Opp_avs);
    break;
    case 6:
    String Opp_avszip = st1.nextToken();
    pp_avszip = strsplit(Opp_avszip);
    break;
    tokenCount++;
    header.put("pp_transid", pp_transid);
    header.put("pp_respmsg", pp_respmsg);
    header.put("pp_authid", pp_authid);
    header.put("pp_avs", pp_avs);
    header.put("pp_avszip", pp_avszip);
    }else{
    newTag = new String(setVal.set_name(tag, issuedValue));
    header.put(newTag, s);
    //detail.put(newTag, s);
    prod.put(newTag, s);
    memInfo.put(newTag,s);
    //Check to see-- if we should add this product to the database or not
    boolean check = prod.checkValid(newTag, prodValue);
    if (check){
    prod.addValues(s);
    setVal.clearMod();
    ==================================================================
    Here's the error that i get:
    java.util.NoSuchElementException
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:691)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
    at Echo03.main(Echo03.java:47)

    I haven't gone through your code but I also had a similar error....and the exception in my was because of an "&" instead of the entity reference & in one of the element values. I use a non-validating parser but if you use a validating one then this might not be the reason for your exception.

  • Problem PLZ Help me

    Hi Guys,
    I have a problem to make a developer application Client/Server.
    When i install forms Runtime on the Client`s computer and i open the application, i get the error that he can`t find the menu and the libraries.
    The menu path is for example on my computer F:\s3\Salesmenu
    But on the client it can be a different path an then he can`t find the menu.
    Now the properties for the main form are:
    Menu module f:\s3\Salesmenu
    Initial menu Salemenu
    Does anyone know how to fix this problem for example:
    1) by let the program search for the menu.
    2) .....
    Plz Help
    Vincent

    set your FORMS60_PATH on the client to Formspath;libpath;menupath so it looks in every dir named in the path.

  • Big Problem, PLZ HELP

    So, when i click on the itunes shortcut, which has the same icon as the Apple Software Updater, I get a box that says that iTunes has encountered a problem and needs to close. We are sorry for the inconvenience. I hit send once and sent the error report, and then restarted my computer to see if that would help. It didnt, so, now i cant access itunes this is a major problem cause i have all my songs on this computer. I also tried to plug in my ipod and see if that would make it load.
    I installed iTunes 7.0 on my laptop, the exact same way, and i works on my laptop, but not on my computer.
    PLZ HELP ME

    ok this is what i did when that happened to me. i uninstalled quicktime then went here: http://www.apple.com/quicktime/win.html and reinstalled the latest version :0)

  • Nokia n79 problem Plz Help!

    Hello!My nokia just stuck,or hang in(i dont now english good) but i cant do enything.Evry button just dont work only at start when i write my pi(and somethimes then too).Works only power button.Its weard.Plz help.Somethimes a whole day are no problems somhetimes a whol day.

    hey ivee n everyone else .. i'm facing the same problem.. n i need to fix this problem myself..
    my n79 gets hang constantly nowadays.. i've used this phone for 1 year plus now so warranty's no more..... none of the buttons on the keypad works when it gets hang.. onli the power button is functioning.. now it's gettin worse .. it even hangs before i insert my pincode... i cant sms, call , or anything.. it hangs after i pressed a few buttons..
    so ivee u've fixed ur n79 youself right..? umm.. can u explain to me wat a smallboard is? is that the board at the lower part of the keypad where u can see buttons underneath the white layer? and is that board expensive?
    pls reply asap anyone.. urgent

  • N79 hanging problem plz help....

    while unlocking the keypad of my n79 sometimes the phone gets hanged then i have to take the battery out and then again switch on the phone........plz help me how to get rid of this problem???

    I have also same problem with my Nokia N79, I just cancelled sensor for automatic themes from cover. Just open back cover & stick some paper or plastic cello tape on four hole marks of covers wich r sensor for automatic themes to change colour of back cover same as theme colour. From 2 days I feel my mobile working fine without hanging ! so try it, all the best.

  • Bluetooth connection problem plz help...

    hi everyone, just bought a new pearl 9105. everything works fine and even bluetooth... through which i can transfer data from blackberry to other mobiles(samsung,sony ericsson)... but the problem is i could not recieve data from other mobiles.i should get contacts list from the other mobiles... but due to this problem i couldnt. plz help me out..

    The best way to receive a file from another device via bluetooth is to go to Media, then press Menu, choose Receive Using Bluetooth, waiting for connection will be display, then send from the other device. It should work without hassle.

  • Applet problem plz HELP

    Hi all,
    I have a problem when I am trying to run a jar file from an applet. The jar is for remote desktop application. Jrdp.jar.
    And the Exception is���.
    Exception in thread "Thread-6" java.security.AccessControlException: access denied (java.util.PropertyPermission gnu.posixly_correct read)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
    at java.lang.System.getProperty(Unknown Source)
    at gnu.getopt.Getopt.<init>(Getopt.java:617)
    at gnu.getopt.Getopt.<init>(Getopt.java:581)
    at net.propero.rdp.Rdesktop.main(Rdesktop.java:290)
    at net.propero.rdp.applet.RdpThread.run(RdpApplet.java:190)
    can any one suggest me what I have to do???? Plz give your valuable suggestion in that matter. Should I have to do any thing in java.policy file. In that case what would be the syntax and what have allow. If possible plz help me out.
    Thanking you,
    With regards
    Shibaji Sabyal

    Try googling on how to sign your applet. The error you're getting can usually be solved by signing it.

  • Package Problem : Plz help

    I've make two classes named First.java and Second.java in e:\javafiles\test\vg folder
    package vg;
    public class First
              public int m = 100;
              public int n = 200;
    package vg;
    public class Second
              public static void me0()
                   System.out.println("Stupid cant u see the value of m is zero");
              public static void mgrn()
                   System.out.println("Yaar m is greater than n");
              public static void neven()
                   System.out.println("The value of n is Even");
    and a Third class
    import vg.*;
    public class Last
              public static void main(String robert[])
                   Second d = new Second();
                   First f = new First();
                   if(f.m==0)
                        d.me0();
                   if(f.m>f.n)
                        d.mgrn();
                   if((f.n%2)==0)
                        d.neven();
                   else
                        System.out.println("The value of n is Odd");
    Now the problem is that if I put the Last.java at e:\javafiles\test and compile it , it works fine but if I put the Last.java anywhere else e.g at e:\javafiles and try to compile it it does not works and gives error
    E:\JavaFiles>javac Last.java
    Last.java:1: package vg does not exist
    import vg.*;
    even if I change classapth variable as E:\javafiles\test or even E:\javafiles\test\vg
    plz help me in this regard

    You need to change where it is trying to find the 'vg' package. So, if your Last.java is in e:\javafiles, then you need to
    import test.vg.*
    e.g.
    import test.vg.*;           // Change this line
    public class Last
              public static void main(String robert[])
                   Second d = new Second();
                   First f = new First();
                   if(f.m==0)
                        d.me0();
                   if(f.m>f.n)
                        d.mgrn();
                   if((f.n%2)==0)
                        d.neven();
                   else
                        System.out.println("The value of n is Odd");
    Alan

  • N95 maps problem plz help me

    please any body can solve my problem?
    i have n95
    when i open gps application
    then on the screen globe is not showning and no maps are showing on screen
    only city names are showed
    and after the closing of map application in apst there are type on screen
    saving maps and data
    but now nothing typed
    plz help me

    i am using latest firm ware
    and using old maps application bcoz new beta 2.0 not showing my accurate position in pakistan
    if i am in my city
    the maps application shows u r 10 km from your city
    but old version give me accurate position...

  • Storing emails offline in database problem plz help me

    hello friends all .
    i wana store all the emails which i get from INBOX folder in database i am using Microsoft Access 2000 for it the below code get all the mails from INBOX and are stored in Array now plz some one help and send a code to store each field of message in data base..
    my database table name is mails
    Fields name -------------------Data Type
    mailid ----------------------- Autonumber
    from -------------------------- Text max length 255 chars (avaliable)
    to ---------------------------- Text max length 255 chars (avaliable)
    bcc --------------------------- Text max length 255 chars (avaliable)
    cc ---------------------------- Text max length 255 chars (avaliable)
    subject ------------------------ Text max length 255 chars (avaliable)
    attachments -------------------- Text max length 255 chars (avaliable)
    now what i want is to store the path of attachments store in directory
    Properties props = new Properties();
    String host = pop3.getText ();
    String provider = "pop3";
    try {
    Session session = Session.getDefaultInstance (props,
    new MailAuthenticator());
    Store store = session.getStore (provider);
    store.connect (host,null,null);
    Folder inbox = store.getFolder ("INBOX");
    if (inbox== null){
    System.out.println ("no inbox");
    inbox.open (Folder.READ_ONLY);
    Message[] messages= inbox.getMessages ();
    for (int i =0 ; i<messages.length;i++){
    messages.writeTo(System.out)
    // what should i do here to store each message in database plz help me
    inbox.close (false);
    store.close ();
    catch(Exception ep){
    ep.printStackTrace();
    i'll be very thankfull plz help i try my best but didnt get success plz plz ! send a working code which i can learn and implement or send any file which do this work so that i can get help .
    thank you

    Unfortunately what you are trying to do is a little more complicated than just posting some code.
    To get the message content and any attachments you need to "parse" the MIME message you get from the store. An email will (should) be a multipart mime construct. You need to get all the "Parts" out of the message and put them into your relevant database fields.
    The "header" elements can be obtained just using the methods of the Message objects you are getting back. Have a look at the javadoc for the javax.mail.Message abstract class.
    As for example code, here's some old code I had lying around which parses a multipart message to get the various parts.
    There is a sample "main" method which should explain how it works:
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.io.*;
    * <p>Title: </p>
    * <p>Description: Parses a mime message to get the relevant parts.<BR>
    * <p>Copyright: Copyright (c) 2002</p>
    * @author Jason Polites
    * @version 1.0
    public class MimeMessageParser {
       * Gets the parts from the MimeMessage
       * Use null contentType to ignore
       * Use null disposition to ignore
      public static void getParts(List parts, Part p, String contentType, String disposition)
          throws MessagingException, IOException
        Object content = p.getContent();
        String currentDisposition = p.getDisposition();
        String currentContentType = p.getContentType();
        // now we need to check if the part was a multipart...
        if(content instanceof Multipart)
          Multipart mp = (Multipart)content;
          // Now we need to delve into the parts
          for(int i=0;i<mp.getCount();i++)
            getParts(parts, mp.getBodyPart(i), contentType, disposition);
        // check to the contentType
        if(contentType == null) {
          // we don't need to check
          if(disposition == null) {
            // no need to check
            // add the part
            parts.add(p);
            //index++;
          else if(currentDisposition != null && currentDisposition.startsWith(disposition))
            // add the part
            parts.add(p);
        else if(p.isMimeType(contentType)) {
          // Check the disposition
          if(disposition == null) {
            // no need to check
            // add the part
            parts.add(p);
          else if(currentDisposition != null && currentDisposition.startsWith(disposition))
            // add the part
            parts.add(p);
       * Gets the parts which match any of the dispositions
       * @param parts
       * @param contentTypes
       * @param disposition
       * @return
      public static List getMultiplePartsFromList(List parts, String contentType, String[] dispositions)
          throws IOException, MessagingException
        List matchedParts = null;
        for(int i = 0; i < dispositions.length; i++) {
          if(matchedParts == null) {
            matchedParts = getPartsFromList(parts, contentType, dispositions);
    else
    matchedParts.addAll(getPartsFromList(parts, contentType, dispositions[i]));
    return matchedParts;
    public static List getPartsFromList(List parts, String contentType, String disposition)
    throws MessagingException, IOException
    LinkedList matchedParts = new LinkedList();
    Part p = null;
    Object content = null;
    String currentDisposition = null;
    String currentContentType = null;
    for(int i = 0; i < parts.size(); i++) {
    p = (Part)parts.get(i);
    content = p.getContent();
    currentDisposition = p.getDisposition();
    currentContentType = p.getContentType();
    if(contentType == null) {
    // we don't need to check
    if(disposition == null) {
    // no need to check
    matchedParts.add(p);
    else if(currentDisposition != null && currentDisposition.startsWith(disposition))
    matchedParts.add(p);
    else if(p.isMimeType(contentType)) {
    // Check the disposition
    if(disposition == null) {
    // no need to check
    matchedParts.add(p);
    else if(currentDisposition != null && currentDisposition.startsWith(disposition))
    matchedParts.add(p);
    return matchedParts;
    public static void main(String[] args) {
    try {
    File email = new File("C:\\test.eml");
    InputStream source = null;
    MimeMessage message = null;
    MimeMessageParser parser = null;
    parser = new MimeMessageParser();
    // First, construct an inputstream for the message file
    source = new FileInputStream(email);
    String host = "localhost";
    boolean sessionDebug = false;
    // Create some properties and get the default Session.
    Properties props = System.getProperties();
    props.put("mail.host", host);
    props.put("mail.transport.protocol", "smtp");
    Session mailSession = Session.getDefaultInstance(props, null);
    // Set debug on the Session so we can see what is going on
    // Passing false will not echo debug info, and passing true
    // will.
    mailSession.setDebug(sessionDebug);
    message = new MimeMessage(mailSession, source);
    // parse the message...
    LinkedList parts = new LinkedList();
    MimeMessageParser.getParts(parts, message, null, null);
    Part p;
    Attachment a;
    String[] dispositions = new String[2];
    dispositions[0] = MimeMessage.INLINE;
    dispositions[1] = MimeMessage.ATTACHMENT;
    List attachments = MimeMessageParser.getMultiplePartsFromList(parts, null, dispositions);
    //Just for testing.. print out the parts...
    for(int i = 0; i < attachments.size(); i++) {
    System.out.println("Part " + i + " content type: " + ((Part)attachments.get(i)).getContentType());
    catch (Exception ex) {
    ex.printStackTrace();

Maybe you are looking for

  • Lost all my acheivements in gamecenter, for a particular game.

    I have an iPhone5 and been using it quite a while without any issues. Gamecenter, on the other hand, has been acting weird. On the machine screen of Gamecenter my score is displayed as 12,612, whereas in my friends' list my score is 13, 573. Now, whe

  • Flashing Folder with Question Mark, Disk Utility Grayed Out

    I was working on my macbook pro when it appeared to freeze, so I manually shut it down by pressing the power button. When I pressed it again to restart the computer, the restart "chime" sounded, and a flashing folder with a question mark appeared sho

  • Lighting effects not working, 'Could not apply the workspace because there is not enough memory (RAM)' with 4GB RAM?

    Tried to use 'render/lighting effects' on 5 more or less new different laptops now. All kind of Window versions. They all have at least 4GB RAM. The Graphic Card is compatible. Layer to work on is RGB-Type. It's all about Photoshop CC 2014, trial ver

  • ACR 5 - Support for Custom Camera Profiles

    ACR 4 allows users to select from a list of four device-independent colour spaces (Adobe RGB 1998, ColorMatch RGB, ProPhoto RGB and sRGB). Unlike other RAW processors, it does not allow selection of a custom camera profile. This capability is very us

  • What is the best camcorder?

    I want to buy my dad a new camcorder for Father's Day. Right now, he has a 2-3 year old Canon. The quality isn't very good and in order to watch videos on the television, he has to burn DVDs. He's always looking for the next cool gadget and I wanted