summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--appveyor.yml2
-rw-r--r--scripts/pugixml_vs2013.vcxproj199
-rw-r--r--scripts/pugixml_vs2013_static.vcxproj199
-rw-r--r--src/pugixml.cpp42
-rw-r--r--tests/test_document.cpp70
-rw-r--r--tests/test_dom_modify.cpp170
-rw-r--r--tests/test_dom_text.cpp6
-rw-r--r--tests/test_parse.cpp64
-rw-r--r--tests/test_parse_doctype.cpp6
-rw-r--r--tests/test_write.cpp12
10 files changed, 587 insertions, 183 deletions
diff --git a/appveyor.yml b/appveyor.yml
index 3f09dd9..b32d333 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -2,7 +2,7 @@ os: Visual Studio 2015 RC
version: "{branch}-{build}"
install:
- - ps: (new-object net.webclient).DownloadFile('http://downloads.coapp.org/files/CoApp.Tools.Powershell.msi', 'C:\CoApp.Tools.Powershell.msi')
+ - ps: (new-object net.webclient).DownloadFile('http://coapp.org/files/CoApp.Tools.Powershell.msi', 'C:\CoApp.Tools.Powershell.msi')
- ps: Start-Process -FilePath msiexec -ArgumentList /i, 'C:\CoApp.Tools.Powershell.msi', /quiet -Wait
- ps: $env:PSModulePath = $env:PSModulePath + ';C:\Program Files (x86)\Outercurve Foundation\Modules'
- ps: Import-Module CoApp
diff --git a/scripts/pugixml_vs2013.vcxproj b/scripts/pugixml_vs2013.vcxproj
new file mode 100644
index 0000000..630a75a
--- /dev/null
+++ b/scripts/pugixml_vs2013.vcxproj
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{89A1E353-E2DC-495C-B403-742BE206ACED}</ProjectGuid>
+ <RootNamespace>pugixml</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2013\x32\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2013\x32\Debug\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">pugixmld</TargetName>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2013\x64\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2013\x64\Debug\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pugixmld</TargetName>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2013\x32\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2013\x32\Release\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pugixml</TargetName>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2013\x64\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2013\x64\Release\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">pugixml</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)pugixmld.lib</OutputFile>
+ </Lib>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDataBaseFileName>$(OutDir)pugixmld.pdb</ProgramDataBaseFileName>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)pugixmld.lib</OutputFile>
+ </Lib>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDataBaseFileName>$(OutDir)pugixmld.pdb</ProgramDataBaseFileName>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)pugixml.lib</OutputFile>
+ </Lib>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)pugixml.lib</OutputFile>
+ </Lib>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ProgramDataBaseFileName>$(OutDir)pugixml.pdb</ProgramDataBaseFileName>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\src\pugixml.hpp" />
+ <ClInclude Include="..\src\pugiconfig.hpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\src\pugixml.cpp">
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/scripts/pugixml_vs2013_static.vcxproj b/scripts/pugixml_vs2013_static.vcxproj
new file mode 100644
index 0000000..b948cf6
--- /dev/null
+++ b/scripts/pugixml_vs2013_static.vcxproj
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{89A1E353-E2DC-495C-B403-742BE206ACED}</ProjectGuid>
+ <RootNamespace>pugixml</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2013\x32\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">vs2013\x32\DebugStatic\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">pugixmlsd</TargetName>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2013\x64\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">vs2013\x64\DebugStatic\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pugixmlsd</TargetName>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2013\x32\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">vs2013\x32\ReleaseStatic\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">pugixmls</TargetName>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2013\x64\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">vs2013\x64\ReleaseStatic\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">pugixmls</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)pugixmlsd.lib</OutputFile>
+ </Lib>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDataBaseFileName>$(OutDir)pugixmlsd.pdb</ProgramDataBaseFileName>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)pugixmlsd.lib</OutputFile>
+ </Lib>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDataBaseFileName>$(OutDir)pugixmlsd.pdb</ProgramDataBaseFileName>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)pugixmls.lib</OutputFile>
+ </Lib>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ProgramDataBaseFileName>$(OutDir)pugixmls.pdb</ProgramDataBaseFileName>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)pugixmls.lib</OutputFile>
+ </Lib>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ProgramDataBaseFileName>$(OutDir)pugixmls.pdb</ProgramDataBaseFileName>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="..\src\pugixml.hpp" />
+ <ClInclude Include="..\src\pugiconfig.hpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\src\pugixml.cpp">
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index c8d72ce..fc48701 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -234,8 +234,10 @@ PUGI__NS_END
// auto_ptr-like object for exception recovery
PUGI__NS_BEGIN
- template <typename T, typename D = void(*)(T*)> struct auto_deleter
+ template <typename T> struct auto_deleter
{
+ typedef void (*D)(T*);
+
T* data;
D deleter;
@@ -401,14 +403,6 @@ PUGI__NS_END
#endif
PUGI__NS_BEGIN
- static const size_t xml_memory_page_size =
- #ifdef PUGIXML_MEMORY_PAGE_SIZE
- PUGIXML_MEMORY_PAGE_SIZE
- #else
- 32768
- #endif
- ;
-
#ifdef PUGIXML_COMPACT
static const uintptr_t xml_memory_block_alignment = 4;
#else
@@ -474,6 +468,14 @@ PUGI__NS_BEGIN
#endif
};
+ static const size_t xml_memory_page_size =
+ #ifdef PUGIXML_MEMORY_PAGE_SIZE
+ (PUGIXML_MEMORY_PAGE_SIZE)
+ #else
+ 32768
+ #endif
+ - sizeof(xml_memory_page);
+
struct xml_memory_string_header
{
uint16_t page_offset; // offset from page->data
@@ -4012,7 +4014,10 @@ PUGI__NS_BEGIN
{
if (!node->first_child)
{
- writer.write(' ', '/', '>');
+ if ((flags & format_raw) == 0)
+ writer.write(' ');
+
+ writer.write('/', '>');
return false;
}
@@ -4706,6 +4711,11 @@ PUGI__NS_BEGIN
return load_buffer_impl(doc, doc, contents, zero_terminate_buffer(contents, size, real_encoding), options, real_encoding, true, true, out_buffer);
}
+ PUGI__FN void close_file(FILE* file)
+ {
+ fclose(file);
+ }
+
#ifndef PUGIXML_NO_STL
template <typename T> struct xml_stream_chunk
{
@@ -6865,8 +6875,7 @@ namespace pugi
reset();
using impl::auto_deleter; // MSVC7 workaround
- typedef int (*fclose_t)(FILE*); // BCC5 workaround
- auto_deleter<FILE, fclose_t> file(fopen(path_, "rb"), fclose);
+ auto_deleter<FILE> file(fopen(path_, "rb"), impl::close_file);
return impl::load_file_impl(static_cast<impl::xml_document_struct*>(_root), file.data, options, encoding, &_buffer);
}
@@ -6876,8 +6885,7 @@ namespace pugi
reset();
using impl::auto_deleter; // MSVC7 workaround
- typedef int (*fclose_t)(FILE*); // BCC5 workaround
- auto_deleter<FILE, fclose_t> file(impl::open_file_wide(path_, L"rb"), fclose);
+ auto_deleter<FILE> file(impl::open_file_wide(path_, L"rb"), impl::close_file);
return impl::load_file_impl(static_cast<impl::xml_document_struct*>(_root), file.data, options, encoding, &_buffer);
}
@@ -6950,8 +6958,7 @@ namespace pugi
PUGI__FN bool xml_document::save_file(const char* path_, const char_t* indent, unsigned int flags, xml_encoding encoding) const
{
using impl::auto_deleter; // MSVC7 workaround
- typedef int (*fclose_t)(FILE*); // BCC5 workaround
- auto_deleter<FILE, fclose_t> file(fopen(path_, (flags & format_save_file_text) ? "w" : "wb"), fclose);
+ auto_deleter<FILE> file(fopen(path_, (flags & format_save_file_text) ? "w" : "wb"), impl::close_file);
return impl::save_file_impl(*this, file.data, indent, flags, encoding);
}
@@ -6959,8 +6966,7 @@ namespace pugi
PUGI__FN bool xml_document::save_file(const wchar_t* path_, const char_t* indent, unsigned int flags, xml_encoding encoding) const
{
using impl::auto_deleter; // MSVC7 workaround
- typedef int (*fclose_t)(FILE*); // BCC5 workaround
- auto_deleter<FILE, fclose_t> file(impl::open_file_wide(path_, (flags & format_save_file_text) ? L"w" : L"wb"), fclose);
+ auto_deleter<FILE> file(impl::open_file_wide(path_, (flags & format_save_file_text) ? L"w" : L"wb"), impl::close_file);
return impl::save_file_impl(*this, file.data, indent, flags, encoding);
}
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index eba2fd4..b442126 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -68,7 +68,7 @@ TEST(document_create)
{
pugi::xml_document doc;
doc.append_child().set_name(STR("node"));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
#ifndef PUGIXML_NO_STL
@@ -78,7 +78,7 @@ TEST(document_load_stream)
std::istringstream iss("<node/>");
CHECK(doc.load(iss));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_stream_offset)
@@ -91,7 +91,7 @@ TEST(document_load_stream_offset)
iss >> s;
CHECK(doc.load(iss));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_stream_text)
@@ -100,7 +100,7 @@ TEST(document_load_stream_text)
std::ifstream iss("tests/data/multiline.xml");
CHECK(doc.load(iss));
- CHECK_NODE(doc, STR("<node1 /><node2 /><node3 />"));
+ CHECK_NODE(doc, STR("<node1/><node2/><node3/>"));
}
TEST(document_load_stream_error)
@@ -130,7 +130,7 @@ TEST(document_load_stream_wide)
std::basic_istringstream<wchar_t> iss(L"<node/>");
CHECK(doc.load(iss));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
#ifndef PUGIXML_NO_EXCEPTIONS
@@ -201,7 +201,7 @@ TEST(document_load_stream_nonseekable)
pugi::xml_document doc;
CHECK(doc.load(in));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_stream_wide_nonseekable)
@@ -212,14 +212,14 @@ TEST(document_load_stream_wide_nonseekable)
pugi::xml_document doc;
CHECK(doc.load(in));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_stream_nonseekable_large)
{
std::basic_string<pugi::char_t> str;
str += STR("<node>");
- for (int i = 0; i < 10000; ++i) str += STR("<node />");
+ for (int i = 0; i < 10000; ++i) str += STR("<node/>");
str += STR("</node>");
char_array_buffer<pugi::char_t> buffer(&str[0], &str[0] + str.length());
@@ -264,7 +264,7 @@ TEST(document_load_string)
pugi::xml_document doc;
CHECK(doc.load_string(STR("<node/>")));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_file)
@@ -272,7 +272,7 @@ TEST(document_load_file)
pugi::xml_document doc;
CHECK(doc.load_file("tests/data/small.xml"));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_file_empty)
@@ -291,7 +291,7 @@ TEST(document_load_file_large)
std::basic_string<pugi::char_t> str;
str += STR("<node>");
- for (int i = 0; i < 10000; ++i) str += STR("<node />");
+ for (int i = 0; i < 10000; ++i) str += STR("<node/>");
str += STR("</node>");
CHECK_NODE(doc, str.c_str());
@@ -324,7 +324,7 @@ TEST(document_load_file_out_of_memory_file_leak)
test_runner::_memory_fail_threshold = 0;
CHECK(doc.load_file("tests/data/small.xml"));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_file_wide_out_of_memory_file_leak)
@@ -339,7 +339,7 @@ TEST(document_load_file_wide_out_of_memory_file_leak)
test_runner::_memory_fail_threshold = 0;
CHECK(doc.load_file(L"tests/data/small.xml"));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_file_error_previous)
@@ -357,7 +357,7 @@ TEST(document_load_file_wide_ascii)
pugi::xml_document doc;
CHECK(doc.load_file(L"tests/data/small.xml"));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
#if !defined(__DMC__) && !defined(__MWERKS__) && !(defined(__MINGW32__) && defined(__STRICT_ANSI__) && !defined(__MINGW64_VERSION_MAJOR)) && !defined(__BORLANDC__)
@@ -366,7 +366,7 @@ TEST(document_load_file_wide_unicode)
pugi::xml_document doc;
CHECK(doc.load_file(L"tests/data/\x0442\x0435\x0441\x0442.xml"));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
#endif
@@ -389,7 +389,7 @@ TEST_XML(document_save, "<node/>")
doc.save(writer, STR(""), pugi::format_no_declaration | pugi::format_raw, get_native_encoding());
- CHECK(writer.as_string() == STR("<node />"));
+ CHECK(writer.as_string() == STR("<node/>"));
}
#ifndef PUGIXML_NO_STL
@@ -399,7 +399,7 @@ TEST_XML(document_save_stream, "<node/>")
doc.save(oss, STR(""), pugi::format_no_declaration | pugi::format_raw);
- CHECK(oss.str() == "<node />");
+ CHECK(oss.str() == "<node/>");
}
TEST_XML(document_save_stream_wide, "<node/>")
@@ -408,7 +408,7 @@ TEST_XML(document_save_stream_wide, "<node/>")
doc.save(oss, STR(""), pugi::format_no_declaration | pugi::format_raw);
- CHECK(oss.str() == L"<node />");
+ CHECK(oss.str() == L"<node/>");
}
#endif
@@ -417,12 +417,12 @@ TEST_XML(document_save_bom, "<n/>")
unsigned int flags = format_no_declaration | format_raw | format_write_bom;
// specific encodings
- CHECK(test_save_narrow(doc, flags, encoding_utf8, "\xef\xbb\xbf<n />", 8));
- CHECK(test_save_narrow(doc, flags, encoding_utf16_be, "\xfe\xff\x00<\x00n\x00 \x00/\x00>", 12));
- CHECK(test_save_narrow(doc, flags, encoding_utf16_le, "\xff\xfe<\x00n\x00 \x00/\x00>\x00", 12));
- CHECK(test_save_narrow(doc, flags, encoding_utf32_be, "\x00\x00\xfe\xff\x00\x00\x00<\x00\x00\x00n\x00\x00\x00 \x00\x00\x00/\x00\x00\x00>", 24));
- CHECK(test_save_narrow(doc, flags, encoding_utf32_le, "\xff\xfe\x00\x00<\x00\x00\x00n\x00\x00\x00 \x00\x00\x00/\x00\x00\x00>\x00\x00\x00", 24));
- CHECK(test_save_narrow(doc, flags, encoding_latin1, "<n />", 5));
+ CHECK(test_save_narrow(doc, flags, encoding_utf8, "\xef\xbb\xbf<n/>", 7));
+ CHECK(test_save_narrow(doc, flags, encoding_utf16_be, "\xfe\xff\x00<\x00n\x00/\x00>", 10));
+ CHECK(test_save_narrow(doc, flags, encoding_utf16_le, "\xff\xfe<\x00n\x00/\x00>\x00", 10));
+ CHECK(test_save_narrow(doc, flags, encoding_utf32_be, "\x00\x00\xfe\xff\x00\x00\x00<\x00\x00\x00n\x00\x00\x00/\x00\x00\x00>", 20));
+ CHECK(test_save_narrow(doc, flags, encoding_utf32_le, "\xff\xfe\x00\x00<\x00\x00\x00n\x00\x00\x00/\x00\x00\x00>\x00\x00\x00", 20));
+ CHECK(test_save_narrow(doc, flags, encoding_latin1, "<n/>", 4));
// encodings synonyms
CHECK(save_narrow(doc, flags, encoding_utf16) == save_narrow(doc, flags, (is_little_endian() ? encoding_utf16_le : encoding_utf16_be)));
@@ -521,7 +521,7 @@ TEST_XML(document_save_file, "<node/>")
CHECK(doc.save_file(f.path));
CHECK(doc.load_file(f.path, pugi::parse_default | pugi::parse_declaration));
- CHECK_NODE(doc, STR("<?xml version=\"1.0\"?><node />"));
+ CHECK_NODE(doc, STR("<?xml version=\"1.0\"?><node/>"));
}
TEST_XML(document_save_file_wide, "<node/>")
@@ -535,7 +535,7 @@ TEST_XML(document_save_file_wide, "<node/>")
CHECK(doc.save_file(wpath));
CHECK(doc.load_file(f.path, pugi::parse_default | pugi::parse_declaration));
- CHECK_NODE(doc, STR("<?xml version=\"1.0\"?><node />"));
+ CHECK_NODE(doc, STR("<?xml version=\"1.0\"?><node/>"));
}
TEST_XML(document_save_file_error, "<node/>")
@@ -596,7 +596,7 @@ TEST(document_load_buffer)
pugi::xml_document doc;
CHECK(doc.load_buffer(text, sizeof(text)));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_buffer_inplace)
@@ -606,7 +606,7 @@ TEST(document_load_buffer_inplace)
pugi::xml_document doc;
CHECK(doc.load_buffer_inplace(text, sizeof(text)));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_buffer_inplace_own)
@@ -623,7 +623,7 @@ TEST(document_load_buffer_inplace_own)
pugi::xml_document doc;
CHECK(doc.load_buffer_inplace_own(text, size));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_parse_result_bool)
@@ -1196,7 +1196,7 @@ TEST_XML(document_reset, "<node><child/></node>")
CHECK(doc.load_string(STR("<node/>")));
CHECK(doc.first_child());
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
doc.reset();
CHECK(!doc.first_child());
@@ -1220,12 +1220,12 @@ TEST_XML(document_reset_copy, "<node><child/></node>")
doc2.reset(doc);
- CHECK_NODE(doc2, STR("<node><child /></node>"));
+ CHECK_NODE(doc2, STR("<node><child/></node>"));
CHECK(doc.first_child() != doc2.first_child());
doc.reset(doc2);
- CHECK_NODE(doc, STR("<node><child /></node>"));
+ CHECK_NODE(doc, STR("<node><child/></node>"));
CHECK(doc.first_child() != doc2.first_child());
CHECK(doc.first_child().offset_debug() == -1);
@@ -1233,7 +1233,7 @@ TEST_XML(document_reset_copy, "<node><child/></node>")
TEST_XML(document_reset_copy_self, "<node><child/></node>")
{
- CHECK_NODE(doc, STR("<node><child /></node>"));
+ CHECK_NODE(doc, STR("<node><child/></node>"));
doc.reset(doc);
@@ -1349,7 +1349,7 @@ TEST(document_alignment)
xml_document* doc = new (buf + offset) xml_document;
CHECK(doc->load_string(STR("<node />")));
- CHECK_NODE(*doc, STR("<node />"));
+ CHECK_NODE(*doc, STR("<node/>"));
doc->~xml_document();
}
@@ -1393,5 +1393,5 @@ TEST(document_deprecated_load)
{
xml_document doc;
CHECK(doc.load(STR("<node/>")));
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp
index 4c944e9..f2d7ea8 100644
--- a/tests/test_dom_modify.cpp
+++ b/tests/test_dom_modify.cpp
@@ -31,7 +31,7 @@ TEST_XML(dom_attr_assign, "<node/>")
node.append_attribute(STR("attr8")) = true;
xml_attribute() = true;
- CHECK_NODE(node, STR("<node attr1=\"v1\" attr2=\"-2147483647\" attr3=\"-2147483648\" attr4=\"4294967295\" attr5=\"4294967294\" attr6=\"0.5\" attr7=\"0.25\" attr8=\"true\" />"));
+ CHECK_NODE(node, STR("<node attr1=\"v1\" attr2=\"-2147483647\" attr3=\"-2147483648\" attr4=\"4294967295\" attr5=\"4294967294\" attr6=\"0.5\" attr7=\"0.25\" attr8=\"true\"/>"));
}
TEST_XML(dom_attr_set_name, "<node attr='value' />")
@@ -41,7 +41,7 @@ TEST_XML(dom_attr_set_name, "<node attr='value' />")
CHECK(attr.set_name(STR("n")));
CHECK(!xml_attribute().set_name(STR("n")));
- CHECK_NODE(doc, STR("<node n=\"value\" />"));
+ CHECK_NODE(doc, STR("<node n=\"value\"/>"));
}
TEST_XML(dom_attr_set_value, "<node/>")
@@ -68,7 +68,7 @@ TEST_XML(dom_attr_set_value, "<node/>")
CHECK(node.append_attribute(STR("attr8")).set_value(true));
CHECK(!xml_attribute().set_value(true));
- CHECK_NODE(node, STR("<node attr1=\"v1\" attr2=\"-2147483647\" attr3=\"-2147483648\" attr4=\"4294967295\" attr5=\"4294967294\" attr6=\"0.5\" attr7=\"0.25\" attr8=\"true\" />"));
+ CHECK_NODE(node, STR("<node attr1=\"v1\" attr2=\"-2147483647\" attr3=\"-2147483648\" attr4=\"4294967295\" attr5=\"4294967294\" attr6=\"0.5\" attr7=\"0.25\" attr8=\"true\"/>"));
}
#if LONG_MAX > 2147483647
@@ -84,7 +84,7 @@ TEST_XML(dom_attr_assign_long, "<node/>")
node.append_attribute(STR("attr4")) = 18446744073709551614ul;
xml_attribute() = 18446744073709551615ul;
- CHECK_NODE(node, STR("<node attr1=\"-9223372036854775807\" attr2=\"-9223372036854775808\" attr3=\"18446744073709551615\" attr4=\"18446744073709551614\" />"));
+ CHECK_NODE(node, STR("<node attr1=\"-9223372036854775807\" attr2=\"-9223372036854775808\" attr3=\"18446744073709551615\" attr4=\"18446744073709551614\"/>"));
}
TEST_XML(dom_attr_set_value_long, "<node/>")
@@ -99,7 +99,7 @@ TEST_XML(dom_attr_set_value_long, "<node/>")
CHECK(node.append_attribute(STR("attr4")).set_value(18446744073709551614ul));
CHECK(!xml_attribute().set_value(18446744073709551615ul));
- CHECK_NODE(node, STR("<node attr1=\"-9223372036854775807\" attr2=\"-9223372036854775808\" attr3=\"18446744073709551615\" attr4=\"18446744073709551614\" />"));
+ CHECK_NODE(node, STR("<node attr1=\"-9223372036854775807\" attr2=\"-9223372036854775808\" attr3=\"18446744073709551615\" attr4=\"18446744073709551614\"/>"));
}
#else
TEST_XML(dom_attr_assign_long, "<node/>")
@@ -114,7 +114,7 @@ TEST_XML(dom_attr_assign_long, "<node/>")
node.append_attribute(STR("attr4")) = 4294967294ul;
xml_attribute() = 4294967295ul;
- CHECK_NODE(node, STR("<node attr1=\"-2147483647\" attr2=\"-2147483648\" attr3=\"4294967295\" attr4=\"4294967294\" />"));
+ CHECK_NODE(node, STR("<node attr1=\"-2147483647\" attr2=\"-2147483648\" attr3=\"4294967295\" attr4=\"4294967294\"/>"));
}
TEST_XML(dom_attr_set_value_long, "<node/>")
@@ -129,7 +129,7 @@ TEST_XML(dom_attr_set_value_long, "<node/>")
CHECK(node.append_attribute(STR("attr4")).set_value(4294967294ul));
CHECK(!xml_attribute().set_value(4294967295ul));
- CHECK_NODE(node, STR("<node attr1=\"-2147483647\" attr2=\"-2147483648\" attr3=\"4294967295\" attr4=\"4294967294\" />"));
+ CHECK_NODE(node, STR("<node attr1=\"-2147483647\" attr2=\"-2147483648\" attr3=\"4294967295\" attr4=\"4294967294\"/>"));
}
#endif
@@ -146,7 +146,7 @@ TEST_XML(dom_attr_assign_llong, "<node/>")
node.append_attribute(STR("attr4")) = 18446744073709551614ull;
xml_attribute() = 18446744073709551615ull;
- CHECK_NODE(node, STR("<node attr1=\"-9223372036854775807\" attr2=\"-9223372036854775808\" attr3=\"18446744073709551615\" attr4=\"18446744073709551614\" />"));
+ CHECK_NODE(node, STR("<node attr1=\"-9223372036854775807\" attr2=\"-9223372036854775808\" attr3=\"18446744073709551615\" attr4=\"18446744073709551614\"/>"));
}
TEST_XML(dom_attr_set_value_llong, "<node/>")
@@ -161,7 +161,7 @@ TEST_XML(dom_attr_set_value_llong, "<node/>")
CHECK(node.append_attribute(STR("attr4")).set_value(18446744073709551614ull));
CHECK(!xml_attribute().set_value(18446744073709551615ull));
- CHECK_NODE(node, STR("<node attr1=\"-9223372036854775807\" attr2=\"-9223372036854775808\" attr3=\"18446744073709551615\" attr4=\"18446744073709551614\" />"));
+ CHECK_NODE(node, STR("<node attr1=\"-9223372036854775807\" attr2=\"-9223372036854775808\" attr3=\"18446744073709551615\" attr4=\"18446744073709551614\"/>"));
}
#endif
@@ -171,8 +171,8 @@ TEST_XML(dom_attr_assign_large_number_float, "<node attr='' />")
node.attribute(STR("attr")) = std::numeric_limits<float>::max();
- CHECK(test_node(node, STR("<node attr=\"3.40282347e+038\" />"), STR(""), pugi::format_raw) ||
- test_node(node, STR("<node attr=\"3.40282347e+38\" />"), STR(""), pugi::format_raw));
+ CHECK(test_node(node, STR("<node attr=\"3.40282347e+038\"/>"), STR(""), pugi::format_raw) ||
+ test_node(node, STR("<node attr=\"3.40282347e+38\"/>"), STR(""), pugi::format_raw));
}
TEST_XML(dom_attr_assign_large_number_double, "<node attr='' />")
@@ -183,9 +183,9 @@ TEST_XML(dom_attr_assign_large_number_double, "<node attr='' />")
// Borland C does not print double values with enough precision
#ifdef __BORLANDC__
- CHECK_NODE(node, STR("<node attr=\"1.7976931348623156e+308\" />"));
+ CHECK_NODE(node, STR("<node attr=\"1.7976931348623156e+308\"/>"));
#else
- CHECK_NODE(node, STR("<node attr=\"1.7976931348623157e+308\" />"));
+ CHECK_NODE(node, STR("<node attr=\"1.7976931348623157e+308\"/>"));
#endif
}
@@ -234,7 +234,7 @@ TEST_XML(dom_node_prepend_attribute, "<node><child/></node>")
CHECK(a3 && a1 != a3 && a2 != a3);
a3 = STR("v3");
- CHECK_NODE(doc, STR("<node a2=\"v2\" a1=\"v1\"><child a3=\"v3\" /></node>"));
+ CHECK_NODE(doc, STR("<node a2=\"v2\" a1=\"v1\"><child a3=\"v3\"/></node>"));
}
TEST_XML(dom_node_append_attribute, "<node><child/></node>")
@@ -254,7 +254,7 @@ TEST_XML(dom_node_append_attribute, "<node><child/></node>")
CHECK(a3 && a1 != a3 && a2 != a3);
a3 = STR("v3");
- CHECK_NODE(doc, STR("<node a1=\"v1\" a2=\"v2\"><child a3=\"v3\" /></node>"));
+ CHECK_NODE(doc, STR("<node a1=\"v1\" a2=\"v2\"><child a3=\"v3\"/></node>"));
}
TEST_XML(dom_node_insert_attribute_after, "<node a1='v1'><child a2='v2'/></node>")
@@ -284,7 +284,7 @@ TEST_XML(dom_node_insert_attribute_after, "<node a1='v1'><child a2='v2'/></node>
CHECK(child.insert_attribute_after(STR("a"), a4) == xml_attribute());
- CHECK_NODE(doc, STR("<node a1=\"v1\" a4=\"v4\" a3=\"v3\" a5=\"v5\"><child a2=\"v2\" /></node>"));
+ CHECK_NODE(doc, STR("<node a1=\"v1\" a4=\"v4\" a3=\"v3\" a5=\"v5\"><child a2=\"v2\"/></node>"));
}
TEST_XML(dom_node_insert_attribute_before, "<node a1='v1'><child a2='v2'/></node>")
@@ -314,7 +314,7 @@ TEST_XML(dom_node_insert_attribute_before, "<node a1='v1'><child a2='v2'/></node
CHECK(child.insert_attribute_before(STR("a"), a4) == xml_attribute());
- CHECK_NODE(doc, STR("<node a5=\"v5\" a3=\"v3\" a4=\"v4\" a1=\"v1\"><child a2=\"v2\" /></node>"));
+ CHECK_NODE(doc, STR("<node a5=\"v5\" a3=\"v3\" a4=\"v4\" a1=\"v1\"><child a2=\"v2\"/></node>"));
}
TEST_XML(dom_node_prepend_copy_attribute, "<node a1='v1'><child a2='v2'/><child/></node>")
@@ -339,7 +339,7 @@ TEST_XML(dom_node_prepend_copy_attribute, "<node a1='v1'><child a2='v2'/><child/
xml_attribute a5 = node.last_child().prepend_copy(a1);
CHECK(a5 && a5 != a4 && a5 != a3 && a5 != a2 && a5 != a1);
- CHECK_NODE(doc, STR("<node a2=\"v2\" a1=\"v1\" a1=\"v1\"><child a2=\"v2\" /><child a1=\"v1\" /></node>"));
+ CHECK_NODE(doc, STR("<node a2=\"v2\" a1=\"v1\" a1=\"v1\"><child a2=\"v2\"/><child a1=\"v1\"/></node>"));
a3.set_name(STR("a3"));
a3 = STR("v3");
@@ -350,7 +350,7 @@ TEST_XML(dom_node_prepend_copy_attribute, "<node a1='v1'><child a2='v2'/><child/
a5.set_name(STR("a5"));
a5 = STR("v5");
- CHECK_NODE(doc, STR("<node a4=\"v4\" a3=\"v3\" a1=\"v1\"><child a2=\"v2\" /><child a5=\"v5\" /></node>"));
+ CHECK_NODE(doc, STR("<node a4=\"v4\" a3=\"v3\" a1=\"v1\"><child a2=\"v2\"/><child a5=\"v5\"/></node>"));
}
TEST_XML(dom_node_append_copy_attribute, "<node a1='v1'><child a2='v2'/><child/></node>")
@@ -375,7 +375,7 @@ TEST_XML(dom_node_append_copy_attribute, "<node a1='v1'><child a2='v2'/><child/>
xml_attribute a5 = node.last_child().append_copy(a1);
CHECK(a5 && a5 != a4 && a5 != a3 && a5 != a2 && a5 != a1);
- CHECK_NODE(doc, STR("<node a1=\"v1\" a1=\"v1\" a2=\"v2\"><child a2=\"v2\" /><child a1=\"v1\" /></node>"));
+ CHECK_NODE(doc, STR("<node a1=\"v1\" a1=\"v1\" a2=\"v2\"><child a2=\"v2\"/><child a1=\"v1\"/></node>"));
a3.set_name(STR("a3"));
a3 = STR("v3");
@@ -386,7 +386,7 @@ TEST_XML(dom_node_append_copy_attribute, "<node a1='v1'><child a2='v2'/><child/>
a5.set_name(STR("a5"));
a5 = STR("v5");
- CHECK_NODE(doc, STR("<node a1=\"v1\" a3=\"v3\" a4=\"v4\"><child a2=\"v2\" /><child a5=\"v5\" /></node>"));
+ CHECK_NODE(doc, STR("<node a1=\"v1\" a3=\"v3\" a4=\"v4\"><child a2=\"v2\"/><child a5=\"v5\"/></node>"));
}
TEST_XML(dom_node_insert_copy_after_attribute, "<node a1='v1'><child a2='v2'/></node>")
@@ -414,7 +414,7 @@ TEST_XML(dom_node_insert_copy_after_attribute, "<node a1='v1'><child a2='v2'/></
CHECK(child.insert_copy_after(a4, a4) == xml_attribute());
- CHECK_NODE(doc, STR("<node a1=\"v1\" a2=\"v2\" a2=\"v2\" a1=\"v1\"><child a2=\"v2\" /></node>"));
+ CHECK_NODE(doc, STR("<node a1=\"v1\" a2=\"v2\" a2=\"v2\" a1=\"v1\"><child a2=\"v2\"/></node>"));
a3.set_name(STR("a3"));
a3 = STR("v3");
@@ -425,7 +425,7 @@ TEST_XML(dom_node_insert_copy_after_attribute, "<node a1='v1'><child a2='v2'/></
a5.set_name(STR("a5"));
a5 = STR("v5");
- CHECK_NODE(doc, STR("<node a1=\"v1\" a5=\"v5\" a4=\"v4\" a3=\"v3\"><child a2=\"v2\" /></node>"));
+ CHECK_NODE(doc, STR("<node a1=\"v1\" a5=\"v5\" a4=\"v4\" a3=\"v3\"><child a2=\"v2\"/></node>"));
}
TEST_XML(dom_node_insert_copy_before_attribute, "<node a1='v1'><child a2='v2'/></node>")
@@ -453,7 +453,7 @@ TEST_XML(dom_node_insert_copy_before_attribute, "<node a1='v1'><child a2='v2'/><
CHECK(child.insert_copy_before(a4, a4) == xml_attribute());
- CHECK_NODE(doc, STR("<node a1=\"v1\" a2=\"v2\" a2=\"v2\" a1=\"v1\"><child a2=\"v2\" /></node>"));
+ CHECK_NODE(doc, STR("<node a1=\"v1\" a2=\"v2\" a2=\"v2\" a1=\"v1\"><child a2=\"v2\"/></node>"));
a3.set_name(STR("a3"));
a3 = STR("v3");
@@ -464,7 +464,7 @@ TEST_XML(dom_node_insert_copy_before_attribute, "<node a1='v1'><child a2='v2'/><
a5.set_name(STR("a5"));
a5 = STR("v5");
- CHECK_NODE(doc, STR("<node a3=\"v3\" a4=\"v4\" a5=\"v5\" a1=\"v1\"><child a2=\"v2\" /></node>"));
+ CHECK_NODE(doc, STR("<node a3=\"v3\" a4=\"v4\" a5=\"v5\" a1=\"v1\"><child a2=\"v2\"/></node>"));
}
TEST_XML(dom_node_remove_attribute, "<node a1='v1' a2='v2' a3='v3'><child a4='v4'/></node>")
@@ -479,13 +479,13 @@ TEST_XML(dom_node_remove_attribute, "<node a1='v1' a2='v2' a3='v3'><child a4='v4
CHECK(!node.remove_attribute(xml_attribute()));
CHECK(!node.remove_attribute(child.attribute(STR("a4"))));
- CHECK_NODE(doc, STR("<node a1=\"v1\" a2=\"v2\" a3=\"v3\"><child a4=\"v4\" /></node>"));
+ CHECK_NODE(doc, STR("<node a1=\"v1\" a2=\"v2\" a3=\"v3\"><child a4=\"v4\"/></node>"));
CHECK(node.remove_attribute(STR("a1")));
CHECK(node.remove_attribute(node.attribute(STR("a3"))));
CHECK(child.remove_attribute(STR("a4")));
- CHECK_NODE(doc, STR("<node a2=\"v2\"><child /></node>"));
+ CHECK_NODE(doc, STR("<node a2=\"v2\"><child/></node>"));
}
TEST_XML(dom_node_prepend_child, "<node>foo<child/></node>")
@@ -511,7 +511,7 @@ TEST_XML(dom_node_prepend_child, "<node>foo<child/></node>")
CHECK(n4 && n1 != n4 && n2 != n4 && n3 != n4);
CHECK(n4.set_value(STR("n4")));
- CHECK_NODE(doc, STR("<!--n4--><node><n2 /><n1 />foo<child>n3</child></node>"));
+ CHECK_NODE(doc, STR("<!--n4--><node><n2/><n1/>foo<child>n3</child></node>"));
}
TEST_XML(dom_node_append_child, "<node>foo<child/></node>")
@@ -537,7 +537,7 @@ TEST_XML(dom_node_append_child, "<node>foo<child/></node>")
CHECK(n4 && n1 != n4 && n2 != n4 && n3 != n4);
CHECK(n4.set_value(STR("n4")));
- CHECK_NODE(doc, STR("<node>foo<child>n3</child><n1 /><n2 /></node><!--n4-->"));
+ CHECK_NODE(doc, STR("<node>foo<child>n3</child><n1/><n2/></node><!--n4-->"));
}
TEST_XML(dom_node_insert_child_after, "<node>foo<child/></node>")
@@ -571,7 +571,7 @@ TEST_XML(dom_node_insert_child_after, "<node>foo<child/></node>")
CHECK(child.insert_child_after(node_element, n3) == xml_node());
- CHECK_NODE(doc, STR("<node>foo<?n4?><child /><n2 />n3<n1 /></node>"));
+ CHECK_NODE(doc, STR("<node>foo<?n4?><child/><n2/>n3<n1/></node>"));
}
TEST_XML(dom_node_insert_child_before, "<node>foo<child/></node>")
@@ -605,7 +605,7 @@ TEST_XML(dom_node_insert_child_before, "<node>foo<child/></node>")
CHECK(child.insert_child_before(node_element, n3) == xml_node());
- CHECK_NODE(doc, STR("<node><?n4?>foo<n1 />n3<n2 /><child /></node>"));
+ CHECK_NODE(doc, STR("<node><?n4?>foo<n1/>n3<n2/><child/></node>"));
}
TEST_XML(dom_node_prepend_child_name, "<node>foo<child/></node>")
@@ -619,7 +619,7 @@ TEST_XML(dom_node_prepend_child_name, "<node>foo<child/></node>")
xml_node n2 = doc.child(STR("node")).prepend_child(STR("n2"));
CHECK(n2 && n1 != n2);
- CHECK_NODE(doc, STR("<node><n2 /><n1 />foo<child /></node>"));
+ CHECK_NODE(doc, STR("<node><n2/><n1/>foo<child/></node>"));
}
TEST_XML(dom_node_append_child_name, "<node>foo<child/></node>")
@@ -633,7 +633,7 @@ TEST_XML(dom_node_append_child_name, "<node>foo<child/></node>")
xml_node n2 = doc.child(STR("node")).append_child(STR("n2"));
CHECK(n2 && n1 != n2);
- CHECK_NODE(doc, STR("<node>foo<child /><n1 /><n2 /></node>"));
+ CHECK_NODE(doc, STR("<node>foo<child/><n1/><n2/></node>"));
}
TEST_XML(dom_node_insert_child_after_name, "<node>foo<child/></node>")
@@ -655,7 +655,7 @@ TEST_XML(dom_node_insert_child_after_name, "<node>foo<child/></node>")
CHECK(child.insert_child_after(STR(""), n2) == xml_node());
- CHECK_NODE(doc, STR("<node>foo<child /><n2 /><n1 /></node>"));
+ CHECK_NODE(doc, STR("<node>foo<child/><n2/><n1/></node>"));
}
TEST_XML(dom_node_insert_child_before_name, "<node>foo<child/></node>")
@@ -677,7 +677,7 @@ TEST_XML(dom_node_insert_child_before_name, "<node>foo<child/></node>")
CHECK(child.insert_child_before(STR(""), n2) == xml_node());
- CHECK_NODE(doc, STR("<node>foo<n1 /><n2 /><child /></node>"));
+ CHECK_NODE(doc, STR("<node>foo<n1/><n2/><child/></node>"));
}
TEST_XML(dom_node_remove_child, "<node><n1/><n2/><n3/><child><n4/></child></node>")
@@ -692,20 +692,20 @@ TEST_XML(dom_node_remove_child, "<node><n1/><n2/><n3/><child><n4/></child></node
CHECK(!node.remove_child(xml_node()));
CHECK(!node.remove_child(child.child(STR("n4"))));
- CHECK_NODE(doc, STR("<node><n1 /><n2 /><n3 /><child><n4 /></child></node>"));
+ CHECK_NODE(doc, STR("<node><n1/><n2/><n3/><child><n4/></child></node>"));
CHECK(node.remove_child(STR("n1")));
CHECK(node.remove_child(node.child(STR("n3"))));
CHECK(child.remove_child(STR("n4")));
- CHECK_NODE(doc, STR("<node><n2 /><child /></node>"));
+ CHECK_NODE(doc, STR("<node><n2/><child/></node>"));
}
TEST_XML(dom_node_remove_child_complex, "<node id='1'><n1 id1='1' id2='2'/><n2/><n3/><child><n4/></child></node>")
{
CHECK(doc.child(STR("node")).remove_child(STR("n1")));
- CHECK_NODE(doc, STR("<node id=\"1\"><n2 /><n3 /><child><n4 /></child></node>"));
+ CHECK_NODE(doc, STR("<node id=\"1\"><n2/><n3/><child><n4/></child></node>"));
CHECK(doc.remove_child(STR("node")));
@@ -732,17 +732,17 @@ TEST_XML(dom_node_prepend_copy, "<node>foo<child/></node>")
xml_node n1 = doc.child(STR("node")).prepend_copy(doc.child(STR("node")).first_child());
CHECK(n1);
CHECK_STRING(n1.value(), STR("foo"));
- CHECK_NODE(doc, STR("<node>foofoo<child /></node>"));
+ CHECK_NODE(doc, STR("<node>foofoo<child/></node>"));
xml_node n2 = doc.child(STR("node")).prepend_copy(doc.child(STR("node")).child(STR("child")));
CHECK(n2 && n2 != n1);
CHECK_STRING(n2.name(), STR("child"));
- CHECK_NODE(doc, STR("<node><child />foofoo<child /></node>"));
+ CHECK_NODE(doc, STR("<node><child/>foofoo<child/></node>"));
xml_node n3 = doc.child(STR("node")).child(STR("child")).prepend_copy(doc.child(STR("node")).first_child().next_sibling());
CHECK(n3 && n3 != n1 && n3 != n2);
CHECK_STRING(n3.value(), STR("foo"));
- CHECK_NODE(doc, STR("<node><child>foo</child>foofoo<child /></node>"));
+ CHECK_NODE(doc, STR("<node><child>foo</child>foofoo<child/></node>"));
}
TEST_XML(dom_node_append_copy, "<node>foo<child/></node>")
@@ -755,17 +755,17 @@ TEST_XML(dom_node_append_copy, "<node>foo<child/></node>")
xml_node n1 = doc.child(STR("node")).append_copy(doc.child(STR("node")).first_child());
CHECK(n1);
CHECK_STRING(n1.value(), STR("foo"));
- CHECK_NODE(doc, STR("<node>foo<child />foo</node>"));
+ CHECK_NODE(doc, STR("<node>foo<child/>foo</node>"));
xml_node n2 = doc.child(STR("node")).append_copy(doc.child(STR("node")).child(STR("child")));
CHECK(n2 && n2 != n1);
CHECK_STRING(n2.name(), STR("child"));
- CHECK_NODE(doc, STR("<node>foo<child />foo<child /></node>"));
+ CHECK_NODE(doc, STR("<node>foo<child/>foo<child/></node>"));
xml_node n3 = doc.child(STR("node")).child(STR("child")).append_copy(doc.child(STR("node")).first_child());
CHECK(n3 && n3 != n1 && n3 != n2);
CHECK_STRING(n3.value(), STR("foo"));
- CHECK_NODE(doc, STR("<node>foo<child>foo</child>foo<child /></node>"));
+ CHECK_NODE(doc, STR("<node>foo<child>foo</child>foo<child/></node>"));
}
TEST_XML(dom_node_insert_copy_after, "<node>foo<child/></node>")
@@ -779,17 +779,17 @@ TEST_XML(dom_node_insert_copy_after, "<node>foo<child/></node>")
xml_node n1 = doc.child(STR("node")).insert_copy_after(doc.child(STR("node")).child(STR("child")), doc.child(STR("node")).first_child());
CHECK(n1);
CHECK_STRING(n1.name(), STR("child"));
- CHECK_NODE(doc, STR("<node>foo<child /><child /></node>"));
+ CHECK_NODE(doc, STR("<node>foo<child/><child/></node>"));
xml_node n2 = doc.child(STR("node")).insert_copy_after(doc.child(STR("node")).first_child(), doc.child(STR("node")).last_child());
CHECK(n2 && n2 != n1);
CHECK_STRING(n2.value(), STR("foo"));
- CHECK_NODE(doc, STR("<node>foo<child /><child />foo</node>"));
+ CHECK_NODE(doc, STR("<node>foo<child/><child/>foo</node>"));
xml_node n3 = doc.child(STR("node")).insert_copy_after(doc.child(STR("node")).first_child(), doc.child(STR("node")).first_child());
CHECK(n3 && n3 != n1 && n3 != n2);
CHECK_STRING(n3.value(), STR("foo"));
- CHECK_NODE(doc, STR("<node>foofoo<child /><child />foo</node>"));
+ CHECK_NODE(doc, STR("<node>foofoo<child/><child/>foo</node>"));
}
TEST_XML(dom_node_insert_copy_before, "<node>foo<child/></node>")
@@ -803,39 +803,39 @@ TEST_XML(dom_node_insert_copy_before, "<node>foo<child/></node>")
xml_node n1 = doc.child(STR("node")).insert_copy_before(doc.child(STR("node")).child(STR("child")), doc.child(STR("node")).first_child());
CHECK(n1);
CHECK_STRING(n1.name(), STR("child"));
- CHECK_NODE(doc, STR("<node><child />foo<child /></node>"));
+ CHECK_NODE(doc, STR("<node><child/>foo<child/></node>"));
xml_node n2 = doc.child(STR("node")).insert_copy_before(doc.child(STR("node")).first_child(), doc.child(STR("node")).last_child());
CHECK(n2 && n2 != n1);
CHECK_STRING(n2.name(), STR("child"));
- CHECK_NODE(doc, STR("<node><child />foo<child /><child /></node>"));
+ CHECK_NODE(doc, STR("<node><child/>foo<child/><child/></node>"));
xml_node n3 = doc.child(STR("node")).insert_copy_before(doc.child(STR("node")).first_child().next_sibling(), doc.child(STR("node")).first_child());
CHECK(n3 && n3 != n1 && n3 != n2);
CHECK_STRING(n3.value(), STR("foo"));
- CHECK_NODE(doc, STR("<node>foo<child />foo<child /><child /></node>"));
+ CHECK_NODE(doc, STR("<node>foo<child/>foo<child/><child/></node>"));
}
TEST_XML(dom_node_copy_recursive, "<node>foo<child/></node>")
{
doc.child(STR("node")).append_copy(doc.child(STR("node")));
- CHECK_NODE(doc, STR("<node>foo<child /><node>foo<child /></node></node>"));
+ CHECK_NODE(doc, STR("<node>foo<child/><node>foo<child/></node></node>"));
}
TEST_XML(dom_node_copy_crossdoc, "<node/>")
{
xml_document newdoc;
newdoc.append_copy(doc.child(STR("node")));
- CHECK_NODE(doc, STR("<node />"));
- CHECK_NODE(newdoc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
+ CHECK_NODE(newdoc, STR("<node/>"));
}
TEST_XML(dom_node_copy_crossdoc_attribute, "<node attr='value'/>")
{
xml_document newdoc;
newdoc.append_child(STR("copy")).append_copy(doc.child(STR("node")).attribute(STR("attr")));
- CHECK_NODE(doc, STR("<node attr=\"value\" />"));
- CHECK_NODE(newdoc, STR("<copy attr=\"value\" />"));
+ CHECK_NODE(doc, STR("<node attr=\"value\"/>"));
+ CHECK_NODE(newdoc, STR("<copy attr=\"value\"/>"));
}
TEST_XML_FLAGS(dom_node_copy_types, "<?xml version='1.0'?><!DOCTYPE id><root><?pi value?><!--comment--><node id='1'>pcdata<![CDATA[cdata]]></node></root>", parse_full)
@@ -906,7 +906,7 @@ TEST(dom_node_declaration_copy)
doc.last_child().append_copy(doc.first_child());
- CHECK_NODE(doc, STR("<?xml?><node />"));
+ CHECK_NODE(doc, STR("<?xml?><node/>"));
}
TEST(dom_string_out_of_memory)
@@ -1056,7 +1056,7 @@ TEST(dom_node_doctype_copy)
doc.last_child().append_copy(doc.first_child());
- CHECK_NODE(doc, STR("<!DOCTYPE><node />"));
+ CHECK_NODE(doc, STR("<!DOCTYPE><node/>"));
}
TEST(dom_node_doctype_value)
@@ -1085,7 +1085,7 @@ TEST_XML(dom_node_append_buffer_native, "<node>test</node>")
CHECK(node.append_buffer(data2, sizeof(data2)));
CHECK(node.append_buffer(data2, sizeof(data2)));
- CHECK_NODE(doc, STR("<node>test<child1 id=\"1\" /><child2>text</child2><child3 /><child1 id=\"1\" /><child2>text</child2><child3 /><child3 /></node>"));
+ CHECK_NODE(doc, STR("<node>test<child1 id=\"1\"/><child2>text</child2><child3/><child1 id=\"1\"/><child2>text</child2><child3/><child3/></node>"));
}
TEST_XML(dom_node_append_buffer_convert, "<node>test</node>")
@@ -1097,7 +1097,7 @@ TEST_XML(dom_node_append_buffer_convert, "<node>test</node>")
CHECK(node.append_buffer(data, sizeof(data)));
CHECK(node.append_buffer(data, sizeof(data), parse_default, encoding_utf32_be));
- CHECK_NODE(doc, STR("<node>test<n /><n /></node>"));
+ CHECK_NODE(doc, STR("<node>test<n/><n/></node>"));
}
@@ -1113,15 +1113,15 @@ TEST_XML(dom_node_append_buffer_remove, "<node>test</node>")
CHECK(node.append_buffer(data1, sizeof(data1)));
CHECK(node.append_buffer(data2, sizeof(data2)));
- CHECK_NODE(doc, STR("<node>test<child1 id=\"1\" /><child2>text</child2><child3 /><child1 id=\"1\" /><child2>text</child2><child3 /></node>"));
+ CHECK_NODE(doc, STR("<node>test<child1 id=\"1\"/><child2>text</child2><child3/><child1 id=\"1\"/><child2>text</child2><child3/></node>"));
while (node.remove_child(STR("child2"))) {}
- CHECK_NODE(doc, STR("<node>test<child1 id=\"1\" /><child3 /><child1 id=\"1\" /><child3 /></node>"));
+ CHECK_NODE(doc, STR("<node>test<child1 id=\"1\"/><child3/><child1 id=\"1\"/><child3/></node>"));
while (node.remove_child(STR("child1"))) {}
- CHECK_NODE(doc, STR("<node>test<child3 /><child3 /></node>"));
+ CHECK_NODE(doc, STR("<node>test<child3/><child3/></node>"));
while (node.remove_child(STR("child3"))) {}
@@ -1140,7 +1140,7 @@ TEST(dom_node_append_buffer_empty_document)
doc.append_buffer(data, sizeof(data));
- CHECK_NODE(doc, STR("<child1 id=\"1\" /><child2>text</child2>"));
+ CHECK_NODE(doc, STR("<child1 id=\"1\"/><child2>text</child2>"));
}
TEST_XML(dom_node_append_buffer_invalid_type, "<node>test</node>")
@@ -1158,10 +1158,10 @@ TEST_XML(dom_node_append_buffer_close_external, "<node />")
const char data[] = "<child1 /></node><child2 />";
CHECK(node.append_buffer(data, sizeof(data)).status == status_end_element_mismatch);
- CHECK_NODE(doc, STR("<node><child1 /></node>"));
+ CHECK_NODE(doc, STR("<node><child1/></node>"));
CHECK(node.append_buffer(data, sizeof(data)).status == status_end_element_mismatch);
- CHECK_NODE(doc, STR("<node><child1 /><child1 /></node>"));
+ CHECK_NODE(doc, STR("<node><child1/><child1/></node>"));
}
TEST(dom_node_append_buffer_out_of_memory_extra)
@@ -1252,7 +1252,7 @@ TEST_XML(dom_node_append_buffer_empty, "<node />")
CHECK(node.append_buffer(0, 0).status == status_no_document_element);
CHECK(node.append_buffer(0, 0, parse_fragment).status == status_ok);
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST_XML(dom_node_prepend_move, "<node>foo<child/></node>")
@@ -1267,12 +1267,12 @@ TEST_XML(dom_node_prepend_move, "<node>foo<child/></node>")
xml_node n1 = doc.child(STR("node")).prepend_move(doc.child(STR("node")).first_child());
CHECK(n1 && n1 == doc.child(STR("node")).first_child());
CHECK_STRING(n1.value(), STR("foo"));
- CHECK_NODE(doc, STR("<node>foo<child /></node>"));
+ CHECK_NODE(doc, STR("<node>foo<child/></node>"));
xml_node n2 = doc.child(STR("node")).prepend_move(doc.child(STR("node")).child(STR("child")));
CHECK(n2 && n2 != n1 && n2 == child);
CHECK_STRING(n2.name(), STR("child"));
- CHECK_NODE(doc, STR("<node><child />foo</node>"));
+ CHECK_NODE(doc, STR("<node><child/>foo</node>"));
xml_node n3 = doc.child(STR("node")).child(STR("child")).prepend_move(doc.child(STR("node")).first_child().next_sibling());
CHECK(n3 && n3 == n1 && n3 != n2);
@@ -1292,12 +1292,12 @@ TEST_XML(dom_node_append_move, "<node>foo<child/></node>")
xml_node n1 = doc.child(STR("node")).append_move(doc.child(STR("node")).first_child());
CHECK(n1 && n1 == doc.child(STR("node")).last_child());
CHECK_STRING(n1.value(), STR("foo"));
- CHECK_NODE(doc, STR("<node><child />foo</node>"));
+ CHECK_NODE(doc, STR("<node><child/>foo</node>"));
xml_node n2 = doc.child(STR("node")).append_move(doc.child(STR("node")).last_child());
CHECK(n2 && n2 == n1);
CHECK_STRING(n2.value(), STR("foo"));
- CHECK_NODE(doc, STR("<node><child />foo</node>"));
+ CHECK_NODE(doc, STR("<node><child/>foo</node>"));
xml_node n3 = doc.child(STR("node")).child(STR("child")).append_move(doc.child(STR("node")).last_child());
CHECK(n3 && n3 == n1 && n3 == n2);
@@ -1378,7 +1378,7 @@ TEST_XML(dom_node_move_recursive, "<root><node>foo<child/></node></root>")
CHECK(child.append_move(node) == xml_node());
- CHECK_NODE(doc, STR("<root><node>foo<child /></node></root>"));
+ CHECK_NODE(doc, STR("<root><node>foo<child/></node></root>"));
}
TEST_XML(dom_node_move_marker, "<node />")
@@ -1388,7 +1388,7 @@ TEST_XML(dom_node_move_marker, "<node />")
CHECK(doc.insert_move_before(node, node) == xml_node());
CHECK(doc.insert_move_after(node, node) == xml_node());
- CHECK_NODE(doc, STR("<node />"));
+ CHECK_NODE(doc, STR("<node/>"));
}
TEST_XML(dom_node_move_crossdoc, "<node/>")
@@ -1418,7 +1418,7 @@ TEST_XML(dom_node_move_tree, "<root><n1 a1='v1'><c1/>t1</n1><n2 a2='v2'><c2/>t2<
// n2 n4 n1 + n3
CHECK(n3 == doc.insert_move_after(n3, root));
- CHECK_NODE(doc, STR("<root><n2 a2=\"v2\"><c2 />t2</n2><n4 a4=\"v4\"><c4 />t4</n4><n1 a1=\"v1\"><c1 />t1</n1></root><n3 a3=\"v3\"><c3 />t3</n3>"));
+ CHECK_NODE(doc, STR("<root><n2 a2=\"v2\"><c2/>t2</n2><n4 a4=\"v4\"><c4/>t4</n4><n1 a1=\"v1\"><c1/>t1</n1></root><n3 a3=\"v3\"><c3/>t3</n3>"));
CHECK(n1 == root.child(STR("n1")));
CHECK(n2 == root.child(STR("n2")));
@@ -1454,7 +1454,7 @@ TEST(dom_node_copy_copyless)
data += STR("<node>");
for (int i = 0; i < 10000; ++i)
data += STR("pcdata");
- data += STR("<?name value?><child attr1=\"\" attr2=\"value2\" /></node>");
+ data += STR("<?name value?><child attr1=\"\" attr2=\"value2\"/></node>");
std::basic_string<char_t> datacopy = data;
@@ -1500,7 +1500,7 @@ TEST(dom_node_copy_copyless_mix)
std::basic_string<char_t> dataxml;
dataxml += STR("<node>");
dataxml += data;
- dataxml += STR("<?name value?><copychild attr1=\"copyvalue1\" copyattr2=\"value2\" /></node>");
+ dataxml += STR("<?name value?><copychild attr1=\"copyvalue1\" copyattr2=\"value2\"/></node>");
CHECK_NODE(copy, dataxml.c_str());
CHECK_NODE(copy2, dataxml.c_str());
@@ -1511,23 +1511,23 @@ TEST_XML(dom_node_copy_copyless_taint, "<node attr=\"value\" />")
xml_node node = doc.child(STR("node"));
xml_node copy = doc.append_copy(node);
- CHECK_NODE(doc, STR("<node attr=\"value\" /><node attr=\"value\" />"));
+ CHECK_NODE(doc, STR("<node attr=\"value\"/><node attr=\"value\"/>"));
node.set_name(STR("nod1"));
- CHECK_NODE(doc, STR("<nod1 attr=\"value\" /><node attr=\"value\" />"));
+ CHECK_NODE(doc, STR("<nod1 attr=\"value\"/><node attr=\"value\"/>"));
xml_node copy2 = doc.append_copy(copy);
- CHECK_NODE(doc, STR("<nod1 attr=\"value\" /><node attr=\"value\" /><node attr=\"value\" />"));
+ CHECK_NODE(doc, STR("<nod1 attr=\"value\"/><node attr=\"value\"/><node attr=\"value\"/>"));
copy.attribute(STR("attr")).set_value(STR("valu2"));
- CHECK_NODE(doc, STR("<nod1 attr=\"value\" /><node attr=\"valu2\" /><node attr=\"value\" />"));
+ CHECK_NODE(doc, STR("<nod1 attr=\"value\"/><node attr=\"valu2\"/><node attr=\"value\"/>"));
copy2.attribute(STR("attr")).set_name(STR("att3"));
- CHECK_NODE(doc, STR("<nod1 attr=\"value\" /><node attr=\"valu2\" /><node att3=\"value\" />"));
+ CHECK_NODE(doc, STR("<nod1 attr=\"value\"/><node attr=\"valu2\"/><node att3=\"value\"/>"));
}
TEST(dom_node_copy_attribute_copyless)
@@ -1536,7 +1536,7 @@ TEST(dom_node_copy_attribute_copyless)
data += STR("<node attr=\"");
for (int i = 0; i < 10000; ++i)
data += STR("data");
- data += STR("\" />");
+ data += STR("\"/>");
std::basic_string<char_t> datacopy = data;
@@ -1571,21 +1571,21 @@ TEST_XML(dom_node_copy_attribute_copyless_taint, "<node attr=\"value\" />")
xml_node copy2 = doc.append_child(STR("copy2"));
xml_node copy3 = doc.append_child(STR("copy3"));
- CHECK_NODE(doc, STR("<node attr=\"value\" /><copy1 /><copy2 /><copy3 />"));
+ CHECK_NODE(doc, STR("<node attr=\"value\"/><copy1/><copy2/><copy3/>"));
copy1.append_copy(attr);
- CHECK_NODE(doc, STR("<node attr=\"value\" /><copy1 attr=\"value\" /><copy2 /><copy3 />"));
+ CHECK_NODE(doc, STR("<node attr=\"value\"/><copy1 attr=\"value\"/><copy2/><copy3/>"));
attr.set_name(STR("att1"));
copy2.append_copy(attr);
- CHECK_NODE(doc, STR("<node att1=\"value\" /><copy1 attr=\"value\" /><copy2 att1=\"value\" /><copy3 />"));
+ CHECK_NODE(doc, STR("<node att1=\"value\"/><copy1 attr=\"value\"/><copy2 att1=\"value\"/><copy3/>"));
copy1.first_attribute().set_value(STR("valu2"));
copy3.append_copy(copy1.first_attribute());
- CHECK_NODE(doc, STR("<node att1=\"value\" /><copy1 attr=\"valu2\" /><copy2 att1=\"value\" /><copy3 attr=\"valu2\" />"));
+ CHECK_NODE(doc, STR("<node att1=\"value\"/><copy1 attr=\"valu2\"/><copy2 att1=\"value\"/><copy3 attr=\"valu2\"/>"));
}
TEST_XML(dom_node_copy_out_of_memory_node, "<node><child1 /><child2 /><child3>text1<child4 />text2</child3></node>")
diff --git a/tests/test_dom_text.cpp b/tests/test_dom_text.cpp
index 7582460..8f62e49 100644
--- a/tests/test_dom_text.cpp
+++ b/tests/test_dom_text.cpp
@@ -403,16 +403,16 @@ TEST_XML(dom_text_middle, "<node><c1>notthisone</c1>text<c2/></node>")
CHECK_STRING(t.get(), STR("text"));
t.set(STR("notext"));
- CHECK_NODE(node, STR("<node><c1>notthisone</c1>notext<c2 /></node>"));
+ CHECK_NODE(node, STR("<node><c1>notthisone</c1>notext<c2/></node>"));
CHECK(node.remove_child(t.data()));
CHECK(!t);
- CHECK_NODE(node, STR("<node><c1>notthisone</c1><c2 /></node>"));
+ CHECK_NODE(node, STR("<node><c1>notthisone</c1><c2/></node>"));
t.set(STR("yestext"));
CHECK(t);
- CHECK_NODE(node, STR("<node><c1>notthisone</c1><c2 />yestext</node>"));
+ CHECK_NODE(node, STR("<node><c1>notthisone</c1><c2/>yestext</node>"));
CHECK(t.data() == node.last_child());
}
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp
index bc40815..dc709a2 100644
--- a/tests/test_parse.cpp
+++ b/tests/test_parse.cpp
@@ -288,38 +288,38 @@ TEST(parse_ws_pcdata_permutations)
test_data_t test_data[] =
{
// external pcdata should be discarded (whitespace or not)
- {7, STR("ext1<node/>"), STR("<node />"), 2},
- {7, STR("ext1<node/>ext2"), STR("<node />"), 2},
- {7, STR(" <node/>"), STR("<node />"), 2},
- {7, STR("<node/> "), STR("<node />"), 2},
- {7, STR(" <node/> "), STR("<node />"), 2},
+ {7, STR("ext1<node/>"), STR("<node/>"), 2},
+ {7, STR("ext1<node/>ext2"), STR("<node/>"), 2},
+ {7, STR(" <node/>"), STR("<node/>"), 2},
+ {7, STR("<node/> "), STR("<node/>"), 2},
+ {7, STR(" <node/> "), STR("<node/>"), 2},
// inner pcdata should be preserved
{7, STR("<node>inner</node>"), STR("<node>inner</node>"), 3},
- {7, STR("<node>inner1<child/>inner2</node>"), STR("<node>inner1<child />inner2</node>"), 5},
+ {7, STR("<node>inner1<child/>inner2</node>"), STR("<node>inner1<child/>inner2</node>"), 5},
{7, STR("<node>inner1<child>deep</child>inner2</node>"), STR("<node>inner1<child>deep</child>inner2</node>"), 6},
// empty pcdata nodes should never be created
- {7, STR("<node>inner1<child></child>inner2</node>"), STR("<node>inner1<child />inner2</node>"), 5},
- {7, STR("<node><child></child>inner2</node>"), STR("<node><child />inner2</node>"), 4},
- {7, STR("<node>inner1<child></child></node>"), STR("<node>inner1<child /></node>"), 4},
- {7, STR("<node><child></child></node>"), STR("<node><child /></node>"), 3},
+ {7, STR("<node>inner1<child></child>inner2</node>"), STR("<node>inner1<child/>inner2</node>"), 5},
+ {7, STR("<node><child></child>inner2</node>"), STR("<node><child/>inner2</node>"), 4},
+ {7, STR("<node>inner1<child></child></node>"), STR("<node>inner1<child/></node>"), 4},
+ {7, STR("<node><child></child></node>"), STR("<node><child/></node>"), 3},
// comments, pi or other nodes should not cause pcdata creation either
- {7, STR("<node><!----><child><?pi?></child><![CDATA[x]]></node>"), STR("<node><child /><![CDATA[x]]></node>"), 4},
+ {7, STR("<node><!----><child><?pi?></child><![CDATA[x]]></node>"), STR("<node><child/><![CDATA[x]]></node>"), 4},
// leading/trailing pcdata whitespace should be preserved (note: this will change if parse_ws_pcdata_trim is introduced)
{7, STR("<node>\t \tinner1<child> deep </child>\t\ninner2\n\t</node>"), STR("<node>\t \tinner1<child> deep </child>\t\ninner2\n\t</node>"), 6},
// whitespace-only pcdata preservation depends on the parsing mode
- {1, STR("<node>\n\t<child> </child>\n\t<child> <deep> </deep> </child>\n\t<!---->\n\t</node>"), STR("<node><child /><child><deep /></child></node>"), 5},
+ {1, STR("<node>\n\t<child> </child>\n\t<child> <deep> </deep> </child>\n\t<!---->\n\t</node>"), STR("<node><child/><child><deep/></child></node>"), 5},
{2, STR("<node>\n\t<child> </child>\n\t<child> <deep> </deep> </child>\n\t<!---->\n\t</node>"), STR("<node>\n\t<child> </child>\n\t<child> <deep> </deep> </child>\n\t\n\t</node>"), 13},
{4, STR("<node>\n\t<child> </child>\n\t<child> <deep> </deep> </child>\n\t<!---->\n\t</node>"), STR("<node><child> </child><child><deep> </deep></child></node>"), 7},
// current implementation of parse_ws_pcdata_single has an unfortunate bug; reproduce it here
{4, STR("<node>\t\t<!---->\n\n</node>"), STR("<node>\n\n</node>"), 3},
// error case: terminate PCDATA in the middle
{7, STR("<node>abcdef"), STR("<node>abcdef</node>"), -3},
- {5, STR("<node> "), STR("<node />"), -2},
+ {5, STR("<node> "), STR("<node/>"), -2},
{2, STR("<node> "), STR("<node> </node>"), -3},
// error case: terminate PCDATA as early as possible
- {7, STR("<node>"), STR("<node />"), -2},
+ {7, STR("<node>"), STR("<node/>"), -2},
{7, STR("<node>a"), STR("<node>a</node>"), -3},
- {5, STR("<node> "), STR("<node />"), -2},
+ {5, STR("<node> "), STR("<node/>"), -2},
{2, STR("<node> "), STR("<node> </node>"), -3},
};
@@ -360,18 +360,18 @@ TEST(parse_ws_pcdata_fragment_permutations)
{7, STR("ext1"), STR("ext1"), 2},
{5, STR(" "), STR(""), 1},
{2, STR(" "), STR(" "), 2},
- {7, STR("ext1<node/>"), STR("ext1<node />"), 3},
- {7, STR("<node/>ext2"), STR("<node />ext2"), 3},
- {7, STR("ext1<node/>ext2"), STR("ext1<node />ext2"), 4},
- {7, STR("ext1<node1/>ext2<node2/>ext3"), STR("ext1<node1 />ext2<node2 />ext3"), 6},
- {5, STR(" <node/>"), STR("<node />"), 2},
- {2, STR(" <node/>"), STR(" <node />"), 3},
- {5, STR("<node/> "), STR("<node />"), 2},
- {2, STR("<node/> "), STR("<node /> "), 3},
- {5, STR(" <node/> "), STR("<node />"), 2},
- {2, STR(" <node/> "), STR(" <node /> "), 4},
- {5, STR(" <node1/> <node2/> "), STR("<node1 /><node2 />"), 3},
- {2, STR(" <node1/> <node2/> "), STR(" <node1 /> <node2 /> "), 6},
+ {7, STR("ext1<node/>"), STR("ext1<node/>"), 3},
+ {7, STR("<node/>ext2"), STR("<node/>ext2"), 3},
+ {7, STR("ext1<node/>ext2"), STR("ext1<node/>ext2"), 4},
+ {7, STR("ext1<node1/>ext2<node2/>ext3"), STR("ext1<node1/>ext2<node2/>ext3"), 6},
+ {5, STR(" <node/>"), STR("<node/>"), 2},
+ {2, STR(" <node/>"), STR(" <node/>"), 3},
+ {5, STR("<node/> "), STR("<node/>"), 2},
+ {2, STR("<node/> "), STR("<node/> "), 3},
+ {5, STR(" <node/> "), STR("<node/>"), 2},
+ {2, STR(" <node/> "), STR(" <node/> "), 4},
+ {5, STR(" <node1/> <node2/> "), STR("<node1/><node2/>"), 3},
+ {2, STR(" <node1/> <node2/> "), STR(" <node1/> <node2/> "), 6},
};
for (size_t i = 0; i < sizeof(test_data) / sizeof(test_data[0]); ++i)
@@ -750,14 +750,14 @@ TEST(parse_tag_single)
{
xml_document doc;
CHECK(doc.load_string(STR("<node/><node /><node\n/>"), parse_minimal));
- CHECK_NODE(doc, STR("<node /><node /><node />"));
+ CHECK_NODE(doc, STR("<node/><node/><node/>"));
}
TEST(parse_tag_hierarchy)
{
xml_document doc;
CHECK(doc.load_string(STR("<node><n1><n2/></n1><n3><n4><n5></n5></n4></n3 \r\n></node>"), parse_minimal));
- CHECK_NODE(doc, STR("<node><n1><n2 /></n1><n3><n4><n5 /></n4></n3></node>"));
+ CHECK_NODE(doc, STR("<node><n1><n2/></n1><n3><n4><n5/></n4></n3></node>"));
}
TEST(parse_tag_error)
@@ -894,7 +894,7 @@ TEST(parse_out_of_memory_halfway_node)
xml_document doc;
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, count * 4).status == status_out_of_memory));
- CHECK_NODE(doc.first_child(), STR("<n />"));
+ CHECK_NODE(doc.first_child(), STR("<n/>"));
}
TEST(parse_out_of_memory_halfway_attr)
@@ -952,7 +952,7 @@ TEST(parse_out_of_memory_allocator_state_sync)
xml_document doc;
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, count * 4).status == status_out_of_memory));
- CHECK_NODE(doc.first_child(), STR("<n />"));
+ CHECK_NODE(doc.first_child(), STR("<n/>"));
test_runner::_memory_fail_threshold = 0;
@@ -1177,7 +1177,7 @@ TEST(parse_embed_pcdata)
CHECK_XPATH_NUMBER(doc, STR("count(node/child/*[starts-with(., 'value')])"), 2);
#endif
- CHECK_NODE(doc, STR("<node><key>value</key><child><inner1>value1</inner1><inner2>value2</inner2>outer</child><two>text<data /></two></node>"));
+ CHECK_NODE(doc, STR("<node><key>value</key><child><inner1>value1</inner1><inner2>value2</inner2>outer</child><two>text<data/></two></node>"));
CHECK_NODE_EX(doc, STR("<node>\n<key>value</key>\n<child>\n<inner1>value1</inner1>\n<inner2>value2</inner2>outer</child>\n<two>text<data />\n</two>\n</node>\n"), STR("\t"), 0);
CHECK_NODE_EX(doc, STR("<node>\n\t<key>value</key>\n\t<child>\n\t\t<inner1>value1</inner1>\n\t\t<inner2>value2</inner2>outer</child>\n\t<two>text<data />\n\t</two>\n</node>\n"), STR("\t"), format_indent);
}
diff --git a/tests/test_parse_doctype.cpp b/tests/test_parse_doctype.cpp
index 901890c..e32af8e 100644
--- a/tests/test_parse_doctype.cpp
+++ b/tests/test_parse_doctype.cpp
@@ -36,9 +36,9 @@ static bool test_doctype_wf(const char_t* decl)
if (!load_concat(doc, STR("a"), decl, STR("b")) || !test_node(doc, STR("ab"), STR(""), format_raw)) return false;
// node pre/postfix
- if (!load_concat(doc, STR("<nodea/>"), decl) || !test_node(doc, STR("<nodea />"), STR(""), format_raw)) return false;
- if (!load_concat(doc, decl, STR("<nodeb/>")) || !test_node(doc, STR("<nodeb />"), STR(""), format_raw)) return false;
- if (!load_concat(doc, STR("<nodea/>"), decl, STR("<nodeb/>")) || !test_node(doc, STR("<nodea /><nodeb />"), STR(""), format_raw)) return false;
+ if (!load_concat(doc, STR("<nodea/>"), decl) || !test_node(doc, STR("<nodea/>"), STR(""), format_raw)) return false;
+ if (!load_concat(doc, decl, STR("<nodeb/>")) || !test_node(doc, STR("<nodeb/>"), STR(""), format_raw)) return false;
+ if (!load_concat(doc, STR("<nodea/>"), decl, STR("<nodeb/>")) || !test_node(doc, STR("<nodea/><nodeb/>"), STR(""), format_raw)) return false;
// check load-store contents preservation
CHECK(doc.load_string(decl, parse_doctype | parse_fragment));
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index df7b0b1..341a4f0 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -192,12 +192,12 @@ TEST_XML(write_escape_unicode, "<node attr='&#x3c00;'/>")
{
#ifdef PUGIXML_WCHAR_MODE
#ifdef U_LITERALS
- CHECK_NODE(doc, STR("<node attr=\"\u3c00\" />"));
+ CHECK_NODE(doc, STR("<node attr=\"\u3c00\"/>"));
#else
- CHECK_NODE(doc, STR("<node attr=\"\x3c00\" />"));
+ CHECK_NODE(doc, STR("<node attr=\"\x3c00\"/>"));
#endif
#else
- CHECK_NODE(doc, STR("<node attr=\"\xe3\xb0\x80\" />"));
+ CHECK_NODE(doc, STR("<node attr=\"\xe3\xb0\x80\"/>"));
#endif
}
@@ -473,7 +473,7 @@ TEST(write_no_name_element)
root.append_child();
root.append_child().append_child(node_pcdata).set_value(STR("text"));
- CHECK_NODE(doc, STR("<:anonymous><:anonymous /><:anonymous>text</:anonymous></:anonymous>"));
+ CHECK_NODE(doc, STR("<:anonymous><:anonymous/><:anonymous>text</:anonymous></:anonymous>"));
CHECK_NODE_EX(doc, STR("<:anonymous>\n\t<:anonymous />\n\t<:anonymous>text</:anonymous>\n</:anonymous>\n"), STR("\t"), format_default);
}
@@ -491,7 +491,7 @@ TEST(write_no_name_attribute)
doc.append_child().set_name(STR("root"));
doc.child(STR("root")).append_attribute(STR(""));
- CHECK_NODE(doc, STR("<root :anonymous=\"\" />"));
+ CHECK_NODE(doc, STR("<root :anonymous=\"\"/>"));
}
TEST(write_print_empty)
@@ -596,7 +596,7 @@ TEST(write_pcdata_whitespace_fixedpoint)
TEST_XML_FLAGS(write_mixed, "<node><child1/><child2>pre<![CDATA[data]]>mid<!--comment--><test/>post<?pi value?>fin</child2><child3/></node>", parse_full)
{
- CHECK_NODE(doc, STR("<node><child1 /><child2>pre<![CDATA[data]]>mid<!--comment--><test />post<?pi value?>fin</child2><child3 /></node>"));
+ CHECK_NODE(doc, STR("<node><child1/><child2>pre<![CDATA[data]]>mid<!--comment--><test/>post<?pi value?>fin</child2><child3/></node>"));
CHECK_NODE_EX(doc, STR("<node>\n<child1 />\n<child2>pre<![CDATA[data]]>mid<!--comment-->\n<test />post<?pi value?>fin</child2>\n<child3 />\n</node>\n"), STR("\t"), 0);
CHECK_NODE_EX(doc, STR("<node>\n\t<child1 />\n\t<child2>pre<![CDATA[data]]>mid<!--comment-->\n\t\t<test />post<?pi value?>fin</child2>\n\t<child3 />\n</node>\n"), STR("\t"), format_indent);
}