Enable turning-off schema validation regardless of XML PAL.

This commit is contained in:
Phil Smith 2018-03-19 16:07:36 -07:00
Родитель 579950f4d2
Коммит b7364bccf0
9 изменённых файлов: 50 добавлений и 19 удалений

Просмотреть файл

@ -127,6 +127,10 @@ ELSE()
ENDIF()
# Enforce parser PAL
IF(NOT USE_VALIDATION_PARSER)
MESSAGE (STATUS "To choose type of validation, Use the -DUSE_VALIDATION_PARSER=on to enable. Default is 'off'")
ENDIF()
IF(NOT XML_PARSER)
MESSAGE (STATUS "Choose the type of parser, options are: [xerces, msxml6]. Use the -DXML_PARSER=[option] to specify.")
INCLUDE(CheckIncludeFileCXX)

Просмотреть файл

@ -19,7 +19,7 @@ if(NOT WIN32) # Always add the certs for non-Windows.
"certs/Microsoft_MarketPlace_PCA_2011.cer")
endif()
#if(USE_VALIDATION_PARSER) turn on when there's an implementation of XmlLite/LibXml2
if(USE_VALIDATION_PARSER)
list(APPEND RESOURCES_CONTENTTYPE
"AppxPackaging/[Content_Types]/opc-contentTypes.xsd")
@ -69,7 +69,7 @@ else() # xerces
# TODO: make changes required to make the xsds WC3 compliant.
endif()
#endif() USE_VALIDATION_PARSER
endif(USE_VALIDATION_PARSER)
# Create zip file. Use execute_process to run the command while CMake is procesing.
message(STATUS "Resource files:")

Просмотреть файл

@ -1,21 +1,29 @@
@echo off
set var=%1
set val=%2
echo var = %var%
echo val = %val%
IF /I "%val%" == "NO_VALIDATE" (
set val="-DUSE_VALIDATION_PARSER=off"
) ELSE (
set val="-DUSE_VALIDATION_PARSER=on"
)
IF /I "%var%" == "WIN32" (
echo calling makewin32.cmd
call makewin32.cmd
echo calling makewin32.cmd %val%
call makewin32.cmd %val%
) ELSE (
IF /I "%var%" == "WIN32-x64" (
echo calling makewin32x64.cmd
call makewin32x64.cmd
echo calling makewin32x64.cmd %val%
call makewin32x64.cmd %val%
) ELSE (
IF /I "%var%" == "WIN32chk" (
echo calling makewin32chk.cmd
call makewin32chk.cmd
echo calling makewin32chk.cmd %val%
call makewin32chk.cmd %val%
) ELSE (
IF /I "%var%" == "WIN32-x64chk" (
echo calling makewin32x64chk.cmd
call makewin32x64chk.cmd
echo calling makewin32x64chk.cmd %val%
call makewin32x64chk.cmd %val%
) ELSE (
goto FAIL
)
@ -24,7 +32,8 @@ IF /I "%var%" == "WIN32" (
)
goto EXIT
:FAIL
echo specify one of [WIN32, WIN32-x64, WIN32chk, WIN32-x64chk]
echo specify one of [WIN32, WIN32-x64, WIN32chk, WIN32-x64chk] for 1st option
echo specify NO_VALIDATE for 2nd option to disable XML schema validation.
EXIT /B 0
:Exit
echo done.

Просмотреть файл

@ -4,5 +4,5 @@ cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 -G"NMake Makefiles" ..
nmake

Просмотреть файл

@ -4,5 +4,5 @@ cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug %1 -G"NMake Makefiles" ..
nmake

Просмотреть файл

@ -4,5 +4,5 @@ cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 -G"NMake Makefiles" ..
nmake

Просмотреть файл

@ -4,5 +4,5 @@ cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug %1 -G"NMake Makefiles" ..
nmake

Просмотреть файл

@ -22,12 +22,10 @@ IF (XML_PARSER MATCHES msxml6)
SET (USING_MSXML=1)
ENDIF()
IF(WIN32)
SET (DirectoryObject PAL/FileSystem/Win32/DirectoryObject.CPP)
SET (SHA256 PAL/SHA256/Win32/SHA256.CPP)
SET (Signature PAL/Signature/Win32/SignatureValidator.cpp)
SET (MSIX_API=1)
ELSE()
# Visibility variables for non-win32 platforms
IF((IOS) OR (MACOS))
@ -61,10 +59,18 @@ ELSE()
SET (DirectoryObject PAL/FileSystem/POSIX/DirectoryObject.cpp)
ENDIF()
IF(USE_VALIDATION_PARSER)
MESSAGE (STATUS "PAL: VALIDATING parser" )
add_definitions(-DVALIDATING=1)
ELSE()
MESSAGE (STATUS "PAL: non-validating parser" )
add_definitions(-DVALIDATING=0)
ENDIF()
MESSAGE (STATUS "PAL: XML = ${XmlParser}")
MESSAGE (STATUS "PAL: DirectoryObject = ${DirectoryObject}")
MESSAGE (STATUS "PAL: SHA256 = ${SHA256}")
MESSAGE (STATUS "PAL: Signature = ${Signature}")
MESSAGE (STATUS "PAL: XML = ${XmlParser}")
include(msix_resources)

Просмотреть файл

@ -529,8 +529,20 @@ public:
ComPtr<IXmlDom> CreateDomFromStream(XmlContentType footPrintType, ComPtr<IStream>& stream) override
{
#if VALIDATING
bool HasIgnorableNamespaces = (XmlContentType::AppxManifestXml == footPrintType);
return ComPtr<IXmlDom>::Make<MSXMLDom>(stream, xmlNamespaces.at(footPrintType), m_factory, HasIgnorableNamespaces);
#else
bool HasIgnorableNamespaces = false;
NamespaceManager emptyManager;
#endif
return ComPtr<IXmlDom>::Make<MSXMLDom>(stream,
#if VALIDATING
xmlNamespaces.at(footPrintType),
#else
emptyManager,
#endif
m_factory, HasIgnorableNamespaces);
}
protected: