Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: xml output problem

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default xml output problem

    hello there i'm new in java programming and i have problems with a project of mine for my university!!!i would be glad to take a response thnks alot


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: xml output problem

    Hello and welcome

    Any chance you could tell us what the problem is and we'll see if anyone can offer you some help.

    // Json

  3. #3
    Junior Member
    Join Date
    May 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: xml output problem

    yes off course!!my project uses regex in order to take information from weathersites for the weatherforecast in different areas.i have created the xml input but my problem is that i deal alot of problems combinig it with java!to be more specific...
    i don't want to give an exact number of cities so my in java code when parsing the xml i should have to 2D tables so this confuses me alot and in the output i deal the same problems so this is where i want your help thanks alot

  4. #4
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: xml output problem

    What does the XML look like and how are you trying to parse it?

    // Json

  5. #5
    Junior Member
    Join Date
    May 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: xml output problem

    my xml looks likes:
    <config>
    <site>
    <sname>meteo.gr<sname>
    <surl><![CDATA[http://www.meteo.gr/#]]></surl>
    <regexps>
    <reg name="unique">
    <start><![CDATA[<td class="SmallText">]]</start>
    <end><![CDATA[ <tr class="TRstyle1">]]</end>

    <reg name="hmeromhnia"> //attribute
    <start><![CDATA[ <td class="HeadG">]]></start>
    <end><![CDATA[</td>]]></end>
    </reg>


    <reg name="wra">
    <start><![CDATA[<td colspan="2" class="HeadG">]]></start>
    <end><![CDATA[</td>]]></end>
    </reg>
    <reg name="thermokrasia">
    <start><![CDATA[ <td class="HeadG">]]></start>
    <end><!CDATA[</td>]]></end>
    </reg>

    <reg name="ugrasia">
    <start><![CDATA[ <td class="HeadG">]]></start>
    <end><!CDATA[</td>]]></end>
    </reg>
    it's only a sample! and i parse it like this
    here is the part that i'm not sure i'm doing right!!i should have 2Dtables one for the regex and one for the cities and their urls so i don't know if this is the right way to do so.....

    if(reg_is.child("end").content()=="")
    	    error += "\tNo suffix reg.exp. given.\n";
    	 else
    suffix = HtmlMethods.removeBreaks(replaceVariables(reg_is.child("end").content()));
     
    	}
    	else{
    	  poleis[k][0]= HtmlMethods.removeBreaks(reg_is.string("name"));
    	  poleis[k][1] = HtmlMethods.removeBreaks(replaceVariables(reg_is.child("start").content()));
    	  poleis[k][2] = HtmlMethods.removeBreaks(replaceVariables(reg_is.child("end").content()));
    	  k++;
    	 }
    	}
    	}
     
    	    		for(Xml polh_is:fetchsite.child("site").child("poleis").children("polh")){ //url theloume mia for akoma
        	        	if((polh_is.string("name")=="")||(polh_is.content()==""))//attribute
            				error += "Error in polh: name is - " + polh_is.string("name") + " with url - " + polh_is.content() + " -.\n";
            			else
            				for(int j=0; j<citylink.length; j++){
                      citylink[j][0]=HtmlMethods.removeBreaks(polh_is.string("name"));
                      citylink[j][1]=HtmlMethods.removeBreaks(polh_is.string("with url -"+polh_is.content() +"-.\n"));
     
            				}
        	        }
    Last edited by Json; May 26th, 2010 at 03:36 AM.

Similar Threads

  1. el gato as output
    By bgwilf in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 18th, 2010, 07:02 AM
  2. duplicating output
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: January 3rd, 2010, 01:11 AM
  3. OutPut.
    By chronoz13 in forum Java Theory & Questions
    Replies: 3
    Last Post: August 29th, 2009, 10:54 AM
  4. Display output from a file using regular expression
    By jazz2k8 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: May 29th, 2008, 09:33 AM
  5. [SOLVED] Java program error in displaying Output
    By crazydeo in forum AWT / Java Swing
    Replies: 9
    Last Post: May 14th, 2008, 10:42 AM