void XsltTransformViewer::onLoad() { ViewerBase::onLoad(); shared_ptr<XMLNode> root = getModuleDocument()->getRoot(); if(root != nullptr) { String xmlStr = root->getAttributeString(OS_MODULES_XSLTTRANSFORM_XML); String xslStr = root->getAttributeString(OS_MODULES_XSLTTRANSFORM_XSL); String xsdStr = root->getAttributeString(OS_MODULES_XSLTTRANSFORM_XSD); shared_ptr<XMLDocument> document; if(xsdStr.empty()) { document.reset(OS_NEW XMLDocument()); } else { shared_ptr<XMLSchema> xsd(OS_NEW XMLSchema()); xsd->parseString(xsdStr); document.reset(OS_NEW XMLDocument(xsd)); } if(document->parseString(xmlStr)) { shared_ptr<XMLStylesheet> transformer(OS_NEW XMLStylesheet()); // Inizializza le funzioni del template getPage()->initStylesheet(transformer); if(transformer->parseString(xslStr)) { String output; if(transformer->applyToString(document, output)) { getControls()->add(shared_ptr<HtmlLiteral>(OS_NEW HtmlLiteral(getPage()->parseOml(output, true, false, false, omlRenderModeOsiris, getInstance().getString())))); } } } } }
bool IdeSkin::loadXml(const String &path) { shared_ptr<XMLSchema> schema(OS_NEW XMLSchema()); schema->parseFile(_getSchemaPath()); shared_ptr<XMLDocument> document(OS_NEW XMLDocument(schema)); // Carica l'xml della skin if(document->parseFile(path) == false) return false; // Carica la skin if(read(document) == false) { unload(); // N.B.: resetta i dati eventualmente caricati (non rimuovere) return false; } m_valid = true; return true; }
shared_ptr<XMLSchema> XMLSchema::fromBuffer(const Buffer &buffer) { shared_ptr<XMLSchema> schema(OS_NEW XMLSchema()); schema->parseBuffer(buffer); return schema; }
shared_ptr<XMLSchema> XMLSchema::fromString(const String &str) { shared_ptr<XMLSchema> schema(OS_NEW XMLSchema()); schema->parseString(str); return schema; }
shared_ptr<XMLSchema> XMLSchema::fromFile(const String &filename) { shared_ptr<XMLSchema> schema(OS_NEW XMLSchema()); schema->parseFile(filename); return schema; }