Android: Added setNamespaceAware(true) to ogre xml loader if running on android
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7754 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
354ff46ccf
commit
09b475d893
@ -52,6 +52,7 @@ import com.jme3.scene.VertexBuffer;
|
|||||||
import com.jme3.scene.VertexBuffer.Format;
|
import com.jme3.scene.VertexBuffer.Format;
|
||||||
import com.jme3.scene.VertexBuffer.Type;
|
import com.jme3.scene.VertexBuffer.Type;
|
||||||
import com.jme3.scene.VertexBuffer.Usage;
|
import com.jme3.scene.VertexBuffer.Usage;
|
||||||
|
import com.jme3.system.JmeSystem;
|
||||||
import com.jme3.util.BufferUtils;
|
import com.jme3.util.BufferUtils;
|
||||||
import com.jme3.util.IntMap;
|
import com.jme3.util.IntMap;
|
||||||
import com.jme3.util.IntMap.Entry;
|
import com.jme3.util.IntMap.Entry;
|
||||||
@ -67,6 +68,10 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.parsers.SAXParserFactory;
|
||||||
|
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
@ -790,7 +795,17 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLReader xr = XMLReaderFactory.createXMLReader();
|
// Added by larynx 25.06.2011
|
||||||
|
// Android needs the namespace aware flag set to true
|
||||||
|
XMLReader xr;
|
||||||
|
if (JmeSystem.getFullName().toUpperCase().contains("ANDROID")) {
|
||||||
|
SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||||
|
factory.setNamespaceAware(true);
|
||||||
|
xr = factory.newSAXParser().getXMLReader();
|
||||||
|
} else {
|
||||||
|
xr = XMLReaderFactory.createXMLReader();
|
||||||
|
}
|
||||||
|
|
||||||
xr.setContentHandler(this);
|
xr.setContentHandler(this);
|
||||||
xr.setErrorHandler(this);
|
xr.setErrorHandler(this);
|
||||||
InputStreamReader r = new InputStreamReader(info.openStream());
|
InputStreamReader r = new InputStreamReader(info.openStream());
|
||||||
@ -802,6 +817,10 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
|
|||||||
IOException ioEx = new IOException("Error while parsing Ogre3D mesh.xml");
|
IOException ioEx = new IOException("Error while parsing Ogre3D mesh.xml");
|
||||||
ioEx.initCause(ex);
|
ioEx.initCause(ex);
|
||||||
throw ioEx;
|
throw ioEx;
|
||||||
|
} catch (ParserConfigurationException ex) {
|
||||||
|
IOException ioEx = new IOException("Error while parsing Ogre3D mesh.xml");
|
||||||
|
ioEx.initCause(ex);
|
||||||
|
throw ioEx;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ import com.jme3.math.Quaternion;
|
|||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
|
import com.jme3.system.JmeSystem;
|
||||||
import com.jme3.util.xml.SAXUtil;
|
import com.jme3.util.xml.SAXUtil;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@ -52,6 +53,9 @@ import java.util.Stack;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.parsers.SAXParserFactory;
|
||||||
|
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
@ -351,7 +355,18 @@ public class SceneLoader extends DefaultHandler implements AssetLoader {
|
|||||||
logger.log(Level.WARNING, "Cannot locate material file {0}", ex.getMessage());
|
logger.log(Level.WARNING, "Cannot locate material file {0}", ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLReader xr = XMLReaderFactory.createXMLReader();
|
|
||||||
|
// Added by larynx 25.06.2011
|
||||||
|
// Android needs the namespace aware flag set to true
|
||||||
|
XMLReader xr;
|
||||||
|
if (JmeSystem.getFullName().toUpperCase().contains("ANDROID")) {
|
||||||
|
SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||||
|
factory.setNamespaceAware(true);
|
||||||
|
xr = factory.newSAXParser().getXMLReader();
|
||||||
|
} else {
|
||||||
|
xr = XMLReaderFactory.createXMLReader();
|
||||||
|
}
|
||||||
|
|
||||||
xr.setContentHandler(this);
|
xr.setContentHandler(this);
|
||||||
xr.setErrorHandler(this);
|
xr.setErrorHandler(this);
|
||||||
InputStreamReader r = new InputStreamReader(info.openStream());
|
InputStreamReader r = new InputStreamReader(info.openStream());
|
||||||
@ -362,6 +377,10 @@ public class SceneLoader extends DefaultHandler implements AssetLoader {
|
|||||||
IOException ioEx = new IOException("Error while parsing Ogre3D dotScene");
|
IOException ioEx = new IOException("Error while parsing Ogre3D dotScene");
|
||||||
ioEx.initCause(ex);
|
ioEx.initCause(ex);
|
||||||
throw ioEx;
|
throw ioEx;
|
||||||
|
} catch (ParserConfigurationException ex) {
|
||||||
|
IOException ioEx = new IOException("Error while parsing Ogre3D dotScene");
|
||||||
|
ioEx.initCause(ex);
|
||||||
|
throw ioEx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ import com.jme3.asset.AssetLoader;
|
|||||||
import com.jme3.asset.AssetManager;
|
import com.jme3.asset.AssetManager;
|
||||||
import com.jme3.math.Quaternion;
|
import com.jme3.math.Quaternion;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
|
import com.jme3.system.JmeSystem;
|
||||||
import com.jme3.util.xml.SAXUtil;
|
import com.jme3.util.xml.SAXUtil;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -50,6 +51,11 @@ import java.util.Iterator;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.parsers.SAXParser;
|
||||||
|
import javax.xml.parsers.SAXParserFactory;
|
||||||
|
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
@ -252,7 +258,18 @@ public class SkeletonLoader extends DefaultHandler implements AssetLoader {
|
|||||||
|
|
||||||
public Object load(InputStream in) throws IOException {
|
public Object load(InputStream in) throws IOException {
|
||||||
try {
|
try {
|
||||||
XMLReader xr = XMLReaderFactory.createXMLReader();
|
|
||||||
|
// Added by larynx 25.06.2011
|
||||||
|
// Android needs the namespace aware flag set to true
|
||||||
|
XMLReader xr;
|
||||||
|
if (JmeSystem.getFullName().toUpperCase().contains("ANDROID")) {
|
||||||
|
SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||||
|
factory.setNamespaceAware(true);
|
||||||
|
xr = factory.newSAXParser().getXMLReader();
|
||||||
|
} else {
|
||||||
|
xr = XMLReaderFactory.createXMLReader();
|
||||||
|
}
|
||||||
|
|
||||||
xr.setContentHandler(this);
|
xr.setContentHandler(this);
|
||||||
xr.setErrorHandler(this);
|
xr.setErrorHandler(this);
|
||||||
InputStreamReader r = new InputStreamReader(in);
|
InputStreamReader r = new InputStreamReader(in);
|
||||||
@ -269,7 +286,13 @@ public class SkeletonLoader extends DefaultHandler implements AssetLoader {
|
|||||||
ioEx.initCause(ex);
|
ioEx.initCause(ex);
|
||||||
fullReset();
|
fullReset();
|
||||||
throw ioEx;
|
throw ioEx;
|
||||||
|
} catch (ParserConfigurationException ex) {
|
||||||
|
IOException ioEx = new IOException("Error while parsing Ogre3D dotScene");
|
||||||
|
ioEx.initCause(ex);
|
||||||
|
fullReset();
|
||||||
|
throw ioEx;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object load(AssetInfo info) throws IOException {
|
public Object load(AssetInfo info) throws IOException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user