本文整理汇总了C++中DOMImplementation::createDocument方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMImplementation::createDocument方法的具体用法?C++ DOMImplementation::createDocument怎么用?C++ DOMImplementation::createDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMImplementation
的用法示例。
在下文中一共展示了DOMImplementation::createDocument方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StrX
bool Module::WriteStaticXML (const string& xml_file) {
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(StrX("Core").XMLchar() );
if (impl==NULL) return false;
DOMDocument* doc = impl->createDocument( 0, StrX("PARAM").XMLchar(), 0);
DOMNode* topnode = doc->getFirstChild();
Parameters* parameters = m_seq_tree->GetParameters();
DOMNode* backup_node = parameters->GetNode();
XMLIO* xmlio = new XMLIO();
parameters->SetNode(topnode);
parameters->AddAllDOMattributes(false);
if ( ((DOMElement*) topnode)->getAttributeNode(StrX("Name").XMLchar()) != NULL)
((DOMElement*) topnode)->removeAttribute (StrX("Name").XMLchar());
parameters->SetNode(backup_node);
//recursively add elements
if (!StaticDOM(doc,topnode)) return false;
xmlio->Write (impl, topnode, xml_file);
delete doc;
delete topnode;
delete parameters;
delete backup_node;
delete xmlio;
return true;
}
示例2: Write
/* Write the file. */
bool GQCFileData::Write(const std::string &fileName)
{
// Initialize the XML4C2 system.
try
{
XMLPlatformUtils::Initialize();
}
catch (const XMLException&)
{
return false;
}
// Create a DOM implementation object and create the document type for it.
DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(ToXMLCh(L"LS"));
DOMDocument* doc = impl->createDocument();
//doc->setStandalone(true);
// Create the serializer.
DOMLSSerializer *theSerializer = ((DOMImplementationLS*)impl)->createLSSerializer();
DOMLSOutput *theOutputDesc = ((DOMImplementationLS*)impl)->createLSOutput();
//theSerializer->setEncoding(ToXMLCh(GENERIC_REPORT_FILE_ENCODING));
theOutputDesc->setEncoding(ToXMLCh(GENERIC_REPORT_FILE_ENCODING));
// Create the root element
DOMElement *rootElement = CreateGenericReportElement(doc);
// store the parameters
AddNameValuePairs(ANALYSIS_PARAMETERS, analysisParameters, doc, rootElement);
AddNameValuePairs(QC_RESULTS, qcResults, doc, rootElement);
AddNameValuePairs(SAMPLE_SIGNATURE, sampleSignature, doc, rootElement);
// Add an empty table (required by the DTD)
AddBlankReportTable(doc, rootElement);
// Store the element to the document.
doc->appendChild(rootElement);
// Write the file.
bool status = false;
XMLFormatTarget *myFormTarget = new LocalFileFormatTarget(fileName.c_str());
theOutputDesc->setByteStream(myFormTarget);
try
{
theSerializer->write(doc, theOutputDesc);
status = true;
}
catch (...)
{
status = false;
}
// Clean up
doc->release();
theOutputDesc->release();
theSerializer->release();
delete myFormTarget;
XMLPlatformUtils::Terminate();
return status;
}
示例3: main
int main()
{
XMLPlatformUtils::Initialize();
// Populate vector of items
vector<Item> items;
items.push_back(Item(Product("Toaster", 29.95), 3));
items.push_back(Item(Product("Hair dryer", 24.95), 1));
// Build the DOM document
DOMImplementation* implementation
= DOMImplementation::getImplementation();
DOMDocument* doc = implementation->createDocument();
doc->setStandalone(true);
DOMElement* root = create_item_list(doc, items);
doc->appendChild(root);
// Print the DOM document
DOMWriter* writer = implementation->createDOMWriter();
writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
XMLFormatTarget* out = new StdOutFormatTarget();
writer->writeNode(out, *doc);
writer->release();
doc->release();
return 0;
}
示例4: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
try
{
XMLPlatformUtils::Initialize();
}
catch(...)
{
return 1;
}
XMLCh* Path = NULL;
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(L"Core");
XERCES_CPP_NAMESPACE::DOMDocument* doc = impl->createDocument( 0, L"directory", 0);
if( argc >= 2)
Path = argv[1];
else
Path = L".\\";
SaveFileTreeToXML(Path, doc->getDocumentElement() ,doc);
PrintXMLdoc( doc );
doc->release();
XMLPlatformUtils::Terminate();
return 0;
}
示例5: createDocument
DOMDocument* Normalizer::createDocument() {
XMLCh coreStr[100];
XMLString::transcode("Core",coreStr,99);
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(coreStr);
return impl->createDocument();
};
示例6: initializeDOMDocumentTypeImpl
void XMLInitializer::initializeDOMDocumentTypeImpl()
{
sDocumentMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
static const XMLCh gCoreStr[] = { chLatin_C, chLatin_o, chLatin_r, chLatin_e, chNull };
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(gCoreStr);
sDocument = impl->createDocument(); // document type object (DTD).
}
示例7: XStr
void
check_svg_pssm_logo()
{
cout << "******* check_svg_pssm_logo()" << endl;
XMLPlatformUtils::Initialize();
DOMImplementation* impl
= DOMImplementation::getImplementation();
if (impl != NULL)
{
DOMDocumentType* doc_type
= impl->createDocumentType( XStr("svg"),
NULL,
XStr("svg-20000303-stylable.dtd") );
XERCES_CPP_NAMESPACE::DOMDocument * doc = impl->createDocument(
0, // root element namespace URI.
XStr("svg"), // root element name
doc_type); // document type object (DTD).
doc->setEncoding(XStr("UTF-8"));
add_logo_defs(doc);
TableLinkVec links;
links.push_back(TableLink(MATRIX_DATA, 37));
links.push_back(TableLink(MATRIX_DATA, 104));
links.push_back(TableLink(MATRIX_DATA, 236));
links.push_back(TableLink(MATRIX_DATA, 457));
for (TableLinkVec::const_iterator i = links.begin();
links.end() != i;
++i)
{
const Matrix * matrix = BiobaseDb::singleton().get_matrices()[*i].get();
const Pssm pssm = make_pssm(matrix);
const seq_t sequence =
(matrix->align_descs.begin() != matrix->align_descs.end())
? matrix->align_descs.begin()->get()->sequence
: "";
DOMElement * pssm_logo =
create_svg_pssm_logo(
pssm,
doc,
sequence);
set_attribute(pssm_logo, "x", 0);
set_attribute(pssm_logo, "y", BIO_NS::float_t(200 * (i - links.begin())));
set_attribute(pssm_logo, "height", 200);
set_attribute(pssm_logo, "width", BIO_NS::float_t(pssm.size() * 100));
doc->getDocumentElement()->appendChild(pssm_logo);
}
dom_print(doc->getDocumentElement(), "logo_test.svg");
}
XMLPlatformUtils::Terminate();
}
示例8: ApplyDelta
void DeltaApplyEngine::ApplyDelta(XID_DOMDocument *IncDeltaDoc, int backwardNumber) {
DOMNode* deltaRoot = IncDeltaDoc->getDocumentElement(); // <delta_unit>
DOMNode* deltaElement ;
for ( deltaElement = deltaRoot->getLastChild(); backwardNumber > 0; deltaElement = deltaElement->getPreviousSibling(), backwardNumber-- ) {
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(gLS);
DOMDocument* backwardDeltaDoc = impl->createDocument(0, XMLString::transcode(""),0);
//DOMDocument* backwardDeltaDoc = DOMDocument::createDocument();
DOMNode* backwardDeltaElement = XyDelta::ReverseDelta(backwardDeltaDoc, deltaElement);
ApplyDeltaElement(backwardDeltaElement);
}
}
示例9: jsDOMImplementationPrototypeFunctionCreateDocument
JSValue* jsDOMImplementationPrototypeFunctionCreateDocument(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSDOMImplementation::s_info))
return throwError(exec, TypeError);
JSDOMImplementation* castedThisObj = static_cast<JSDOMImplementation*>(thisValue);
DOMImplementation* imp = static_cast<DOMImplementation*>(castedThisObj->impl());
ExceptionCode ec = 0;
const UString& namespaceURI = valueToStringWithNullCheck(exec, args.at(exec, 0));
const UString& qualifiedName = valueToStringWithNullCheck(exec, args.at(exec, 1));
DocumentType* doctype = toDocumentType(args.at(exec, 2));
JSC::JSValue* result = toJS(exec, WTF::getPtr(imp->createDocument(namespaceURI, qualifiedName, doctype, ec)));
setDOMException(exec, ec);
return result;
}
示例10: CreateDocument
void ParameterManager::CreateDocument(void)
{
// creating a document from screatch
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(XStr("Core").unicodeForm());
delete _pDocument;
_pDocument = impl->createDocument(
0, // root element namespace URI.
XStr("FCParameters").unicodeForm(), // root element name
0); // document type object (DTD).
// creating the node for the root group
DOMElement* rootElem = _pDocument->getDocumentElement();
_pGroupNode = _pDocument->createElement(XStr("FCParamGroup").unicodeForm());
((DOMElement*)_pGroupNode)->setAttribute(XStr("Name").unicodeForm(), XStr("Root").unicodeForm());
rootElem->appendChild(_pGroupNode);
}
示例11:
//
// ILI2Handler
//
ILI2Handler::ILI2Handler( ILI2Reader *poReader ) {
m_poReader = poReader;
XMLCh *tmpCh = XMLString::transcode("CORE");
DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tmpCh);
XMLString::release(&tmpCh);
// the root element
tmpCh = XMLString::transcode("ROOT");
dom_doc = impl->createDocument(0,tmpCh,0);
XMLString::release(&tmpCh);
// the first element is root
dom_elem = dom_doc->getDocumentElement();
}
示例12: xiu
XERCES_CPP_NAMESPACE_BEGIN
DOMDocument *
XIncludeDOMDocumentProcessor::doXIncludeDOMProcess(const DOMDocument * const source, XMLErrorReporter *errorHandler, XMLEntityHandler* entityResolver /*=NULL*/){
XIncludeUtils xiu(errorHandler);
DOMImplementation* impl = source->getImplementation();
DOMDocument *xincludedDocument = impl->createDocument();
try
{
/* set up the declaration etc of the output document to match the source */
xincludedDocument->setDocumentURI( source->getDocumentURI());
xincludedDocument->setXmlStandalone( source->getXmlStandalone());
xincludedDocument->setXmlVersion( source->getXmlVersion());
/* copy entire source document into the xincluded document. Xincluded document can
then be modified in place */
DOMNode *child = source->getFirstChild();
for (; child != NULL; child = child->getNextSibling()){
if (child->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE){
/* I am simply ignoring these at the moment */
continue;
}
DOMNode *newNode = xincludedDocument->importNode(child, true);
xincludedDocument->appendChild(newNode);
}
DOMNode *docNode = xincludedDocument->getDocumentElement();
/* parse and include the document node */
xiu.parseDOMNodeDoingXInclude(docNode, xincludedDocument, entityResolver);
xincludedDocument->normalizeDocument();
}
catch(const XMLErrs::Codes)
{
xincludedDocument->release();
return NULL;
}
catch(...)
{
xincludedDocument->release();
throw;
}
return xincludedDocument;
}
示例13: jsDOMImplementationPrototypeFunctionCreateDocument
EncodedJSValue JSC_HOST_CALL jsDOMImplementationPrototypeFunctionCreateDocument(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSDOMImplementation::s_info))
return throwVMTypeError(exec);
JSDOMImplementation* castedThis = static_cast<JSDOMImplementation*>(asObject(thisValue));
DOMImplementation* imp = static_cast<DOMImplementation*>(castedThis->impl());
ExceptionCode ec = 0;
const String& namespaceURI = valueToStringWithNullCheck(exec, exec->argument(0));
const String& qualifiedName = valueToStringWithNullCheck(exec, exec->argument(1));
DocumentType* doctype = toDocumentType(exec->argument(2));
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createDocument(namespaceURI, qualifiedName, doctype, ec)));
setDOMException(exec, ec);
return JSValue::encode(result);
}
示例14: writeXMLFile
//-----------------------------------------------------------------------
void XercesWriter::writeXMLFile(const XMLNode* root, const Ogre::String& filename)
{
XERCES_CPP_NAMESPACE_USE;
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(L"Core");
DOMDocumentType* docType = NULL;
DOMDocument* doc = impl->createDocument(NULL, transcode(root->getName()).c_str(), docType);
populateDOMElement(root, doc->getDocumentElement());
LocalFileFormatTarget destination(filename.c_str());
DOMWriter* writer = impl->createDOMWriter();
writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
writer->writeNode(&destination, *doc);
writer->release();
doc->release();
}
示例15: ProcessMessage
AbstractFilter::FilterResult TemplateTransformFilter::ProcessMessage( AbstractFilter::buffer_type inputData, AbstractFilter::buffer_type outputData, NameValueCollection& transportHeaders, bool asClient )
{
ValidateProperties();
// only support swift for now
if ( m_Properties[ TemplateTransformFilter::TEMPLATE_FILE ].find( ".template.xml" ) != string::npos )
{
TemplateParser parser = TemplateParserFactory::getParser( m_Properties[ TemplateTransformFilter::TEMPLATE_FILE ] );
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *output = NULL;
try
{
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation( unicodeForm( "LS" ) );
output = impl->createDocument( 0, unicodeForm( "root" ), 0 );
ProcessMessage( inputData, output, transportHeaders, asClient );
string serializedDoc = XmlUtil::SerializeToString( output );
outputData.get()->copyFrom( serializedDoc );
if ( output != NULL )
{
output->release();
output = NULL;
}
}
catch( ... )
{
if ( output != NULL )
{
output->release();
output = NULL;
}
}
return AbstractFilter::Completed;
}
else
{
string message( "Invalid template : " );
message.append( m_Properties[ TemplateTransformFilter::TEMPLATE_FILE ] );
throw invalid_argument( message );
}
}