org.ourgrid.common.xml
Class XMLUtil

java.lang.Object
  extended by org.ourgrid.common.xml.XMLUtil

public class XMLUtil
extends java.lang.Object


Field Summary
protected static java.lang.String SCHEMA_VALIDATION_FEATURE_ID
          Schema validation feature id (http://apache.org/xml/features/validation/schema).
protected static java.lang.String VALIDATION_FEATURE_ID
          Validation feature id (http://xml.org/sax/features/validation).
 
Constructor Summary
XMLUtil()
           
 
Method Summary
static java.lang.String getAttributeValue(java.lang.String nameLowerCase, java.lang.String nameUpperCase, org.w3c.dom.NamedNodeMap attributes)
          Gets the string value of the given attribute name( nameLowerCase or nameUpperCase )
static org.w3c.dom.Document parseXMLContent(java.lang.String xmlContent)
          Parse the xmlContent string, verifying if the content is well-formed and validating with the schema, if it exists.
static org.w3c.dom.Document parseXMLFile(java.lang.String fileName)
          Parse the fileName in xml, verifying if the content is well-formed and validating with the schema, if it exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION_FEATURE_ID

protected static final java.lang.String VALIDATION_FEATURE_ID
Validation feature id (http://xml.org/sax/features/validation).

See Also:
Constant Field Values

SCHEMA_VALIDATION_FEATURE_ID

protected static final java.lang.String SCHEMA_VALIDATION_FEATURE_ID
Schema validation feature id (http://apache.org/xml/features/validation/schema).

See Also:
Constant Field Values
Constructor Detail

XMLUtil

public XMLUtil()
Method Detail

parseXMLContent

public static org.w3c.dom.Document parseXMLContent(java.lang.String xmlContent)
                                            throws XMLParserException
Parse the xmlContent string, verifying if the content is well-formed and validating with the schema, if it exists.

Parameters:
xmlContent - The xml content
Returns:
The document parsed
Throws:
XMLParserException - If there is a problem of validation or well-formed.

parseXMLFile

public static org.w3c.dom.Document parseXMLFile(java.lang.String fileName)
                                         throws XMLParserException,
                                                java.io.IOException
Parse the fileName in xml, verifying if the content is well-formed and validating with the schema, if it exists.

Parameters:
fileName - The xml file to be parsed
Returns:
The document parsed
Throws:
XMLParserException - If there is a problem of validation or well-formed.
java.io.IOException

getAttributeValue

public static java.lang.String getAttributeValue(java.lang.String nameLowerCase,
                                                 java.lang.String nameUpperCase,
                                                 org.w3c.dom.NamedNodeMap attributes)
Gets the string value of the given attribute name( nameLowerCase or nameUpperCase )

Parameters:
nameLowerCase - The name of the attribute in lowerCase
nameUpperCase - The name of the attribute in upperCase
attributes - The attributes where is the attribute finded