Пример #1
0
void MgResourceDefinitionManager::ValidateDocument(XmlDocument& xmlDoc)
{
    MG_RESOURCE_SERVICE_TRY()

    MgResourceIdentifier resource(MgUtil::MultiByteToWideChar(xmlDoc.getName()));

    // Skip XML schema validation on runtime resources.

    if (!resource.IsRuntimeResource())
    {
        std::string xmlContent;
        MgXmlUtil xmlUtil(xmlDoc.getContent(xmlContent));

        DOMElement* rootNode = xmlUtil.GetRootNode();
        if(NULL != rootNode)
        {
            assert(NULL != rootNode);

            STRING rootName;
            const XMLCh* tag = rootNode->getTagName();

            if (NULL != tag)
            {
                rootName = X2W(tag);
                assert(!rootName.empty());
            }

            STRING schemaName;
            const XMLCh* attr = rootNode->getAttribute(X("xsi:noNamespaceSchemaLocation"));

            if (NULL != attr)
            {
                schemaName = X2W(attr);
            }

            ValidateDocument(resource, rootName, schemaName);
        }
    }

    MG_RESOURCE_CONTAINER_CATCH_AND_THROW(L"MgResourceDefinitionManager.ValidateDocument")
}
Пример #2
0
/**
 * Returns data from pointing-device
 * (see PEN(x), osd_getpen(x))
 */
int dev_getpen(int code) {
  int result = 0;
  if (os_graphics) {
    result = osd_getpen(code);
    switch (code) {
    case 1:
    case 4:
    case 10:
      result = X2W(result);
      break;

    case 2:
    case 5:
    case 11:
      result = Y2W(result);
      break;
    }
  }
  return result;
}