package jmetest.renderer.loader;

import com.jme.app.SimpleGame;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.model.XMLparser.SAXReader;
import com.jme.scene.model.XMLparser.XMLWriter;
import com.jme.scene.Node;

import java.io.*;


/**
 *
 * Test class for XML loading/writting with jME
 * Started Date: May 30, 2004
 * @author Jack Lindamood
 */
public class TestXMLLoader extends SimpleGame{


    public static void main(String[] args){
        new TestXMLLoader().start();
    }

    protected void simpleInitGame() {
        lightState.get(0).setSpecular(new ColorRGBA(1,1,1,1));

        SAXReader r=new SAXReader();
        Node mi1=null;
        try {
            mi1=r.loadXML(new File("data/XML docs/newSampleScene.xml").toURL().openStream());
        } catch (IOException e) {
            System.out.println("bad File exception" + e.getCause() + "*" + e.getMessage());
        }

        StringWriter BO=new StringWriter();
        XMLWriter rr=new XMLWriter(BO);
        try {
            rr.writeScene(mi1);
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.print(BO);
        r.loadXML(new ByteArrayInputStream(BO.toString().getBytes()));
        Node mi2=r.fetchCopy();
        rootNode.attachChild(mi2);

    }
}

@@ -239,94 +239,236 @@
 .*;%0A
-%0A%0A/**%0A *%0A * Test class for XML loading/writting with jME%0A * Started Date: May 30, 2004
+import java.net.URL;%0A%0A%0A/**%0A *%0A * Started Date: May 30, 2004 %3Cbr%3E%3Cbr%3E%0A * Test class for XML loading/writting with jME.  I load an XML doc, write the node I loaded, then load that write and%0A * finally attach that to the SceneGraph
 %0A * 
@@ -782,115 +782,356 @@
     
-Node mi1=null;%0A        try %7B%0A            mi1=r.loadXML(new File(%22data/XML docs/newSampleScene.xml%22).toURL()
+URL xmldoc=TestXMLLoader.class.getClassLoader().getResource(%22jmetest/data/XML docs/newSampleScene.xml%22);%0A        if (xmldoc==null)%7B%0A            System.out.println(%22Error locating XML document.  Try including jmetest-data.jar in classpath%22);%0A            System.exit(0);%0A        %7D%0A        Node mi1=null;%0A        try %7B%0A            mi1=r.loadXML(xmldoc
 .ope

Use classloader to find XML.