Thread: XStream Help..

Results 1 to 3 of 3
  1. #1 XStream Help.. 
    Registered Member
    Kelvin's Avatar
    Join Date
    Jun 2007
    Posts
    1,433
    Thanks given
    48
    Thanks received
    33
    Rep Power
    269
    Well i have dumped all of my npc lists into XML;

    Code:
    <net.kelvin.equality.model.npc.NPCList>
      <npcID>0</npcID>
      <npcName>Hans</npcName>
      <npcCombat>0</npcCombat>
      <npcHealth>0</npcHealth>
    </net.kelvin.equality.model.npc.NPCList>
    
    <net.kelvin.equality.model.npc.NPCList>
      <npcID>1</npcID>
      <npcName>Man</npcName>
      <npcCombat>2</npcCombat>
      <npcHealth>7</npcHealth>
    </net.kelvin.equality.model.npc.NPCList>
    Like this.

    But i dont know how to load them :/
     

  2. #2  
    Expert Programmer


    Join Date
    Dec 2007
    Posts
    2,018
    Thanks given
    52
    Thanks received
    84
    Rep Power
    986
    You load them with a pharser I been looking into differnt looading recently and my friend help me

    Code:
    package com.ultimate.rs.xml;
    
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.util.Properties;
    
    /**
     * 
     * Loads Servers settigs
     * 
     * @author UltimateG (The base for XML Loading)
     * 
     */
    
    public class Settings {
    
    	Properties props;
    	String dir = "./data/xml/";
    	String file = "settings.xml";
    
    	public Settings() {
    		props = new Properties();
    		try {
    			FileInputStream in = new FileInputStream(dir + file);
    			if (file.endsWith("xml")) {
    				props.loadFromXML(in);
    			} else {
    				props.load(in);
    			}
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    
    	/**
    	 * Gets the name of the Server
    	 * 
    	 * @return The Server's Name
    	 */
    
    	public String getServerName() {
    		String serverName = props.getProperty("ServerName");
    		return serverName;
    	}
    
    	/**
    	 * Gets the Server's Port
    	 * 
    	 * @return The Server's Port
    	 */
    
    	public int getServerPort() {
    		int port = Integer.parseInt(props.getProperty("Port"));
    		return port;
    	}
    
    	/**
    	 * Gets the Build
    	 * 
    	 * @return The Server's Build
    	 */
    
    	public String getServerBuild() {
    		String build = props.getProperty("Build");
    		return build;
    	}
    
    }
    You can figure it out

    I just need to know how to make it seperate out so I can load more than 1 thing if you get wat a mean
    Last edited by Ultimate; 01-26-2009 at 08:16 PM. Reason: More
     

  3. #3  
    Registered Member
    Kelvin's Avatar
    Join Date
    Jun 2007
    Posts
    1,433
    Thanks given
    48
    Thanks received
    33
    Rep Power
    269
    Lol nvm, thanks anyway, ive done it myself already

    i was dumb bcuz i still used the old way rofl.
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •