Beispiel #1
0
void SYSTEM::CXMLConfiguration::Save()
{
    DOMLSSerializer *ss = ((DOMImplementationLS*)impl)->createLSSerializer();
    if(xmlFile.length() == 0)
    {
        //InfoLog("Cann't save file. The file name is null");
        return;
    }
    XMLCh *t = XMLString::transcode(xmlFile.c_str());
    ss->writeToURI((XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument*)doc,t);
    XMLString::release(&m_curValue);
}
void Deployment_Plan_Visitor::write_document (const std::string & basename)
{
  std::ostringstream filename;
  filename << this->config_.output_ << "\\" << basename << ".cdp";

  using namespace xercesc;

  // Write the XML document to a file.
  DOMLSSerializer * serializer = this->document_->impl ()->createLSSerializer ();

  if (serializer->getDomConfig ()->canSetParameter (XMLUni::fgDOMWRTDiscardDefaultContent, true))
    serializer->getDomConfig ()->setParameter (XMLUni::fgDOMWRTDiscardDefaultContent, true);

  if (serializer->getDomConfig ()->canSetParameter (XMLUni::fgDOMWRTFormatPrettyPrint, true))
    serializer->getDomConfig ()->setParameter (XMLUni::fgDOMWRTFormatPrettyPrint, true);

  if (serializer->getDomConfig ()->canSetParameter (XMLUni::fgDOMWRTBOM, false))
    serializer->getDomConfig ()->setParameter (XMLUni::fgDOMWRTBOM, false);

  serializer->writeToURI (this->document_->root (), GAME::Xml::String (filename.str ()));
  serializer->release ();
}