VirtualBox

source: vbox/trunk/src/VBox/Main/VirtualBoxXMLUtil.cpp@ 3254

Last change on this file since 3254 was 2981, checked in by vboxsync, 17 years ago

InnoTek -> innotek: all the headers and comments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/** @file
2 *
3 * VirtualBox XML utility class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#include "VirtualBoxXMLUtil.h"
23#include "VirtualBoxXMLUtil_entities.h"
24#include "VirtualBoxXMLUtil_common_entities.h"
25#include "Logging.h"
26
27#include <VBox/err.h>
28
29#include <string.h>
30
31/**
32 * Callback to resolve external entities when parsing and validating
33 * VirtualBox settings files (see FNCFGLDRENTITYRESOLVER).
34 */
35// static
36DECLCALLBACK(int) VirtualBoxXMLUtil::cfgLdrEntityResolver (
37 const char *pcszPublicId,
38 const char *pcszSystemId,
39 const char *pcszBaseURI,
40 PCFGLDRENTITY pEntity)
41{
42 Assert (pEntity);
43 if (!pEntity)
44 return VERR_INVALID_POINTER;
45
46#if 0
47 LogFlow (("VirtualBoxXMLUtil::cfgLdrEntityResolver():\n"
48 " publicId='%s', systemId='%s', baseURI='%s'\n",
49 pcszPublicId, pcszSystemId, pcszBaseURI));
50#endif
51
52 if (!strcmp (pcszSystemId, VBOX_XML_SCHEMA_COMMON))
53 {
54 pEntity->enmType = CFGLDRENTITYTYPE_MEMORY;
55 pEntity->u.memory.puchBuf = (unsigned char*)g_abVirtualBox_settings_common_xsd;
56 pEntity->u.memory.cbBuf = g_cbVirtualBox_settings_common_xsd;
57 pEntity->u.memory.bFree = false;
58 return VINF_SUCCESS;
59 }
60 else
61 if (!strcmp (pcszSystemId, VBOX_XML_SCHEMA))
62 {
63 pEntity->enmType = CFGLDRENTITYTYPE_MEMORY;
64 pEntity->u.memory.puchBuf = (unsigned char*)g_abVirtualBox_settings_xsd;
65 pEntity->u.memory.cbBuf = g_cbVirtualBox_settings_xsd;
66 pEntity->u.memory.bFree = false;
67 return VINF_SUCCESS;
68 }
69 else
70 {
71 AssertMsgFailed (("Unexpected entity: '%s' - knows: '%s' and '%s'\n", pcszSystemId, VBOX_XML_SCHEMA_COMMON, VBOX_XML_SCHEMA));
72 return VERR_GENERAL_FAILURE;
73 }
74
75 return VINF_SUCCESS;
76}
77
78// static
79const char *VirtualBoxXMLUtil::XmlSchemaNS = VBOX_XML_NAMESPACE " " VBOX_XML_SCHEMA;
80
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette