com.jmex.model
Class XMLUtil
java.lang.Object
com.jmex.model.XMLUtil
public class XMLUtil
- extends java.lang.Object
XML parsing utility methods
Method Summary |
static java.lang.String |
getAttribute(org.w3c.dom.Node node,
java.lang.String name)
|
static java.lang.String |
getAttribute(org.w3c.dom.Node node,
java.lang.String name,
java.lang.String defVal)
Returns an attribute of the specified tag with the name provided. |
static boolean |
getBoolAttribute(org.w3c.dom.Node node,
java.lang.String name)
|
static boolean |
getBoolAttribute(org.w3c.dom.Node node,
java.lang.String name,
boolean defVal)
|
static org.w3c.dom.Node |
getChildNode(org.w3c.dom.Node node,
java.lang.String name)
Returns the first XML child tag with the specified name. |
static float |
getFloatAttribute(org.w3c.dom.Node node,
java.lang.String name)
|
static float |
getFloatAttribute(org.w3c.dom.Node node,
java.lang.String name,
float defVal)
|
static int |
getIntAttribute(org.w3c.dom.Node node,
java.lang.String name)
|
static int |
getIntAttribute(org.w3c.dom.Node node,
java.lang.String name,
int defVal)
|
static Quaternion |
getQuatAttribute(org.w3c.dom.Node node,
java.lang.String name)
|
static Quaternion |
getQuatAttribute(org.w3c.dom.Node node,
java.lang.String name,
Quaternion defVal)
|
static ColorRGBA |
getRGBAAttribute(org.w3c.dom.Node node,
java.lang.String name)
|
static ColorRGBA |
getRGBAAttribute(org.w3c.dom.Node node,
java.lang.String name,
ColorRGBA defVal)
|
static Vector3f |
getVec3Attribute(org.w3c.dom.Node node,
java.lang.String name)
|
static Vector3f |
getVec3Attribute(org.w3c.dom.Node node,
java.lang.String name,
Vector3f defVal)
|
static org.w3c.dom.Node |
loadDocument(java.io.InputStream in,
java.lang.String rootElementName)
|
static float |
str2float(java.lang.String str)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
float3CommaPattern
public static java.util.regex.Pattern float3CommaPattern
float4CommaPattern
public static java.util.regex.Pattern float4CommaPattern
float3Pattern
public static java.util.regex.Pattern float3Pattern
float4Pattern
public static java.util.regex.Pattern float4Pattern
XMLUtil
public XMLUtil()
getChildNode
public static org.w3c.dom.Node getChildNode(org.w3c.dom.Node node,
java.lang.String name)
- Returns the first XML child tag with the specified name.
- Parameters:
node
- The node to search children ofname
- The name of the node to search for, case-sensitive.
- Returns:
- The child with the specified name, or null if none exists.
loadDocument
public static org.w3c.dom.Node loadDocument(java.io.InputStream in,
java.lang.String rootElementName)
throws java.io.IOException,
ModelFormatException
- Throws:
ModelFormatException
- for high-level Ogre Format violations.
java.io.IOException
- for any other parsing or I/O problems.
getAttribute
public static java.lang.String getAttribute(org.w3c.dom.Node node,
java.lang.String name,
java.lang.String defVal)
- Returns an attribute of the specified tag with the name provided.
- Parameters:
node
- name
-
- Returns:
- The attribute if its defined, or null.
getAttribute
public static java.lang.String getAttribute(org.w3c.dom.Node node,
java.lang.String name)
getBoolAttribute
public static boolean getBoolAttribute(org.w3c.dom.Node node,
java.lang.String name)
getBoolAttribute
public static boolean getBoolAttribute(org.w3c.dom.Node node,
java.lang.String name,
boolean defVal)
getFloatAttribute
public static float getFloatAttribute(org.w3c.dom.Node node,
java.lang.String name)
getFloatAttribute
public static float getFloatAttribute(org.w3c.dom.Node node,
java.lang.String name,
float defVal)
getIntAttribute
public static int getIntAttribute(org.w3c.dom.Node node,
java.lang.String name,
int defVal)
getIntAttribute
public static int getIntAttribute(org.w3c.dom.Node node,
java.lang.String name)
str2float
public static float str2float(java.lang.String str)
getVec3Attribute
public static Vector3f getVec3Attribute(org.w3c.dom.Node node,
java.lang.String name)
throws ModelFormatException
- Throws:
ModelFormatException
- if the value String is not a properly
formatted float tuple of the right size.
getVec3Attribute
public static Vector3f getVec3Attribute(org.w3c.dom.Node node,
java.lang.String name,
Vector3f defVal)
throws ModelFormatException
- Throws:
ModelFormatException
- if the value String is not a properly
formatted float tuple of the right size.
getQuatAttribute
public static Quaternion getQuatAttribute(org.w3c.dom.Node node,
java.lang.String name)
throws ModelFormatException
- Throws:
ModelFormatException
- if the value String is not a properly
formatted float tuple of the right size.
getQuatAttribute
public static Quaternion getQuatAttribute(org.w3c.dom.Node node,
java.lang.String name,
Quaternion defVal)
throws ModelFormatException
- Throws:
ModelFormatException
- if the value String is not a properly
formatted float tuple of the right size.
getRGBAAttribute
public static ColorRGBA getRGBAAttribute(org.w3c.dom.Node node,
java.lang.String name)
throws ModelFormatException
- Throws:
ModelFormatException
- if the value String is not a properly
formatted float tuple of the right size.
getRGBAAttribute
public static ColorRGBA getRGBAAttribute(org.w3c.dom.Node node,
java.lang.String name,
ColorRGBA defVal)
throws ModelFormatException
- Throws:
ModelFormatException
- if the value String is not a properly
formatted float tuple of the right size.