Java XML and podcasts

Hi all,,
Im just looking for some help with a java xml passer program. Im trying to create a program that will read specific tags and the values that are represented by these tags in the xml file..I have found the following code
import java.io.File;
import org.w3c.dom.Document;
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
public class ReadAndPrintXMLFile{
public static void main (String argv []){
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse (new File("book.xml"));
// normalize text representation
doc.getDocumentElement ().normalize ();
System.out.println ("Root element of the doc is " + doc.getDocumentElement().getNodeName());
NodeList listOfPersons = doc.getElementsByTagName("person");
int totalPersons = listOfPersons.getLength();
System.out.println("Total no of people : " + totalPersons);
for(int s=0; s<listOfPersons.getLength() ; s++){
Node firstPersonNode = listOfPersons.item(s);
if(firstPersonNode.getNodeType() == Node.ELEMENT_NODE){
Element firstPersonElement = (Element)firstPersonNode;
NodeList firstNameList = firstPersonElement.getElementsByTagName("first");
Element firstNameElement = (Element)firstNameList.item(0);
NodeList textFNList = firstNameElement.getChildNodes();
System.out.println("First Name : " + ((Node)textFNList.item(0)).getNodeValue().trim());
NodeList lastNameList = firstPersonElement.getElementsByTagName("last");
Element lastNameElement = (Element)lastNameList.item(0);
NodeList textLNList = lastNameElement.getChildNodes();
System.out.println("Last Name : " + ((Node)textLNList.item(0)).getNodeValue().trim());
NodeList ageList = firstPersonElement.getElementsByTagName("age");
Element ageElement = (Element)ageList.item(0);
NodeList textAgeList = ageElement.getChildNodes();
System.out.println("Age : " + ((Node)textAgeList.item(0)).getNodeValue().trim());
}//end of if clause
}//end of for loop with s var
}catch (SAXParseException err) {
System.out.println ("** Parsing error" + ", line " + err.getLineNumber () + ", uri " + err.getSystemId ());
System.out.println(" " + err.getMessage ());
}catch (SAXException e) {
Exception x = e.getException ();
((x == null) ? e : x).printStackTrace ();
}catch (Throwable t) {
t.printStackTrace ();
//System.exit (0);
}//end of main
}Im trying to develop this code to work with podcast xml files..Im having a few issuses with this program.. Is there anyone out there that has created a program like this that works with podcast xml files??
Anyone got any suggestions.Please.

XML and XSL transformations can be done using most languages and in Java there is strong support for these techniques.
It worries me a little bit that you ask this question though. XML and XSL are no more than a tool to solve SOME problems, but I get the idea that you want to put them on your resume as if they are your main talent. The tool set of the developer is much broader than just some techniques to format and transform data, you need to be able to solve problems in the most efficient way possible, not limiting yourself to only a handful of techniques that you just happen to know a lot about.
What I am trying to say is: it is always good to have knowledge of these techniques, but don't go thinking it is going to guarantee you a job.

Similar Messages

  • Can anyone tell me the difference between the rss.xml and podcast.xml?

    I have the Podcast maker program. Can anyone tell me the difference between the rss.xml and podcast.xml? How do they differ? What do I use each of them for? Where should I put them in my directory?

    Podcast Maker sets up your podcast from media files you enter into it; you enter the summary and description. It then publishes to your iDisk or other server, and in the process created the podcast.xml file which you can submit to iTunes.
    It doesn't create an rss.xml file: it sounds as if you are also creating the podcast in iWeb, which does. This has the advantage of creating a web page; it will also create the rss.xml file.
    Both are valid - of course if there are any differences between the version in Podcast Maker and the version in iWeb then the xml files will be different. But basically you seem to be creating two versions of the same podcast - if you are making it in iWeb then the Podcast maker version is really redundant (though I prefer it for podcast creation). If you want to go on using both I should use the podcast.xml feed it creates.

  • Differnce between java script xml dom and Java Xml dom

    Hi,
    In my application For client side in Java Script for craetion of DOM MIcrosoft Activex object is used. USing that one they are buiidng DOM. And they are saving as XML. In server side i have to write one servlet which will parse that xml and i have to store in dynamic arrays.Which API is better for parsing XML in java.In util pacakge which class is better for storing dynamical values that means MAP,Hash Map,Hash table ??

    in java, the java..xml.parsers package is generally used for parsing xml into a DOM. there are also sax and stax parsers available.
    which class in java.util is better for storing stuff depends on what you need to do with the stuff. find a nice tutorial on java collections and then decide which one makes sense for what you need.

  • RSS XML Files for a Blog and Podcast on Same Website With iTunes Feed

    Does iWeb support both a separate blog and podcast on the same website feeding the Podcast to iTunes? I got my podcast going on iTunes, then it stopped working after I changed the iTunes podcast name in iWeb and didn't edit the xml file. My podcast is gone on iTunes and I can't get the xml files correct for the blog or the podcast. I'm submitting the correct URL to iTunes but iTunes continues generarting 404 errors.

    No answers. Will re-post more clearly

  • Installing BDB XML and including it into a java application

    Hi there :)
    I'm new to BDB XML and I've got some questions about it :
    1/ The documentation says about BDB XML that it is based on BDB. Does it mean that I need to install the standard BDB first to use BDB XML ? (I'm pretty sure I don't have to but I would like a confirmation =))
    2/ I want to developp a web application which will use BDB XML. The documentation says I need to add some jars into my project to use it but do I need to install it on my computer (Windows XP) first ? (with the .msi file ?)
    3/ Where will the xml files be physically stored after I add them into the database ? (what is the default database folder on the hard disk ?)
    Thank you for you help :)
    Regards,
    Gary

    Hi Gary,
    1) You need to install only DB XML. BDB is bundled with DB XML, so you don't have to worry.
    2) Yes, you need to add two jars: db.jar and dbxml.jar. But these jars depend on native DB XML libraries, so you will have to install DB XML anyway: only jars wouldn't be sufficient. Moreover, I would recommend to install DB XML from sources providing the --enable-java+ flag to the buildall.sh script
    3) All XML files will be stored in a container or containers (depending on how many of those you will decide to utilize in your application). It is up to you where you are going to reside DB XML environment/containers -- DB XML is quite low-level XML-database.
    Hope this helps,
    Vyacheslav

  • Question about Java,XSLT and XML

    I am new to Java and XML. I'm not quite clear the relationship between Java,XSLT and XML.
    To exercise, I am going to write a Java program that makes embedded calls to an XSLT processor(XALAN), to produce results for several constrained transformations from a given XML document(x.xml) such as:
    1.Transform the x.xml (which satisfies d1.dtd) in such a way that it now conforms to the DTD d2.dtd. Output the resulting xx.xml document.
    2.query some information from the x.xml and then form an Html output.
    3.summary some information, do some statistics from the x.xml and then form an Html output.
    I don't konw which java classes and XSLT functions might be used.(Actually I don't know how/where to start).
    Can anyone give me some clue ?
    thanks a lot!

    You must provide XSLT stylesheeds to specify transformations (1), (2),
    and (3); let's call those stylesheets task1.xsl and so on.
    The following code will transform x.xml into xx.xml according to task1.xsl. It gives you an idea which packages and classes to use, but it doesn't teach you proper Java programming technics :)
    import java.io.File;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    public class Test
        public static void main(String[] args) throws Exception
            TransformerFactory factory = TransformerFactory.newInstance();
            Source config = new StreamSource(new File("task1.xsl"));
            Transformer transformer = factory.newTransformer(config);
            Source source = new StreamSource(new File("x.xml"));
            Result result = new StreamResult(new File("xx.xml"));
            transformer.transform(source, result);
    }To read about XSLT, see:
    http://www.w3.org/TR/xslt
    there is a tutorial on using XSLT with Java:
    http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/xslt/index.html.

  • What is the best book on XML and SOAP with Java?

    I need to learn xml and soap. Could someone recommend a book or tutorials on the subject. I have just went through teach yourself java in 21 days.
    Thank you
    Noah

    Well using XML is very easy and I can assure you that a simple tutorial can get you on the right track quickly. A quick google search gave me this one, which looks like a good start: [http://totheriver.com/learn/xml/xmltutorial.html|http://totheriver.com/learn/xml/xmltutorial.html]
    As for SOAP, that is a more complex subject. You are looking for JAX-WS (Java API for XML webservices). I suggest checking out amazon.com searching for "java web services". The user reviews should give you a very good idea which book is good and which one stinks.

  • Java, Flash and Xml, not able to getParent of xml files

    Hi,
    I am using Java as a server, with a macromedia flash front end (using flash remoting to connect the two). I am loading in xml files in my java application, and i am having some problems when i run this from flash.
    Whenever i use any getParent methods from the JDOM library on an Element variable i get an error sent back to my flash document.
    But when i run my java code using NetBeans it is fine, the code runs fine and the getParent methods are called fine.
    Is there somthing I need to know about the getParent methods which make them return exceptions ....
    The error says the service threw an exception during method invocation: null
    What does this mean, my method threw an exception in Java ???
    Any help would be much appreciated
    Thanks

    Hi,
    Cheers for your interest. I think the problem is in the way in which I have mounted my JDOM.jar file. Currently I have just placed the JDOM.jar file into the lib folder on my JRun server.
    Does anyone have any ideas on how to mount the JDOM.jar file properly
    Thanks

  • I'd like to load images using XML and Java - hints??

    I have a XML files that are created on a timed basis....they describe a photo and point to a dir where the photo is stored...like...
    <image>
    <user>bill</user>
    <img>photo.jpg</img>
    <img_dir>'/tmp/photos'</img_dir>
    </image>
    I'd like to write a Java program that parses the XML and loads the images, data into Oracle.
    Suggestions on Oracle tools, downloads that will help me accomplish this???
    Thanks!

    I pass a URL and then when I parse the XML I download the file from the URL.
    A.

  • XMl and Java object mapping

    I need to map java objects with XMl Node or XML Elements.
    My java objets get some attributes, for instance name,color ...
    and i need an output like:
    <OBJECT_OF_TYPE_XXX>
    <NAME>scott</NAME>
    <COLOR>red</COLOR>
    </OBJECT_OF_TYPE_XXX>
    Any idea?
    Thanks
    Maurice

    You can try JAXB which includes a compiler that generates classes based on the XML Schema for your xml structure. It also features the possibility to convert between xml and the generated objects.
    Take a look at chapter 9 and 10 at http://java.sun.com/webservices/docs/1.1/tutorial/doc/index.html

  • NEW TO XML AND JAVA

    hi, I'm new to xml, actually I'm taking a course in xml and I should choose a certain project related to xml.
    I want to ask about xml and java
    the things that I know about java is some classes ( I made a program of bouncing ball in java and changed some java game programs). but I need to know how to use java in databases and how to relate it to xml
    Is it too dificult or I can learn it knowing that I'm ready to learn and already I'm learning xml.
    If anyone wants to help me please send me links to some websites where it is simple to learn java .
    Also if any one can give me an example of a certain project that can be done easily using java and xml u'll be more than welcome

    Check the JAVA XML Tutorials provided by the Java Site.

  • New to XML - what can XML and java do thogether - brief examples please

    I am new to XML and relatively new to Java, thought not new to programming. I am still trying to figure out what can XML do for me in practical terms and when I should use it. Thanks for any examples of when to use XML in conjunction with Java.

    xml : Think of it in terms of business solutions, the way you would think of HTML for drawing fun web-pages.
    java : If you know anything about databases you would know you can embed java with sql E.T.C.
    Therefore because of the fast response times and the amount of constant interaction for business purposes you will need a database type that is strong to handle XML, therefore with such new technology you will be able to use xml databases with java too.
    l am sorry : XML Technology is not more simple than that to explain.
    If you are a christian or jew it is like saying to someone explain the bible,the prophets,the old and new testament in one sentence!!!You get it.What one can do is slightly break-up the bible and say there's an old and new testament.The old testament refers to the time before Jesus, AND the new testament refers to After Jesus, THE PROPHETS RELATE MORE TO THE TIME BEFORE Jesus.
    You can then ask me who is jesus???
    And thats a tricky question in its self becuse it depends on one's thinking(concept)
    I HOPE IT HELPS YOU !!!!
    GOD DAY MATE!!

  • Multiple plugtmp-1 plugtmp-2 etc. in local\temp folder stay , crossdomain.xml and other files containing visited websitenames created while private browsing

    OS = Windows 7
    When I visit a site like youtube whith private browsing enabled and with the add-on named "shockwave flash" in firefox add-on list installed and activate the flashplayer by going to a video the following files are created in the folder C:\Users\MyUserName\AppData\Local\Temp\plugtmp-1
    plugin-crossdomain.xml
    plugin-strings-nl_NL-vflLqJ7vu.xlb
    The contents of plugin-crossdomain contain both the "youtube.com" adress as "s.ytimg.com" and is as follows:
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    -<cross-domain-policy> <allow-access-from domain="s.ytimg.com"/> <allow-access-from domain="*.youtube.com"/> </cross-domain-policy>
    The contents of the other file I will spare you cause I think those are less common when I visit other sites but I certainly don't trust the file. The crossdomain.xml I see when I visit most other flashpayer sites as well.
    I've also noticed multiple plugin-crossdomain-1.xml and onwards in numbers, I just clicked a youtube video to test, got 6 of them in my temp plus a file named "plugin-read2" (no more NL file cause I changed my country, don't know how youtube knows where I'm from, but that's another subject, don't like that either). I just noticed one with a different code:
    <?xml version="1.0"?>
    -<cross-domain-policy> <allow-access-from domain="*"/> </cross-domain-policy>
    So I guess this one comprimises my browsing history a bit less since it doesn't contain a webadress. If these files are even meant to be deposited in my local\temp folder. The bigger problem occurs when they stay there even after using private browsing, after clearing history, after clearing internet temporary files, cache, whatever you can think of. Which they do in my case, got more than 50 plugtmp-# folders in the previous mentioned local\temp folder containing all website names I visited in the last months. There are a variety of files in them, mostly ASP and XML, some just say file. I have yet to witness such a duplicate folder creation since I started checking my temp (perhaps when firefox crashes? I'd say I've had about 50 crashes in recent months).
    I started checking my temp because of the following Microsoft Security Essential warnings I received on 23-4-12:
    Exploit:Java/CVE-2010-0840.HE
    containerfile:C:\Users\Username\AppData\Local\Temp\jar_cache2196625541034777730.tmp
    file:C:\Users\Username\AppData\Local\Temp\jar_cache2196625541034777730.tmp->pong/reversi.class
    and...
    Exploit:Java/CVE-2008-5353.ZT
    containerfile:C:\Users\Noname\AppData\Local\Temp\jar_cache1028270176376464057.tmp
    file:C:\Users\Noname\AppData\Local\Temp\jar_cache1028270176376464057.tmp->Testability.class
    Microsoft Security Essentials informed me that these files were quarantained and deleted but when going to my temp file they were still there, I deleted them manually and began the great quest of finding out what the multiple gigabytes of other files and folders were doing in that temp folder and not being deleted with the usual clearing options within firefox (and IE).
    Note that I have set my adobe flasplayer settings to the most private intense I could think of while doing these tests (don't allow data storage for all websites, disable peer-to peer stuff, don't remember exactly anymore, etc.). I found it highly suspicious that i needed to change these settings online on an adobe website, is that correct? When right-clicking a video only limited privacy options are available which is why I tried the website thing.
    After the inital discovery of the java exploit (which was discovered by MSE shortly after I installed and started my first scan with Malwarebytes, which in turn made me suspicious whether I had even downloaded the right malwarebytes, but no indication in the filename if I google it). Malwarebytes found nothing, MSE found nothing after it said it removed the files, yet it didn't remove them, manually scanning these jar_cache files with both malwarevytes and MSE resulted in nothing. Just to be sure, I deleted them anyways like I said earlier. No new jar_cache files have been created, no exploits detected since then. CCleaner has cleaned most of my temp folder, I did the rest, am blocking all cookies (except for now shortly), noscript add-on has been running a while on my firefox (V 3.6.26) to block most javascripts except from sites like youtube. I've had almost the same problem using similar manual solutions a couple of months ago, and a couple of months before that (clearing all the multiple tmp folders, removing or renaming jar_cache manually, running various antmalware software, full scan not finding a thing afterwards, installing extra add-ons to increase my security, this time it's BetterPrivacy which I found through a mozilla firefox https connection, I hope, which showed me nicely how adobe flash was still storing LSO's even after setting all storage settings to 0 kb and such on the adobe website, enabling private browsing in firefox crushed those little trolls, but still plugtmp trolls are being created, help me crush them please, they confuse me when I'm looking for a real threat but I still want to use flash, IE doesn't need those folders and files, or does it store them somewhere else?).
    I'm sorry for the long story and many questions, hope it doesn't scare you away from helping me fight this. I suspect it's people wanting to belong to the hackergroup Anonymous who are doing this to my system and repeating their tricks (or the virus is still there, but I've done many antivirus scans with different programs so no need to suggest that option to me, they don't find it or I run into it after a while again, so far, have not seen jar_cache show up). Obviously, you may focus on the questions pertaining firefox and plugtmp folders, but if you can help me with any information regarding those exploits I would be extremely grateful, I've read alot but there isn't much specific information for checking where it comes from when all the anti-virus scanners don't detect anything anymore and don't block it incoming. I also have downloaded and installed process monitor but it crashes when I try to run it. The first time I tried to run it it lasted the longest, now it crashes after a few seconds, I just saw the number of events run up to almost a million and lots of cpu usage. When it crashed everything returned back to normal, or at least that's what I'm supposed to think I guess. I'll follow up on that one on their forum, but you can tell me if the program is ligit or not (it has a microsoft digital signature, or the name micosoft is used in that signature).

    update:
    I haven't upgraded my firefox yet because of a "TVU Web Player" plugin that isn't supported in the new firefox and I'm using it occasionally, couldn't find an upgrade for it. Most of my other plugins are upgraded in the green (according to mozilla websitechecker):
    Java(TM) Platform SE 6 U31 (green)
    Shockwave for Director (green - from Adobe I think)
    Shockwave Flash (green - why do I even need 2 of these adobe add-ons? can I remove one? I removed everything else i could find except the reader i think, I found AdobeARM and Adobe Acrobat several versions, very confusing with names constantly switching around)
    Java Deployment Toolkit 6.0.310.5 (green, grrr, again a second java, why do they do this stuff, to annoy people who are plagued with java and flash exploits? make it more complicating?)
    Adobe Acrobat (green, great, it's still there, well I guess this is the reader then)
    TVU Web Player for FireFox (grey - mentioned it already)
    Silverlight Plug-In (yellow - hardly use it, I think, unless it's automatic without my knowing, perhaps I watched one stream with it once, I'd like to remove it, but just in case I need it, don't remember why I didn't update, perhaps a conflict, perhaps because I don't use it, or it didn't report a threat like java and doesn't create unwantend and history compromising temp files)
    Google Update (grey - can I remove? what will i lose? don't remember installing it, and if I didn't, why didn't firefox block it?)
    Veetle TV Core (grey)
    Veetle TV Player (grey - using this for watching streams on veetle.com, probably needs the Core, deleted the broadcaster that was there earlier, never chose to install that, can't firefox regulate that when installing different components? or did i just miss that option and assumed I needed when I was installing veetle add-on?)
    Well, that's the list i get when checking on your site, when i use my own browseroptions to check add-ons I get a slightly different and longer list including a few I have already turned off (which also doesn't seem very secure to me, what's the point in using your site then for anything other than updates?), here are the differences in MY list:
    I can see 2 versions of Java(TM) Platform SE 6 U31, (thanks firefox for not being able to copy-paste this)
    one "Classic Java plug-in for Netscape and Mozilla"
    the other is "next generation plug-in for Mozilla browsers".
    I think I'll just turn off the Netscape and Mozilla one, don't trust it, why would I need 2? There I did it, no crashes, screw java :P
    There's also a Mozilla Default plugin listed there, why does firefox list it there without any further information whether I need it or not or whether it really originates from Mozilla firefox? It doesn't even show up when I use your website plugin checker, so is there no easy way by watching this list for me to determin I can skip worrying about it?
    There's also some old ones that I recently deactivated still listed like windows live photo gallery, never remember adding that one either or needing it for anything and as usual, right-clicking and "visit homepage" is greyed out, just as it is for the many java crap add-ons I encountered so far.
    Doing a quick check, the only homepage I can visit is the veetle one. The rest are greyed out. I also have several "Java Console" in my extentions tab, I deactivated all but the one with the highest number. Still no Java Console visible though, even after going to start/search "java", clicking java file and changing the settings there to "show" console instead of "hide" (can't remember exact details).
    There's some other extentions from noscript, TVU webplayer again, ADblock Plus and now also BetterPrivacy (sidenote, a default.LSO remains after cleanup correct? How do I know that one isn't doing anything nasty if it's code has been changed or is being changed? To prevent other LSO's I need to use both private browsing and change all kinds of restrictions online for adobe flashplayer, can anyone say absurd!!! if you think you're infected and want to improve your security? Sorry that rant was against Adobe, but it's really against Anonymous, no offense).

  • Using Java XML 1.5 toolkit instead of sapxmltoolkit for xslt mappings

    Hi All
       We have a case whereby our xlst requires a number of customised java class functions as we are porting webmethods systems across to PI.
    eg in the xslt adding
    <xsl:when test="function-available('java:concat">
        <xsl:value-of select="java:concat($first, $last, $inputparam)"/>
    We are running sap PI 7.1 ehp1. I have been referring to a number of posts on how to complete these tasks.
    namely we have implemented the example as provided in:
        http://help.sap.com/saphelp_nwpi71/helpdata/EN/73/f61eea1741453eb8f794e150067930/frameset.htm
    This only works if "Sap XML Toolkit" is enabled in the operational mapping.
    Left unticked (default setting in the mapping) whenever a testcase is run I end up with the error "could not compile sytle sheet".
    I would like to use the Java 1.5 xml processing capability as it is supposed to perform better than the sapxmltoolkit option and support for the latter will be discontinued in future.
    Has anyone been able run the case with sapxmltoolkit enabled?
    If so did you add any other libraries for java xml 1.5?
    thanks

    Thanks, I would have thought as much, but theres no guide on the deployment.
    For now i assume this will fit into the java/ext area and Pi would need a reboot after the libraries are copied.
    Has anyone deployed the additional libraries to PI.

  • Parsing XML and Storing values in instance variable

    hi,
    i'm new to XML.
    here i'm trying to parse an XML and store their element data to the instance variable.
    in my main method i'm tried to print the instance variable. but it shows "" (ie it print nothing ).
    i know the reason, its becas of the the endElement() event generated and it invokes the characters() and assigns "" to the instance variable.
    my main perspective is to store the element data in instance variable.
    thanks in advance.
    praks
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    public class mysax extends DefaultHandler
         String ctelement;
         CharArrayWriter contents;
         String vname1,vrcbreg1,vaddress1,vcountry1,vtelephone1,vfax1;
         String vname,vrcbreg,vaddress,vcountry,vtelephone,vfax;
         public mysax()
              vname1 = null;
              vrcbreg1 = null;
              vaddress1 = null;
              vcountry1 = null;
              vtelephone1 = null;
              vfax1 = null;
              contents= new CharArrayWriter();
         public void doparse(String url) throws Exception
              SAXParserFactory spf = SAXParserFactory.newInstance();
    SAXParser sp = spf.newSAXParser();
    ParserAdapter pa = new ParserAdapter(sp.getParser());
    pa.setContentHandler(this);
    pa.parse(url);          
         public void startElement(String namespace,String localName,String qName,Attributes atts)
              ctelement = localName;     
         public void endElement(String uri,String localName,String qName) throws SAXException
         public void characters(char[] ch,int start, int length) throws SAXException
              try
                   if(ctelement.equals("name"))
                        vname = new String (ch,start,length);
                        System.out.println("The method "+vname1);
              }catch (Exception e)
                   System.out.println("The exception "+e);
         public static void main(String args[])
              try
              mysax ms = new mysax();
              ms.doparse(args[0]);
              System.out.println("the contents name "+ms.vname1);
              catch(Exception e)
                   System.out.println("this is exception at main" +e);
    my XML looks like
    <coyprofile_result>
    <company>     
    <name>abcTech</name>
    <rcbreg>123456789</rcbreg>
    <address>Singapore</address>
    <country>sg</country>
    <telephone>123456</telephone>
    <fax>123155</fax>
    </company>
    </coyprofile_result>

    I believe that the problem has to do with the value you assign to ctelement. You are assigning the value of localName to ctElement, however for the element: <name>...</name> the localname is empty string i.e. "", but qName equals "name". Because you are assigning empty string to ctElement, when you do the comparison in characters of ctElement to "name" it will always be false. So in startElement change it to ctElement = qName; Try it and see if it works. I have produced similar programs and it works for me.
    Hope this helps.

Maybe you are looking for