本文整理汇总了C++中DOMImplementation类的典型用法代码示例。如果您正苦于以下问题:C++ DOMImplementation类的具体用法?C++ DOMImplementation怎么用?C++ DOMImplementation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DOMImplementation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
/* 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;
}
示例2: 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;
}
示例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: createDocument
DOMDocument* Normalizer::createDocument() {
XMLCh coreStr[100];
XMLString::transcode("Core",coreStr,99);
DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(coreStr);
return impl->createDocument();
};
示例5: _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;
}
示例6: getDOMImplementation
DOMImplementation* XQillaImplementation::getDOMImplementation(const XMLCh* features) const
{
DOMImplementation* impl = XQillaImplementation::getDOMImplementationImpl();
XMLStringTokenizer tokenizer(features);
const XMLCh* feature = 0;
while (feature || tokenizer.hasMoreTokens()) {
if (!feature)
feature = tokenizer.nextToken();
const XMLCh* version = 0;
const XMLCh* token = tokenizer.nextToken();
if (token && XMLString::isDigit(token[0]))
version = token;
if (!impl->hasFeature(feature, version))
return 0;
if (!version)
feature = token;
}
return impl;
}
示例7: XMLMutex
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).
}
示例8: check_svg_pssm_logo
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();
}
示例9: MemoryManagerImpl
XMLParser::XMLParser() {
using namespace xercesc;
namespace xml = xsd::cxx::xml;
namespace tree = xsd::cxx::tree;
_memMgr = new MemoryManagerImpl();
_grammarPool = new XMLGrammarPoolImpl(_memMgr);
const XMLCh ls_id [] = {chLatin_L, chLatin_S, chNull};
// Get an implementation of the Load-Store (LS) interface.
//
DOMImplementation* impl (
DOMImplementationRegistry::getDOMImplementation (ls_id));
// Create a DOMBuilder.
//
// TODO: make this a class-member and initialize just once
parser = impl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0, _memMgr, _grammarPool);
// Discard comment nodes in the document.
//
parser->setFeature (XMLUni::fgDOMComments, false);
// Enable datatype normalization.
//
parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true);
// Do not create EntityReference nodes in the DOM tree. No
// EntityReference nodes will be created, only the nodes
// corresponding to their fully expanded substitution text
// will be created.
//
//parser->setFeature (XMLUni::fgDOMEntities, false);
parser->setFeature (XMLUni::fgDOMEntities, true);
// Perform Namespace processing.
//
parser->setFeature (XMLUni::fgDOMNamespaces, true);
// Do not include ignorable whitespace in the DOM tree.
//
parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false);
parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false);
// We will release the DOM document ourselves.
//
parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true);
// Enable grammar caching and load known grammars
parser->loadGrammar((INSTALL_PREFIX + std::string("/etc/xbe/schema/xbe-msg.xsd")).c_str(), Grammar::SchemaGrammarType, true);
parser->loadGrammar((INSTALL_PREFIX + std::string("/etc/xbe/schema/dsig.xsd")).c_str(), Grammar::SchemaGrammarType, true);
parser->setFeature(XMLUni::fgXercesUseCachedGrammarInParse, true);
}
示例10: visitDOMWrapper
void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
{
WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
if (typeInfo->isSubclass(&V8StyleSheetList::info)) {
StyleSheetList* styleSheetList = static_cast<StyleSheetList*>(object);
GroupId groupId(styleSheetList);
if (Document* document = styleSheetList->document())
groupId = GroupId(document);
m_grouper.append(GrouperItem(groupId, wrapper));
} else if (typeInfo->isSubclass(&V8DOMImplementation::info)) {
DOMImplementation* domImplementation = static_cast<DOMImplementation*>(object);
GroupId groupId(domImplementation);
if (Document* document = domImplementation->document())
groupId = GroupId(document);
m_grouper.append(GrouperItem(groupId, wrapper));
} else if (typeInfo->isSubclass(&V8StyleSheet::info) || typeInfo->isSubclass(&V8CSSRule::info)) {
m_grouper.append(GrouperItem(calculateGroupId(static_cast<StyleBase*>(object)), wrapper));
#if 0 //CMP_ERROR_UNCLEAR CSSMutableStyleDeclaration
} else if (typeInfo->isSubclass(&V8CSSStyleDeclaration::info)) {
CSSStyleDeclaration* cssStyleDeclaration = static_cast<CSSStyleDeclaration*>(object);
GroupId groupId = calculateGroupId(cssStyleDeclaration);
m_grouper.append(GrouperItem(groupId, wrapper));
// Keep alive "dirty" primitive values (i.e. the ones that
// have user-added properties) by creating implicit
// references between the style declaration and the values
// in it.
if (cssStyleDeclaration->isMutableStyleDeclaration()) {
CSSMutableStyleDeclaration* cssMutableStyleDeclaration = static_cast<CSSMutableStyleDeclaration*>(cssStyleDeclaration);
Vector<v8::Persistent<v8::Value> > values;
values.reserveCapacity(cssMutableStyleDeclaration->length());
CSSMutableStyleDeclaration::const_iterator end = cssMutableStyleDeclaration->end();
for (CSSMutableStyleDeclaration::const_iterator it = cssMutableStyleDeclaration->begin(); it != end; ++it) {
v8::Persistent<v8::Object> value = store->domObjectMap().get(it->value());
if (!value.IsEmpty() && value->IsDirty())
values.append(value);
}
if (!values.isEmpty())
v8::V8::AddImplicitReferences(wrapper, values.data(), values.size());
}
} else if (typeInfo->isSubclass(&V8CSSRuleList::info)) {
CSSRuleList* cssRuleList = static_cast<CSSRuleList*>(object);
GroupId groupId(cssRuleList);
StyleList* styleList = cssRuleList->styleList();
if (styleList)
groupId = calculateGroupId(styleList);
m_grouper.append(GrouperItem(groupId, wrapper));
#endif
}
}
示例11: runTest
/*
* Runs the test case.
*/
void runTest()
{
Document doc;
DOMImplementation docImpl;
boolean state;
doc = (Document) baseT::load("staff", false);
docImpl = doc.getImplementation();
state = docImpl.hasFeature(SA::construct_from_utf8("XML"), SA::construct_from_utf8("1.0"));
assertTrue(state);
}
示例12: jsDOMImplementationPrototypeFunctionCreateHTMLDocument
JSValue* jsDOMImplementationPrototypeFunctionCreateHTMLDocument(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());
const UString& title = args.at(exec, 0)->toString(exec);
JSC::JSValue* result = toJS(exec, WTF::getPtr(imp->createHTMLDocument(title)));
return result;
}
示例13: jsDOMImplementationPrototypeFunctionCreateHTMLDocument
JSValue JSC_HOST_CALL jsDOMImplementationPrototypeFunctionCreateHTMLDocument(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSDOMImplementation::s_info))
return throwError(exec, TypeError);
JSDOMImplementation* castedThisObj = static_cast<JSDOMImplementation*>(asObject(thisValue));
DOMImplementation* imp = static_cast<DOMImplementation*>(castedThisObj->impl());
const UString& title = args.at(0).toString(exec);
JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->createHTMLDocument(title)));
return result;
}
示例14: jsDOMImplementationPrototypeFunctionHasFeature
JSValue* jsDOMImplementationPrototypeFunctionHasFeature(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());
const UString& feature = args.at(exec, 0)->toString(exec);
const UString& version = valueToStringWithNullCheck(exec, args.at(exec, 1));
JSC::JSValue* result = jsBoolean(imp->hasFeature(feature, version));
return result;
}
示例15: jsDOMImplementationPrototypeFunctionCreateHTMLDocument
EncodedJSValue JSC_HOST_CALL jsDOMImplementationPrototypeFunctionCreateHTMLDocument(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());
const String& title = ustringToString(exec->argument(0).toString(exec));
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createHTMLDocument(title)));
return JSValue::encode(result);
}