public class XMLHandler
extends java.lang.Object
| Constructor and Description |
|---|
XMLHandler() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addQuestion(User user,
long surveyId,
java.lang.String questionXMLString)
Creates a Question object from an XML string, and adds it at the end of the
survey.
|
static long |
createSurvey(User user,
java.lang.String surveyXMLString,
long surveyGroupId)
Creates a survey object from an XML string, stores it in the database, and
puts the survey in a folder.
|
static java.lang.StringBuffer |
getQuestion(User user,
long surveyId,
int questionNo)
Gets the XML representation of a Question object.
|
static java.lang.String |
getQuestionXMLHeader(java.lang.String encoding)
Gets the XML header for an XML file containing a question.
|
static java.lang.StringBuffer |
getSurvey(User user,
long surveyId)
Gets the XML representation of a survey, by surveyId.
|
static java.lang.StringBuffer |
getSurveyDTD()
Gets the internal Survey DTD to be included in the XML file when exporting a survey.
|
static java.lang.String |
getSurveyXMLHeader(java.lang.String encoding)
Gets the XML header for an XML file containing a survey.
|
static java.lang.String |
getXMLVersionHeader(java.lang.String encoding)
Gets the XML header for XML file where DTD is included.
|
static void |
insertQuestion(User user,
long surveyId,
int questionNo,
java.lang.String questionXMLString)
Creates a Question object from an XML string, and inserts it in a survey.
|
static void |
writeSurvey(User user,
long surveyId,
boolean includeReports,
boolean includeResponses,
java.io.OutputStream out)
Writes XML representation of a survey to the output steam.
|
public static java.lang.StringBuffer getQuestion(User user, long surveyId, int questionNo) throws SurveySecurityException, SurveySystemException
getQuestionXMLHeader() to get the
header.user - User with access to the surveysurveyId - Id of the surveyquestionNo - The question numberSurveySecurityException - Thrown if the user is not authorized to
call this method.SurveySystemException - If an error occurs in the system.public static java.lang.String getQuestionXMLHeader(java.lang.String encoding)
encoding - The encoding used. If null, default encoding will be used
(ISO-8859-1)public static java.lang.StringBuffer getSurvey(User user, long surveyId) throws SurveySecurityException, SurveySystemException
getSurveyXMLHeader() to get the header. Reports are not included.user - User with access to the surveysurveyId - The survey idSurveySecurityException - Thrown if the user is not authorized to call this method.SurveySystemException - If an error occurs in the system.public static void writeSurvey(User user, long surveyId, boolean includeReports, boolean includeResponses, java.io.OutputStream out) throws SurveySecurityException, SurveySystemException, java.io.IOException
getSurveyXMLHeader() to get the header.user - User with access to the surveysurveyId - The survey idincludeReports - True if include reports in the XMLincludeResponses - True if include responses in the XMLout - Output streamSurveySecurityException - Thrown if the user is not authorized to call this method.SurveySystemException - If an error occurs in the system.java.io.IOExceptionpublic static java.lang.String getSurveyXMLHeader(java.lang.String encoding)
encoding - The encoding used. If null, default encoding will be used (ISO-8859-1)public static java.lang.String getXMLVersionHeader(java.lang.String encoding)
encoding - The encoding used. If null, default encoding will be
used (ISO-8859-1)public static java.lang.StringBuffer getSurveyDTD()
throws java.io.FileNotFoundException,
java.io.IOException
java.io.FileNotFoundExceptionjava.io.IOExceptionpublic static void addQuestion(User user, long surveyId, java.lang.String questionXMLString) throws ParsingException, SurveySystemException
questionXMLString - XML representation of the questionuser - User with access to the surveysurveyId - Survey idParsingException - If an error occurred while parsingSurveySystemException - If an error occurs in the system.public static long createSurvey(User user, java.lang.String surveyXMLString, long surveyGroupId) throws ParsingException, SurveySystemException
surveyXMLString - XML representing a Surveyuser - User with access to the surveysurveyGroupId - Survey group to put the survey inParsingException - If an error occurred while parsingSurveySystemException - If an error occurs in the system.public static void insertQuestion(User user, long surveyId, int questionNo, java.lang.String questionXMLString) throws ParsingException, SurveySystemException
questionXMLString - XML representation of the questionuser - User with access to the surveysurveyId - Survey idquestionNo - Position of the new questionParsingException - If an error occurred while parsingSurveySystemException - If an error occurs in the system.Built on July 29 2025