public function printXml()
{
header("X-WobResponse-Status: Error");
- print("<WobError type=\"".xq($this->etype)."\">".xq($this->estr)."</WobError>\n");
+ print("<WobError xmlns=\"http://silmor.de/PACK/Error\" type=\"".xq($this->etype)."\">".xq($this->estr)."</WobError>\n");
}
/**returns the error type*/
global $_SERVER;
if($_SERVER["REQUEST_METHOD"] != "POST"){
header("X-WobResponse-Status: Error");
- print("<WobError type=\"non-post\">".tr("Request is not a POST Request, Aborting.")."</WobError>\n");
+ print("<WobError xmlns=\"http://silmor.de/PACK/Error\" type=\"non-post\">".tr("Request is not a POST Request, Aborting.")."</WobError>\n");
exit();
}
if(!isset($_SERVER["HTTP_X_WOBREQUEST"])){
header("X-WobResponse-Status: Error");
- print("<WobError type=\"non-wob\">".tr("Request is not a Wob Request, Aborting.")."</WobError>\n");
+ print("<WobError xmlns=\"http://silmor.de/PACK/Error\" type=\"non-wob\">".tr("Request is not a Wob Request, Aborting.")."</WobError>\n");
exit();
}
self::$running=$_SERVER["HTTP_X_WOBREQUEST"];
protected function isAuthorized($transactioName){return false;}
/**stub: returns the name of the user (default returns empty string)*/
protected function userName(){return "";}
+
+ /**internal: returns an initialized XML array ("doc"=>DomDocument, "root"=>transaction rool DomElement)*/
+ protected function xmlCreate($elem){
+ $r=array();
+ $r["doc"]=new DOMDocument;
+ $r["root"]=$r["doc"]->createElementNS($this->xmlNamespace(),$elem);
+ return $r;
+ }
+
+ /**internal: converts XML array to string representation*/
+ protected function xmlToString($xml){
+ $xml["doc"]->appendChild($xml["root"]);
+ return $xml["doc"]->saveXml();
+ }
};
?>
\ No newline at end of file
{
QStringList sl=trn.outputNames();
QString code="\t/*start of output encoding*/\n";
- code+="\ttry{\n\t\t$xml=new DOMDocument;\n";
- code+="\t\t$root=$xml->createElement(\"WobResponse-"+trn.name()+"\");\n";
+ code+="\ttry{\n\t\t$xml=$this->xmlCreate(\"WobResponse-"+trn.name()+"\");\n";
+ code+="\t\t$root=$xml['root'];\n";
for(int i=0;i<sl.size();i++){
QString t=trn.outputType(sl[i]);
if(trn.isAttributeType(t)){
}
}
}
- code+="\t\t$xml->appendChild($root);\n";
code+="\t\theader(\"X-WobResponse-Status: Ok\");\n";
- code+="\t\tprint($xml->saveXml());\n";
+ code+="\t\tprint($this->xmlToString($xml));\n";
code+="\t}catch(Exception $e){$this->handleException($e);}\n";
code+="\t/*end of output*/\n";
return code;
m_transact.write(QString(" static public function svnVersion(){return \""+woc->svnRevision()+"\";}\n\n").toAscii());
m_transact.write(QString(" static public function svnRepositoryRoot(){return \""+woc->svnRepositoryRoot()+"\";}\n\n").toAscii());
m_transact.write(QString(" static public function svnRepositoryUrl(){return \""+woc->svnRepositoryUrl()+"\";}\n\n").toAscii());
+ m_transact.write(QString(" static public function xmlNamespace(){return \""+woc->xmlNamespace()+"\";}\n\n").toAscii());
}
void WocPHPTransaction::transInfo2()
m_wobDir=el.attribute("wobDir");
if(el.hasAttribute("name"))
m_projname=el.attribute("name");
+ m_xmlNS=el.attribute("xml-namespace");
}else
if(tn=="Include"){
if(!processFile(m_baseDir+"/"+m_wobDir+"/"+el.attribute("file")))
QString dbSchema()const{return m_dbSchema;}
/**returns the database schema version*/
QString dbVersion()const{return m_dbVer;}
+ /**returns the XML namespace of the project*/
+ QString xmlNamespace()const{return m_xmlNS;}
/**returns whether a table exists*/
bool hasTable(QString)const;
private:
QString m_baseDir,m_wobDir,m_verComm,m_verNeedComm,m_verHR,m_projname;
QString m_svnTarget,m_svnRev,m_svnExe,m_svnRoot,m_svnUrl;
- QString m_dbInst,m_dbSchema,m_dbVer;
+ QString m_dbInst,m_dbSchema,m_dbVer,m_xmlNS;
QStringList m_docstrings;
bool m_error,m_dbUpd;