JAXP DOM simple parsing question.

I am adament that I should use Java DOM Document,Node,Element,Attr classes
to handle an xml document.
Why is it that the following code, compiled and executed in the same directory as
the xml file video.xml, only prints null, when it should echo
the contents to screen? I am running Windows XP SP2.
import org.w3c.dom.*;
import javax.xml.parsers.*;
public class Main {
public static void main(String[] args) {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document xml = builder.parse(new String("video.xml"));
System.out.println(xml.getTextContent());
catch (Exception e)
e.printStackTrace();
//********************************************************************************

I am adament that I should use Java DOM Document,Node,Element,Attr classesThat is very bad.
try something like this may work
DOMSource domSource = new DOMSource(xml);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
//transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.transform(domSource, result);
String xmlString = writer.toString();
System.out.println(xmlString);

Similar Messages

  • Need XML (JAXP DOM) creating/parsing sample coding

    Where to find some sample code of XML document creating and parsing with JAXP DOM? Thanks.

    Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse("c:/myfile.xml");

  • Simple parsing question

    How do I change a value such as "3," or "34," into simply "3" or "34" without the trailing comma?
    Peter Roberson

    set string_List to {"3,", "34,"}
    repeat with i in string_List
    display dialog my handle_String(i)
    end repeat
    on handleString(localString)
    return ((characters 1 through ((offset of "," in local_String) - 1)) of local_String) as string
    end handle_String
      Mac OS X (10.4.4)  

  • Jaxp underlying sax class question

    Below is a class that uses the JAXP layer and parses a xml document. All works fine and my results are proper. I would like to use the JAXP abstraction in some code at work, but I am not sure of two things.
    1) What underlying parser does this use.? I believe the answser has to do with where the class was downloaded? Crimson from sun, Xerces from Apache. But I am writing code that will go to a remote server.
    2) So if the above is true, how can I through code find out what underlying parser it is using, and can I override it somehow on this remote server?
    Thanks,
    Scott
    from java and xml oreilly
    package javaxml2;
    import java.io.File;
    import java.io.IOException;
    import java.io.OutputStreamWriter;
    import java.io.Writer;
    // JAXP
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.SAXParser;
    // SAX
    import org.xml.sax.AttributeList;
    import org.xml.sax.HandlerBase;
    import org.xml.sax.SAXException;
    * <p>
    * <code>TestSAXParsing</code> is a simple class that demonstrates
    * how JAXP can be used to work with SAX (the Simple API for XML).
    * </p>
    public class TestSAXParsing {
    * <p>Provide a static entry point.</p>
    public static void main(String[] args) {
    try {
    if (args.length != 1) {
    System.err.println ("Usage: java TestSAXParsing [filename]");
    System.exit (1);
    // Get SAX Parser Factory
    SAXParserFactory factory = SAXParserFactory.newInstance();
    // Turn on validation, and turn off namespaces
    factory.setValidating(true);
    factory.setNamespaceAware(false);
    SAXParser parser = factory.newSAXParser();
    parser.parse(new File(args[0]), new MyHandler());
    } catch (ParserConfigurationException e) {
    System.out.println("The underlying parser does not support the requested features.");
    } catch (FactoryConfigurationError e) {
    System.out.println("Error occurred obtaining SAX Parser Factory.");
    } catch (Exception e) {
    e.printStackTrace();
    class MyHandler extends HandlerBase {
    private Writer out;
    public MyHandler() throws SAXException {
    try {
    out = new OutputStreamWriter(System.out, "UTF8");
    } catch (IOException e) {
    throw new SAXException("Error getting output handle.", e);
    public void startDocument() throws SAXException {
    print("<?xml version=\"1.0\"?>\n");
    public void startElement(String elementName, AttributeList atts)
    throws SAXException {
    print("<" + elementName);
    if (atts != null) {
    for (int i=0, len = atts.getLength(); i<len; i++) {
    print(" " + atts.getName(i) +
    "=\"" + atts.getValue(i) + "\"");
    print(">");
    public void endElement(String elementName) throws SAXException {
    print("</" + elementName + ">\n");
    public void characters(char[] ch, int start, int len) throws SAXException {
    print(new String(ch, start, len));
    private void print(String s) throws SAXException {
    try {
    out.write(s);
    out.flush();
    } catch (IOException e) {
    throw new SAXException("IO Error Occurred.", e);

    I see that there are a number of code snippets on that page, for clarity I meant this one in particular. It checks for just about every parser known before calling default. Sorry for confusion. You wouldn't have to check for this many parsers, but I sometimes take Xerces if it is there over the default.
      XMLReader parser;
      try { // Xerces
        parser = XMLReaderFactory.createXMLReader(
         "org.apache.xerces.parsers.SAXParser"
      catch (SAXException e1) {
        try { // Crimson
          parser = XMLReaderFactory.createXMLReader(
           "org.apache.crimson.parser.XMLReaderImpl"
        catch (SAXException e2) {
          try { // ?lfred
            parser = XMLReaderFactory.createXMLReader(
             "gnu.xml.aelfred2.XmlReader"
          catch (SAXException e3) {
            try { // Piccolo
              parser = XMLReaderFactory.createXMLReader(
                "com.bluecast.xml.Piccolo"
            catch (SAXException e4) {
              try { // Oracle
                parser = XMLReaderFactory.createXMLReader(
                  "oracle.xml.parser.v2.SAXParser"
              catch (SAXException e5) {
                try { // default
                  parser = XMLReaderFactory.createXMLReader();
                catch (SAXException e6) {
                  throw new NoClassDefFoundError(
                    "No SAX parser is available");
                    // or whatever exception your method is 
                    // declared to throw
      }

  • Installing a DOM XML Parser

    Hey, I apologize for the newbie question but I suppose this is as good a place as any for it. I'm in desperate need of a DOM XML parser and have decided upon the Apache parser, "Xerces," featured here. My problem is this, every time I make a move towards installing it, I get all mixed up at the mention of my "Apache, ant and forrest" installations that I am apparently supposed to have in order for this library to work. My question is, is this library only for use in web-based applications and thus requires Apache in order to run? I ask because the application I'm working on is simply for desktop usage and the users it will be distributed to will not have Apache installations. If somebody could help me out with a quick little walk-through on the installation of this library it would be IMMENSELY appreciated.
    Edited by: Tracekill on Sep 13, 2009 11:01 AM

    Study up on the javax.xml.parsers API here at Sun. Next, download Xerces from Apache (xml.apache.org). Finally, take a tutorial.
    - Saish

  • JAXP DOM - I can get children fine, just not nested children!

    Hi,
    I have a problem with JAXP dom. I cannot get the nested children associated.
    Here is my code:
    try {
    DOMParser parser = new DOMParser();
    String url = "file:/myxml.xml";
    parser.parse(url);
    Document doc = parser.getDocument();
    //Get the filename
    NodeList FileNameNodeList = doc.getElementsByTagName("filename");
    //Get the duration
    NodeList DurationNodeList = doc.getElementsByTagName("duration");
    //Get the headline
    NodeList HeadLineNodeList = doc.getElementsByTagName("headline");
    //Get the description
    NodeList DescriptionNodeList = doc.getElementsByTagName("description");
    //Get the keywords
    NodeList KeyWordsNodeList = doc.getElementsByTagName("keywords");
    //Get the link order
    //Read all values for every "File Name"
    for(int i=0; i<FileNameNodeList.getLength(); i++){          
    //Get the values
    Node FileNameNode = FileNameNodeList.item(i);
    Node DurationNode = DurationNodeList.item(i);
    Node HeadLineNode = HeadLineNodeList.item(i);
    Node DescriptionNode = DescriptionNodeList.item(i);
    Node KeyWordsNode = KeyWordsNodeList.item(i);
    //File name
    if(FileNameNode.getFirstChild() != null){
    Message += "<br><b>Filename:</b> " + FileNameNode.getFirstChild().getNodeValue();
    //Duration
    if(DurationNode.getFirstChild() != null){
    Message += "<b>Duration:</b> " + DurationNode.getFirstChild().getNodeValue();
    //Head line
    if(HeadLineNode.getFirstChild() != null){
    Message += "<b>Head Line:</b> " + HeadLineNode.getFirstChild().getNodeValue();
    //Description
    if(DescriptionNode.getFirstChild() != null){
    Message += "<b>Description:</b> " + DescriptionNode.getFirstChild().getNodeValue();
    //Key words
    if(KeyWordsNode.getFirstChild() != null){
    Message += "<b>Key Words:</b> " + KeyWordsNode.getFirstChild().getNodeValue();
    //Build the string
    String MessageTemp = Message;
    Message = "<font size=-1>" + MessageTemp + "</font>";
    return Message;
    } catch (Exception ex) {
    System.out.println(ex);
    return Message + ex.toString();
    Here is part of my XML File:
    - <article storyorder="1" pubdate="11/6/02 3:28:27 AM" source="MSNBC Video" topnews="1">
    <filename>vh</filename>
    <duration>00:01:58</duration>
    <headline>MSNBC&#146;s Video Headlines</headline>
    <description>The latest news from MSNBC.com</description>
    <keywords>headlines, news headlines</keywords>
    <photographer />
    <aspect>4:3</aspect>
    - <linkinfo>
    - <link order="1">
    <linkurl>http://www.msnbc.com/news/828323.asp</linkurl>
    <linktext>Republicans win control of Congress</linktext>
    </link>
    - <link order="2">
    <linkurl>http://www.msnbc.com/news/828325.asp</linkurl>
    <linktext>Republicans widen House majority</linktext>
    </link>
    - <link order="3">
    <linkurl>http://www.msnbc.com/news/828326.asp</linkurl>
    <linktext>Democrats retake some statehouses</linktext>
    </link>
    </linkinfo>
    - <categories>
    - <category id="News">
    - <topics>
    <topic>International</topic>
    <topic>US</topic>
    </topics>
    </category>
    </categories>
    </article>
    I can get filename, duration, etc. But I cannot get the multiple link URLs associated with the filename. How can I get that?
    Thanks

    Call getDocumentElement() on the document to obtain the root node. Then call getChildNodes() on the root node to get its children, each individual child can be accessed by looping, as follows :
    // Get the Document object.
    Node node = document.getDocumentElement();
    NodeList childNodes = node.getChildNodes();
    for(int i = 0; i < childNodes.getLength(); i++) {
        Node childNode = childNodes.item(i);
        // Perform some action on the node, or get its children to burrow
        // further down the DOM tree.
    }If you know how many levels you need to go down then you'll need that many nested for loops but recursion is a far more elegant solution.

  • Need suggestion on JAXP DOM

    My tool is JAXP DOM. My idea is this: to realize XML file transfer between
    two sockets. I finished several step so far at the sender side:
    1. use DocumentBuilder to generate a new Document.
    2. insert a root Element into the Document.
    3. add new nodes into the root Element.
    My question is how to do:
    4. how to convert the Document type into OutputStream so I can send it out
    using the socket. Maybe I should convert the Document into byte[] first or
    something else, but how?
    Thank you very much.

    Thanks dude. Do you think I can do in this way:
    TransformerFactory xformFactory = TransformerFactory.newInstance();
    Transformer transformer = xformFactory.newTransformer();
    DOMSource input = new DOMSource(myDocToSendOnSocket.getDocumentElement());
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    StreamResult output = new StreamResult(baos);
    transformer.transform(input, output);
    SSLSocket socket = (SSLSocket) SocketFactory.createSocket (address, port);
    OutputStream out = new socket.getOutputStream();
    out.write (baos.toByteArray());
    out.flush();
    out.close();
    socket.close();
    If the code is right, my question is: can I use baos.toByteArry(); directly? I mean baos is just one parameter in output's constructor. Does its value change after transform is called? Thank you.

  • Changing /updating an xml file using JAXP(DOM)

    Hello,
    i am fairly new to xml and am using it in my degree project.I am able to retrieve and read data from a fairly large xml file using JAXP(DOM) and/or XMLBeans.I am having difficulties in updating the xml document. Any updation i believe is ito be saved into a new xml document,but dont know how to proceed with it. Any help would be appreciated.
    Following is a snippet of my code using JAXP. Here i am able to retrieve data from the source file.
    File document=new File("C:\\tester.xml");
    try {
    DocumentBuilderFactory factory
    = DocumentBuilderFactory.newInstance();
    DocumentBuilder parserr = factory.newDocumentBuilder();
    Document doc=parserr.parse(document);
    System.out.println(document + " is well-formed.");
    NodeList n2=doc.getElementsByTagName("Top");
    NodeList n3=doc.getElementsByTagName("Base");
    int x=n2.getLength();
    System.out.println("There are " x "players");
    for(int g=0;g<=x;g++)
    System.out.println("Top is" + n2.item(g).getFirstChild().getNodeValue()+" Base is" +n3.item(g).getFirstChild().getNodeValue());
    --------------------------------------------------------------------------------

    Following is my updation code to the dom tree:
    NodeList list=doc.getElementsByTagName("Information");
    for(int i=0; i<list.getLength();i++){
    Node thissampnode=list.item(i);
    Node thisNameNode=thissampnode.getFirstChild();
    if(thisNameNode==null) continue;
    if(thisNameNode.getFirstChild()==null)continue;
    // if(thisNameNode.getFirstChild() !(instanceof org.w3c.dom.Text) continue;
    String data=thisNameNode.getFirstChild().getNodeValue();
    if (! data.equals("0.59")) continue;
    Node newsampNode = doc.createElement("Samp");
    Node newsampTopNode = doc.createElement("Top");
    Text tnNode = doc.createTextNode("0.50");
    newsampTopNode.appendChild(tnNode);
    Element newsampRef = doc.createElement("Ref");
    Text tsr = doc.createTextNode("0");
    newsampRef.appendChild(tsr);
    Element newsampType = doc.createElement("Type");
    Text tt = doc.createTextNode("z");
    newsampType.appendChild(tt);
    Element newsampbase = doc.createElement("Base");
    Text sb = doc.createTextNode("0.55");
    newsampbase.appendChild(sb);
    newsampNode.appendChild(newsampTopNode);
    newsampNode.appendChild(newsampRef);
    newsampNode.appendChild(newsampType);
    newsampNode.appendChild(newsampbase);
    rootNode.insertBefore(newsampNode, thissampnode);
    Here i dont see any changes to the original xml source file.

  • Simple/silly question: how do I set/change default font/color for outgoing mail messages?

    Simple/silly question: how do I set/change default font/color for outgoing mail messages?

    Just a suggestion..........
    Download Thunderbird.  Easier to use when it comes to what you want to do w/your emails. 

  • How to ignore empty text element while using DOM to parse xml??

    hi everyone,
    i am using DOM to parse an xml file. But i dont know how to cinfig the DocumentBuilderFactory to ignore empty text elements.
    For example, i have an xml file like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    <root>
        <child>Tom</child>
        <child>Jerry</child>
    </root>I used the following codes to parse:
    String fname = "Tom-and-Jerry.xml";
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setIgnoringElementContentWhitespace(true);
    factory.setIgnoringComments(true);
    DocumentBuilder builder = domFactory.newDocumentBuilder();
    // Generate a DOM tree from the DOM builder.
    org.w3c.dom.Document dom = builder.parse(new File(fname));
    org.w3c.dom.NodeList list = dom.getChildNodes();
    for (int i=0; i<list.getLength(); i++) {
        System.out.println("Child No."+i);
        System.out.println("NodeName="+list.item(i).getNodeName());
        System.out.println("NodeType="+getType(list.item(i).getNodeType()));
        System.out.println("NodeValue="+list.item(i).getNodeValue());
        System.out.println();
    }The result is not exactly what i want ---- there are 5 children in list!! The 1st, 3rd and 5th are #text and their values are all empty. Only the 2nd and the 4th are the child that i expect.
    It is really troublesome to get all these silly empty texts as sub elements. I tried to get rid of them, but i failed. I just dont understand why factory.setIgnoringElementContentWhitespace(true) did not work.
    Anyone can help me? thanks.
    Heavy ZHENG

    I just dont understand why factory.setIgnoringElementContentWhitespace(true) did not work.That only does something if the XML has a DTD that enables it to know what whitespace can be ignored and what is significant. The API documentation for the method refers you to this document:
    http://www.w3.org/TR/REC-xml#sec-white-space

  • 4 Simple Flash Questions that Are Stumping Me!

    What is the Frame Rate for Web Animations
    Q1. I am making an animation which will be played on the web. What is the default frame rate (fps) of Flash CS5? And what is the frame rate of for web?
    Q2. My animation needs to be 30 seconds long. So at 15 fps that would mean I need to use 600 frames in Flash?
    How Do I Mask everything so all I see is the Content on the Stage?
    I have a wide image that extends past my movies stage size so when I preview my movie the image is visible. How do I mask out anything that extends past my movies window size? I believe I can create a layer named "mask" and place it above all other layers, but I forget how to make the mask. Any help is appreciated.
    How to Fade a Graphic
    I have a graphic element (some type) and I want it to fade from 0% to 100%. In older versions of Flash I could just select the symbol and then set it's alpha value to 0%, move a few keyframes and then set the alpha to 100%. Voila! but now it doesn't seem to work that way. How can I do this in CS5?

    Ned, it says 24 fps which means there is 24 frames per second so each 24 frames is 1 second.
    Date: Fri, 4 Nov 2011 05:35:16 -0600
    From: [email protected]
    To: [email protected]
    Subject: 4 Simple Flash Questions that Are Stumping Me!
        Re: 4 Simple Flash Questions that Are Stumping Me!
        created by Ned Murphy in Flash Pro - General - View the full discussion
    1 You can create your character as a movieclip and copy/paste that movieclip from one file to another. 2. One way to create a movieclip is to copy all the frame of the animation's timeline (select them all, right click the selection, choose Copy Frames), then create a new movieclip symbol (Insert -> New Symbol...etc) right click on its only keyframe and chhose Paste Frames.  THat will put all the layers and frames you copied into the movieclip The only way to come close to being certain about the timing of you animation is to use code to keep track of the time, something like getTimer()..  The frame rate that a file plays at is not a reliable means of dictating the time it takes due to a variety of factors which include the amount of content you are trying to process and performance limits of the user's machine.
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4007420#4007420
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4007420#4007420. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Flash Pro - General by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Simple performance question

    Simple performance question. the simplest way possible, assume
    I have a int[][][][][] matrix, and a boolean add. The array is several dimensions long.
    When add is true, I must add a constant value to each element in the array.
    When add is false, I must subtract a constant value to each element in the array.
    Assume this is very hot code, i.e. it is called very often. How expensive is the condition checking? I present the two scenarios.
    private void process(){
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
             if (add)
             matrix[i][ii][iii][...]  += constant;
             else
             matrix[i][ii][iii][...]  -= constant;
    private void process(){
      if (add)
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
             matrix[i][ii][iii][...]  += constant;
    else
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
           matrix[i][ii][iii][...]  -= constant;
    }Is the second scenario worth a significant performance boost? Without understanding how the compilers generates executable code, it seems that in the first case, n^d conditions are checked, whereas in the second, only 1. It is however, less elegant, but I am willing to do it for a significant improvement.

    erjoalgo wrote:
    I guess my real question is, will the compiler optimize the condition check out when it realizes the boolean value will not change through these iterations, and if it does not, is it worth doing that micro optimization?Almost certainly not; the main reason being that
    matrix[i][ii][iii][...]  +/-= constantis liable to take many times longer than the condition check, and you can't avoid it. That said, Mel's suggestion is probably the best.
    but I will follow amickr advice and not worry about it.Good idea. Saves you getting flamed with all the quotes about premature optimization.
    Winston

  • DOM XML parser program

    Hi,
    I am trying to write a sample program using DOM xml parser in java to read the values in a XML file.
    please suggest me what are all the things I have to do for that.
    I know Java and XML. I want to know how to access values from XML file in java.
    Thanks
    Selvakumar

    Study up on the javax.xml.parsers API here at Sun. Next, download Xerces from Apache (xml.apache.org). Finally, take a tutorial.
    - Saish

  • A few simple Logic questions...please help.

    I have a few probably simple Logic questions, that are nonetheless frustrating me, wondering if someone could help me out.
    1. I run Logic 8, all of the sounds that came with logic seem to work except organ sounds. I can't trigger any organ sounds (MIDI) on Logic, they won't play. I have a Yamaha Motif as my midi controller.
    Any idea why?
    2. I've starting running into a situation where I will record a MIDI track, the notes are recorded but they won't playback. The only track effected is the one that was just recorded. All other midi tracks playback.
    I have to cut the track, usually go out of Logic and back in, re record for it to playback properly. Any idea why this may be happening?
    3. How important is it to update to Logic 9. Are there any disadvantages down the road if I don't upgrade. If I purchase the $200 upgrade, do I get a package of discs and material, or it just a web download.
    Any help is appreciated!
    Colin

    seeren wrote:
    Data Stream Studio wrote:
    3) You get a full set of disks and manuals.
    They're including manuals now?
    I think his referring to the booklets ...on how to install etc
    It would be great to see printed manuals though ...I love books especially Logic/Audio related !!
    A

  • Tough Parsing question???

    Please try to help me with the following parsing question.
         I have an exert from the 2000 Tiger/Line Census files that looks
         something like this:
         0001     A     Libby     Ln     -92.99999+25.87787      -92.87679+26.65543
         0002     A     Capri     Ave     -93.32343+23.3332 3      -24.34444+34.22222
         0003     A     Minster Grove Ln     -93.23433+22.2223432     -98.343343+23.34332
         0003     A     Houston Ave -91.99892+22.323322     -98.434543+33.33233
         0004 A I-10          Int -91.23234+32.343232     -97.333233+34.22222
         0005 C     Trenton Springs Ct. -90.22232+33.222123          -91.234432+23.33221
         I want to parse it so I can enter it into an SQL database.
         Normally this would be an easy task but, the file is not comma
         deliminated. Usaully I could just break it apart at the white space
         but as you can see above, some of the street names (the third column)
         have whitespace in the text. I have almost declared it impossible
         and am about to give up an buy prepackaged/parsable software.
         I will feel very small if I have to do that.
         Thanks for any help,
         Ian

    public class CensusParser
         String[] census = {     "0001     A     Libby                       Ln     -92.99999+25.87787                 -92.87679+26.65543",
                                  "0002     A     Capri                       Ave     -93.32343+23.3332 3                -24.34444+34.22222",
                                  "0003     A     Minster Grove    Ln     -93.23433+22.2223432             -98.343343+23.34332",
                                  "0003     A     Houston               Ave    -91.99892+22.323322           -98.434543+33.33233",
                                  "0004    A       I-10                     Int    -91.23234+32.343232                 -97.333233+34.22222",
                                  "0005   C     Trenton Springs Ct.    -90.22232+33.222123           -91.234432+23.33221" };
         int cur, flds;
         String n = "";
         void parse() {
              for (int x=0; x<census.length; x++) {
                   flds = 0;
                   cur=census[x].length();
                   n = "";
                   for (int y=census[x].length()-1; y>=0 && flds < 4; y--) {
                        if (census[x].charAt(y) == '-' || census[x].charAt(y) == '+') {
                             n = "," + census[x].substring(y, cur).trim() + n;
                             cur = y;
                             flds++;
                   n = census[x].substring(0, cur).trim() + n;
                   census[x] = n;
                   System.out.println(n);
         public static void main(String[] args) {
              CensusParser cp = new CensusParser();
              cp.parse();
    }Not very efficient, but it works!
    Mark

Maybe you are looking for

  • Problem with Panasonic P2

    I am new to this forum and hope someone can help me. I shot video by Panasonic AG-HVX203 to shoot video in DVCPRO HD (1080/50i) format.  This is PAL format.  Video is stored in P2 card.  And then I import the MXF files to the timeline of Premiere CS4

  • Force Reporting Services 2012 use https

    I have recently set up a new instance of SQL Server Reporting Services. I have it running and am in the testing phase of the deploy. I have set it up to use SSL and basic Authentication. This all works. The report writer has been able to deploy repor

  • IDOC Type for Tcode CC01 and CC02 (Create / Change Change Numbers)

    We are trying to integrate Change Master from a 3rd party system to SAP R/3 4.72.What is the IDOC Type for Tcode CC01 and CC02 (Create / Change Change Numbers)

  • How to rollback previous transaction in a series of Adapters in BPEL

    in Bpel process we integrate 3 db adapters, 2 adapters are successfully complted,3rd adpter failed. inthis situation how we rollback the 3 adapter transaction with out using of compensate handling

  • Opening larger files is crashing

    I have problems opening files larger than 4Mb it seems! I use the iPad with 3G and 64Gb. Installed dropbox and iDisk and sharing files is easy. However, when i open files (any files: keynote, PDF, etc.) THE download is crashing and dropbox or iDisk s