mirror of https://github.com/AxioDL/tinyxml2.git
Merge git://github.com/leethomason/tinyxml2
This commit is contained in:
commit
9a0eb46d71
|
@ -28,15 +28,14 @@ if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
${TARGET_DATA_COPY}
|
${TARGET_DATA_COPY}
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "In source build")
|
COMMAND ${CMAKE_COMMAND} -E echo "In source build")
|
||||||
else(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
else(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
make_directory(${CMAKE_CURRENT_BINARY_DIR}/resources/)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
${TARGET_DATA_COPY}
|
${TARGET_DATA_COPY}
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/dream.xml ${CMAKE_CURRENT_BINARY_DIR}
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/dream.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/utf8test.xml ${CMAKE_CURRENT_BINARY_DIR}
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/utf8test.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/utf8testverify.xml ${CMAKE_CURRENT_BINARY_DIR})
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/utf8testverify.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/)
|
||||||
endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
set(OGL_DATA_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data)
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# Add definitions
|
# Add definitions
|
||||||
|
|
||||||
|
|
22
tinyxml2.cpp
22
tinyxml2.cpp
|
@ -23,18 +23,10 @@ distribution.
|
||||||
|
|
||||||
#include "tinyxml2.h"
|
#include "tinyxml2.h"
|
||||||
|
|
||||||
#if 1
|
#include <cstdio>
|
||||||
#include <cstdio>
|
#include <cstdlib>
|
||||||
#include <cstdlib>
|
#include <new>
|
||||||
#include <new>
|
#include <cstddef>
|
||||||
#else
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <new>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
|
|
||||||
|
@ -120,7 +112,7 @@ char* StrPair::ParseText( char* p, const char* endTag, int strFlags )
|
||||||
|
|
||||||
char* start = p; // fixme: hides a member
|
char* start = p; // fixme: hides a member
|
||||||
char endChar = *endTag;
|
char endChar = *endTag;
|
||||||
int length = strlen( endTag );
|
size_t length = strlen( endTag );
|
||||||
|
|
||||||
// Inner loop of text parsing.
|
// Inner loop of text parsing.
|
||||||
while ( *p ) {
|
while ( *p ) {
|
||||||
|
@ -316,7 +308,7 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length )
|
||||||
if ( *(p+1) == '#' && *(p+2) )
|
if ( *(p+1) == '#' && *(p+2) )
|
||||||
{
|
{
|
||||||
unsigned long ucs = 0;
|
unsigned long ucs = 0;
|
||||||
int delta = 0;
|
ptrdiff_t delta = 0;
|
||||||
unsigned mult = 1;
|
unsigned mult = 1;
|
||||||
|
|
||||||
if ( *(p+2) == 'x' )
|
if ( *(p+2) == 'x' )
|
||||||
|
@ -329,7 +321,7 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length )
|
||||||
|
|
||||||
if ( !q || !*q ) return 0;
|
if ( !q || !*q ) return 0;
|
||||||
|
|
||||||
delta = (q-p);
|
delta = q-p;
|
||||||
--q;
|
--q;
|
||||||
|
|
||||||
while ( *q != 'x' )
|
while ( *q != 'x' )
|
||||||
|
|
58
tinyxml2.h
58
tinyxml2.h
|
@ -171,7 +171,7 @@ public:
|
||||||
~DynArray()
|
~DynArray()
|
||||||
{
|
{
|
||||||
if ( mem != pool ) {
|
if ( mem != pool ) {
|
||||||
delete mem;
|
delete [] mem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Push( T t )
|
void Push( T t )
|
||||||
|
@ -225,7 +225,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Parent virtual class a a pool for fast allocation
|
Parent virtual class of a pool for fast allocation
|
||||||
and deallocation of objects.
|
and deallocation of objects.
|
||||||
*/
|
*/
|
||||||
class MemPool
|
class MemPool
|
||||||
|
@ -314,16 +314,16 @@ private:
|
||||||
Implements the interface to the "Visitor pattern" (see the Accept() method.)
|
Implements the interface to the "Visitor pattern" (see the Accept() method.)
|
||||||
If you call the Accept() method, it requires being passed a XMLVisitor
|
If you call the Accept() method, it requires being passed a XMLVisitor
|
||||||
class to handle callbacks. For nodes that contain other nodes (Document, Element)
|
class to handle callbacks. For nodes that contain other nodes (Document, Element)
|
||||||
you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves
|
you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs
|
||||||
are simply called with Visit().
|
are simply called with Visit().
|
||||||
|
|
||||||
If you return 'true' from a Visit method, recursive parsing will continue. If you return
|
If you return 'true' from a Visit method, recursive parsing will continue. If you return
|
||||||
false, <b>no children of this node or its sibilings</b> will be Visited.
|
false, <b>no children of this node or its sibilings</b> will be visited.
|
||||||
|
|
||||||
All flavors of Visit methods have a default implementation that returns 'true' (continue
|
All flavors of Visit methods have a default implementation that returns 'true' (continue
|
||||||
visiting). You need to only override methods that are interesting to you.
|
visiting). You need to only override methods that are interesting to you.
|
||||||
|
|
||||||
Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting.
|
Generally Accept() is called on the TiXmlDocument, although all nodes support visiting.
|
||||||
|
|
||||||
You should never change the document from a callback.
|
You should never change the document from a callback.
|
||||||
|
|
||||||
|
@ -344,13 +344,13 @@ public:
|
||||||
/// Visit an element.
|
/// Visit an element.
|
||||||
virtual bool VisitExit( const XMLElement& /*element*/ ) { return true; }
|
virtual bool VisitExit( const XMLElement& /*element*/ ) { return true; }
|
||||||
|
|
||||||
/// Visit a declaration
|
/// Visit a declaration.
|
||||||
virtual bool Visit( const XMLDeclaration& /*declaration*/ ) { return true; }
|
virtual bool Visit( const XMLDeclaration& /*declaration*/ ) { return true; }
|
||||||
/// Visit a text node
|
/// Visit a text node.
|
||||||
virtual bool Visit( const XMLText& /*text*/ ) { return true; }
|
virtual bool Visit( const XMLText& /*text*/ ) { return true; }
|
||||||
/// Visit a comment node
|
/// Visit a comment node.
|
||||||
virtual bool Visit( const XMLComment& /*comment*/ ) { return true; }
|
virtual bool Visit( const XMLComment& /*comment*/ ) { return true; }
|
||||||
/// Visit an unknown node
|
/// Visit an unknown node.
|
||||||
virtual bool Visit( const XMLUnknown& /*unknown*/ ) { return true; }
|
virtual bool Visit( const XMLUnknown& /*unknown*/ ) { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ public:
|
||||||
The type of a XMLNode can be queried, and it can
|
The type of a XMLNode can be queried, and it can
|
||||||
be cast to its more defined type.
|
be cast to its more defined type.
|
||||||
|
|
||||||
An XMLDocument allocates memory for all its Nodes.
|
A XMLDocument allocates memory for all its Nodes.
|
||||||
When the XMLDocument gets deleted, all its Nodes
|
When the XMLDocument gets deleted, all its Nodes
|
||||||
will also be deleted.
|
will also be deleted.
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ public:
|
||||||
|
|
||||||
/** The meaning of 'value' changes for the specific type.
|
/** The meaning of 'value' changes for the specific type.
|
||||||
@verbatim
|
@verbatim
|
||||||
Document: empy
|
Document: empty
|
||||||
Element: name of the element
|
Element: name of the element
|
||||||
Comment: the comment text
|
Comment: the comment text
|
||||||
Unknown: the tag contents
|
Unknown: the tag contents
|
||||||
|
@ -542,7 +542,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool ShallowEqual( const XMLNode* compare ) const = 0;
|
virtual bool ShallowEqual( const XMLNode* compare ) const = 0;
|
||||||
|
|
||||||
/** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the
|
/** Accept a hierarchical visit of the nodes in the TinyXML DOM. Every node in the
|
||||||
XML tree will be conditionally visited and the host will be called back
|
XML tree will be conditionally visited and the host will be called back
|
||||||
via the TiXmlVisitor interface.
|
via the TiXmlVisitor interface.
|
||||||
|
|
||||||
|
@ -869,9 +869,9 @@ public:
|
||||||
/// See IntAttribute()
|
/// See IntAttribute()
|
||||||
bool BoolAttribute( const char* name ) const { bool b=false; QueryBoolAttribute( name, &b ); return b; }
|
bool BoolAttribute( const char* name ) const { bool b=false; QueryBoolAttribute( name, &b ); return b; }
|
||||||
/// See IntAttribute()
|
/// See IntAttribute()
|
||||||
double DoubleAttribute( const char* name ) const { double d=0; QueryDoubleAttribute( name, &d ); return d; }
|
double DoubleAttribute( const char* name ) const { double d=0; QueryDoubleAttribute( name, &d ); return d; }
|
||||||
/// See IntAttribute()
|
/// See IntAttribute()
|
||||||
float FloatAttribute( const char* name ) const { float f=0; QueryFloatAttribute( name, &f ); return f; }
|
float FloatAttribute( const char* name ) const { float f=0; QueryFloatAttribute( name, &f ); return f; }
|
||||||
|
|
||||||
/** Given an attribute name, QueryIntAttribute() returns
|
/** Given an attribute name, QueryIntAttribute() returns
|
||||||
XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the conversion
|
XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the conversion
|
||||||
|
@ -886,7 +886,7 @@ public:
|
||||||
QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10
|
QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10
|
||||||
@endverbatim
|
@endverbatim
|
||||||
*/
|
*/
|
||||||
int QueryIntAttribute( const char* name, int* _value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) return XML_NO_ATTRIBUTE; return a->QueryIntValue( _value ); }
|
int QueryIntAttribute( const char* name, int* _value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) return XML_NO_ATTRIBUTE; return a->QueryIntValue( _value ); }
|
||||||
/// See QueryIntAttribute()
|
/// See QueryIntAttribute()
|
||||||
int QueryUnsignedAttribute( const char* name, unsigned int* _value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) return XML_NO_ATTRIBUTE; return a->QueryUnsignedValue( _value ); }
|
int QueryUnsignedAttribute( const char* name, unsigned int* _value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) return XML_NO_ATTRIBUTE; return a->QueryUnsignedValue( _value ); }
|
||||||
/// See QueryIntAttribute()
|
/// See QueryIntAttribute()
|
||||||
|
@ -894,7 +894,7 @@ public:
|
||||||
/// See QueryIntAttribute()
|
/// See QueryIntAttribute()
|
||||||
int QueryDoubleAttribute( const char* name, double* _value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) return XML_NO_ATTRIBUTE; return a->QueryDoubleValue( _value ); }
|
int QueryDoubleAttribute( const char* name, double* _value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) return XML_NO_ATTRIBUTE; return a->QueryDoubleValue( _value ); }
|
||||||
/// See QueryIntAttribute()
|
/// See QueryIntAttribute()
|
||||||
int QueryFloatAttribute( const char* name, float* _value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) return XML_NO_ATTRIBUTE; return a->QueryFloatValue( _value ); }
|
int QueryFloatAttribute( const char* name, float* _value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) return XML_NO_ATTRIBUTE; return a->QueryFloatValue( _value ); }
|
||||||
|
|
||||||
/// Sets the named attribute to value.
|
/// Sets the named attribute to value.
|
||||||
void SetAttribute( const char* name, const char* _value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( _value ); }
|
void SetAttribute( const char* name, const char* _value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( _value ); }
|
||||||
|
@ -905,7 +905,7 @@ public:
|
||||||
/// Sets the named attribute to value.
|
/// Sets the named attribute to value.
|
||||||
void SetAttribute( const char* name, bool _value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( _value ); }
|
void SetAttribute( const char* name, bool _value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( _value ); }
|
||||||
/// Sets the named attribute to value.
|
/// Sets the named attribute to value.
|
||||||
void SetAttribute( const char* name, double _value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( _value ); }
|
void SetAttribute( const char* name, double _value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( _value ); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Delete an attribute.
|
Delete an attribute.
|
||||||
|
@ -977,7 +977,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** A document binds together all the functionality.
|
/** A Document binds together all the functionality.
|
||||||
It can be saved, loaded, and printed to the screen.
|
It can be saved, loaded, and printed to the screen.
|
||||||
All Nodes are connected and allocated to a Document.
|
All Nodes are connected and allocated to a Document.
|
||||||
If the Document is deleted, all its Nodes are also deleted.
|
If the Document is deleted, all its Nodes are also deleted.
|
||||||
|
@ -1024,7 +1024,7 @@ public:
|
||||||
int SaveFile( const char* filename );
|
int SaveFile( const char* filename );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Save the XML file to disk. You are responsible
|
Save the XML file to disk. You are responsible
|
||||||
for providing and closing the FILE*.
|
for providing and closing the FILE*.
|
||||||
|
|
||||||
Returns XML_NO_ERROR (0) on success, or
|
Returns XML_NO_ERROR (0) on success, or
|
||||||
|
@ -1103,7 +1103,7 @@ public:
|
||||||
XMLUnknown* NewUnknown( const char* text );
|
XMLUnknown* NewUnknown( const char* text );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Delete a node associated with this documented.
|
Delete a node associated with this document.
|
||||||
It will be unlinked from the DOM.
|
It will be unlinked from the DOM.
|
||||||
*/
|
*/
|
||||||
void DeleteNode( XMLNode* node ) { node->parent->DeleteChild( node ); }
|
void DeleteNode( XMLNode* node ) { node->parent->DeleteChild( node ); }
|
||||||
|
@ -1116,9 +1116,9 @@ public:
|
||||||
int ErrorID() const { return errorID; }
|
int ErrorID() const { return errorID; }
|
||||||
/// Return a possibly helpful diagnostic location or string.
|
/// Return a possibly helpful diagnostic location or string.
|
||||||
const char* GetErrorStr1() const { return errorStr1; }
|
const char* GetErrorStr1() const { return errorStr1; }
|
||||||
/// Return possibly helpful secondary diagnostic location or string.
|
/// Return a possibly helpful secondary diagnostic location or string.
|
||||||
const char* GetErrorStr2() const { return errorStr2; }
|
const char* GetErrorStr2() const { return errorStr2; }
|
||||||
/// If there is an error, print it to stdout
|
/// If there is an error, print it to stdout.
|
||||||
void PrintError() const;
|
void PrintError() const;
|
||||||
|
|
||||||
// internal
|
// internal
|
||||||
|
@ -1158,7 +1158,7 @@ private:
|
||||||
<Child attributeB = "value1" />
|
<Child attributeB = "value1" />
|
||||||
<Child attributeB = "value2" />
|
<Child attributeB = "value2" />
|
||||||
</Element>
|
</Element>
|
||||||
<Document>
|
</Document>
|
||||||
@endverbatim
|
@endverbatim
|
||||||
|
|
||||||
Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
|
Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
|
||||||
|
@ -1286,7 +1286,7 @@ private:
|
||||||
|
|
||||||
It can:
|
It can:
|
||||||
-# Print to memory.
|
-# Print to memory.
|
||||||
-# Print to a file you provide
|
-# Print to a file you provide.
|
||||||
-# Print XML without a XMLDocument.
|
-# Print XML without a XMLDocument.
|
||||||
|
|
||||||
Print to Memory
|
Print to Memory
|
||||||
|
@ -1294,7 +1294,7 @@ private:
|
||||||
@verbatim
|
@verbatim
|
||||||
XMLPrinter printer;
|
XMLPrinter printer;
|
||||||
doc->Print( &printer );
|
doc->Print( &printer );
|
||||||
SomeFunctior( printer.CStr() );
|
SomeFunction( printer.CStr() );
|
||||||
@endverbatim
|
@endverbatim
|
||||||
|
|
||||||
Print to a File
|
Print to a File
|
||||||
|
@ -1349,7 +1349,7 @@ public:
|
||||||
|
|
||||||
/// Add a text node.
|
/// Add a text node.
|
||||||
void PushText( const char* text, bool cdata=false );
|
void PushText( const char* text, bool cdata=false );
|
||||||
/// Add a comment
|
/// Add a comment.
|
||||||
void PushComment( const char* comment );
|
void PushComment( const char* comment );
|
||||||
|
|
||||||
void PushDeclaration( const char* value );
|
void PushDeclaration( const char* value );
|
||||||
|
@ -1371,6 +1371,12 @@ public:
|
||||||
the XML file in memory.
|
the XML file in memory.
|
||||||
*/
|
*/
|
||||||
const char* CStr() const { return buffer.Mem(); }
|
const char* CStr() const { return buffer.Mem(); }
|
||||||
|
/**
|
||||||
|
If in print to memory mode, return the size
|
||||||
|
of the XML file in memory. (Note the size returned
|
||||||
|
includes the terminating null.)
|
||||||
|
*/
|
||||||
|
const int CStrSize()const{ return buffer.Size(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SealElement();
|
void SealElement();
|
||||||
|
|
|
@ -8,32 +8,11 @@
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
037AE8A5151E692700E0F29F /* xmltest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 037AE8A3151E692700E0F29F /* xmltest.cpp */; };
|
037AE8A5151E692700E0F29F /* xmltest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 037AE8A3151E692700E0F29F /* xmltest.cpp */; };
|
||||||
037AE9BE151E694400E0F29F /* dream.xml in CopyFiles */ = {isa = PBXBuildFile; fileRef = 037AE062151CCC6D00E0F29F /* dream.xml */; };
|
|
||||||
037AE9BF151E694400E0F29F /* utf8test.xml in CopyFiles */ = {isa = PBXBuildFile; fileRef = 037AE065151CCC6D00E0F29F /* utf8test.xml */; };
|
|
||||||
037AE9C0151E694400E0F29F /* utf8testverify.xml in CopyFiles */ = {isa = PBXBuildFile; fileRef = 037AE066151CCC6D00E0F29F /* utf8testverify.xml */; };
|
|
||||||
03F28B53152E9B1B00D4CD90 /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03F28B4A152E9B1B00D4CD90 /* tinyxml2.cpp */; };
|
03F28B53152E9B1B00D4CD90 /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03F28B4A152E9B1B00D4CD90 /* tinyxml2.cpp */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
|
||||||
037AE9CF151E697800E0F29F /* CopyFiles */ = {
|
|
||||||
isa = PBXCopyFilesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
dstPath = "";
|
|
||||||
dstSubfolderSpec = 7;
|
|
||||||
files = (
|
|
||||||
037AE9BE151E694400E0F29F /* dream.xml in CopyFiles */,
|
|
||||||
037AE9BF151E694400E0F29F /* utf8test.xml in CopyFiles */,
|
|
||||||
037AE9C0151E694400E0F29F /* utf8testverify.xml in CopyFiles */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXCopyFilesBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
037AE062151CCC6D00E0F29F /* dream.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = dream.xml; sourceTree = "<group>"; };
|
037AE86D151E685F00E0F29F /* xmltest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = xmltest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
037AE065151CCC6D00E0F29F /* utf8test.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = utf8test.xml; sourceTree = "<group>"; };
|
|
||||||
037AE066151CCC6D00E0F29F /* utf8testverify.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = utf8testverify.xml; sourceTree = "<group>"; };
|
|
||||||
037AE86D151E685F00E0F29F /* tinyxml2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tinyxml2; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
||||||
037AE8A3151E692700E0F29F /* xmltest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmltest.cpp; path = ../xmltest.cpp; sourceTree = SOURCE_ROOT; };
|
037AE8A3151E692700E0F29F /* xmltest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xmltest.cpp; path = ../xmltest.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
03F28B4A152E9B1B00D4CD90 /* tinyxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinyxml2.cpp; sourceTree = "<group>"; };
|
03F28B4A152E9B1B00D4CD90 /* tinyxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinyxml2.cpp; sourceTree = "<group>"; };
|
||||||
03F28B4B152E9B1B00D4CD90 /* tinyxml2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tinyxml2.h; sourceTree = "<group>"; };
|
03F28B4B152E9B1B00D4CD90 /* tinyxml2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tinyxml2.h; sourceTree = "<group>"; };
|
||||||
|
@ -54,7 +33,6 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
037AE069151CCC7000E0F29F /* Classes */,
|
037AE069151CCC7000E0F29F /* Classes */,
|
||||||
037AE06A151CCC7C00E0F29F /* Resources */,
|
|
||||||
03F28B60152E9B4C00D4CD90 /* Libraries */,
|
03F28B60152E9B4C00D4CD90 /* Libraries */,
|
||||||
037AE06F151CCCB900E0F29F /* Products */,
|
037AE06F151CCCB900E0F29F /* Products */,
|
||||||
);
|
);
|
||||||
|
@ -68,21 +46,10 @@
|
||||||
name = Classes;
|
name = Classes;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
037AE06A151CCC7C00E0F29F /* Resources */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
037AE062151CCC6D00E0F29F /* dream.xml */,
|
|
||||||
037AE065151CCC6D00E0F29F /* utf8test.xml */,
|
|
||||||
037AE066151CCC6D00E0F29F /* utf8testverify.xml */,
|
|
||||||
);
|
|
||||||
name = Resources;
|
|
||||||
path = ..;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
037AE06F151CCCB900E0F29F /* Products */ = {
|
037AE06F151CCCB900E0F29F /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
037AE86D151E685F00E0F29F /* tinyxml2 */,
|
037AE86D151E685F00E0F29F /* xmltest */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -108,21 +75,20 @@
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
037AE86C151E685F00E0F29F /* tinyxml2 */ = {
|
037AE86C151E685F00E0F29F /* xmltest */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 037AE873151E687E00E0F29F /* Build configuration list for PBXNativeTarget "tinyxml2" */;
|
buildConfigurationList = 037AE873151E687E00E0F29F /* Build configuration list for PBXNativeTarget "xmltest" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
037AE86A151E685F00E0F29F /* Sources */,
|
037AE86A151E685F00E0F29F /* Sources */,
|
||||||
037AE86B151E685F00E0F29F /* Frameworks */,
|
037AE86B151E685F00E0F29F /* Frameworks */,
|
||||||
037AE9CF151E697800E0F29F /* CopyFiles */,
|
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
);
|
);
|
||||||
name = tinyxml2;
|
name = xmltest;
|
||||||
productName = tinyxml2;
|
productName = tinyxml2;
|
||||||
productReference = 037AE86D151E685F00E0F29F /* tinyxml2 */;
|
productReference = 037AE86D151E685F00E0F29F /* xmltest */;
|
||||||
productType = "com.apple.product-type.tool";
|
productType = "com.apple.product-type.tool";
|
||||||
};
|
};
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
|
@ -145,7 +111,7 @@
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
037AE86C151E685F00E0F29F /* tinyxml2 */,
|
037AE86C151E685F00E0F29F /* xmltest */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
|
@ -183,6 +149,7 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CONFIGURATION_BUILD_DIR = ..;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||||
|
@ -190,7 +157,7 @@
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
INSTALL_PATH = /usr/local/bin;
|
INSTALL_PATH = /usr/local/bin;
|
||||||
PREBINDING = NO;
|
PREBINDING = NO;
|
||||||
PRODUCT_NAME = tinyxml2;
|
PRODUCT_NAME = xmltest;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
@ -198,6 +165,7 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CONFIGURATION_BUILD_DIR = ..;
|
||||||
COPY_PHASE_STRIP = YES;
|
COPY_PHASE_STRIP = YES;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||||
|
@ -221,7 +189,7 @@
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
037AE873151E687E00E0F29F /* Build configuration list for PBXNativeTarget "tinyxml2" */ = {
|
037AE873151E687E00E0F29F /* Build configuration list for PBXNativeTarget "xmltest" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
037AE86F151E686000E0F29F /* Debug */,
|
037AE86F151E686000E0F29F /* Debug */,
|
||||||
|
|
29
xmltest.cpp
29
xmltest.cpp
|
@ -75,7 +75,7 @@ void NullLineEndings( char* p )
|
||||||
int example_1()
|
int example_1()
|
||||||
{
|
{
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.LoadFile( "dream.xml" );
|
doc.LoadFile( "resources/dream.xml" );
|
||||||
|
|
||||||
return doc.ErrorID();
|
return doc.ErrorID();
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FILE* fp = fopen( "dream.xml", "r" );
|
FILE* fp = fopen( "resources/dream.xml", "r" );
|
||||||
if ( !fp ) {
|
if ( !fp ) {
|
||||||
printf( "Error opening test file 'dream.xml'.\n"
|
printf( "Error opening test file 'dream.xml'.\n"
|
||||||
"Is your working directory the same as where \n"
|
"Is your working directory the same as where \n"
|
||||||
|
@ -260,9 +260,9 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
// XML2 : 469,073 bytes in 323 allocations
|
// XML2 : 469,073 bytes in 323 allocations
|
||||||
//int newStart = gNew;
|
//int newStart = gNew;
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.LoadFile( "dream.xml" );
|
doc.LoadFile( "resources/dream.xml" );
|
||||||
|
|
||||||
doc.SaveFile( "dreamout.xml" );
|
doc.SaveFile( "resources/dreamout.xml" );
|
||||||
doc.PrintError();
|
doc.PrintError();
|
||||||
|
|
||||||
XMLTest( "Dream", "xml version=\"1.0\"",
|
XMLTest( "Dream", "xml version=\"1.0\"",
|
||||||
|
@ -276,7 +276,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
|
doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
|
||||||
|
|
||||||
XMLDocument doc2;
|
XMLDocument doc2;
|
||||||
doc2.LoadFile( "dreamout.xml" );
|
doc2.LoadFile( "resources/dreamout.xml" );
|
||||||
XMLTest( "Dream-out", "xml version=\"1.0\"",
|
XMLTest( "Dream-out", "xml version=\"1.0\"",
|
||||||
doc2.FirstChild()->ToDeclaration()->Value() );
|
doc2.FirstChild()->ToDeclaration()->Value() );
|
||||||
XMLTest( "Dream-out", true, doc2.FirstChild()->NextSibling()->ToUnknown() ? true : false );
|
XMLTest( "Dream-out", true, doc2.FirstChild()->NextSibling()->ToUnknown() ? true : false );
|
||||||
|
@ -352,7 +352,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
|
|
||||||
{
|
{
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.LoadFile( "utf8test.xml" );
|
doc.LoadFile( "resources/utf8test.xml" );
|
||||||
|
|
||||||
// Get the attribute "value" from the "Russian" element and check it.
|
// Get the attribute "value" from the "Russian" element and check it.
|
||||||
XMLElement* element = doc.FirstChildElement( "document" )->FirstChildElement( "Russian" );
|
XMLElement* element = doc.FirstChildElement( "document" )->FirstChildElement( "Russian" );
|
||||||
|
@ -373,7 +373,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
text->Value() );
|
text->Value() );
|
||||||
|
|
||||||
// Now try for a round trip.
|
// Now try for a round trip.
|
||||||
doc.SaveFile( "utf8testout.xml" );
|
doc.SaveFile( "resources/utf8testout.xml" );
|
||||||
|
|
||||||
// Check the round trip.
|
// Check the round trip.
|
||||||
char savedBuf[256];
|
char savedBuf[256];
|
||||||
|
@ -385,8 +385,8 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
#pragma warning ( push )
|
#pragma warning ( push )
|
||||||
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
||||||
#endif
|
#endif
|
||||||
FILE* saved = fopen( "utf8testout.xml", "r" );
|
FILE* saved = fopen( "resources/utf8testout.xml", "r" );
|
||||||
FILE* verify = fopen( "utf8testverify.xml", "r" );
|
FILE* verify = fopen( "resources/utf8testverify.xml", "r" );
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning ( pop )
|
#pragma warning ( pop )
|
||||||
#endif
|
#endif
|
||||||
|
@ -506,7 +506,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
#pragma warning ( push )
|
#pragma warning ( push )
|
||||||
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
||||||
#endif
|
#endif
|
||||||
FILE* textfile = fopen( "textfile.txt", "w" );
|
FILE* textfile = fopen( "resources/textfile.txt", "w" );
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning ( pop )
|
#pragma warning ( pop )
|
||||||
#endif
|
#endif
|
||||||
|
@ -520,7 +520,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
#pragma warning ( push )
|
#pragma warning ( push )
|
||||||
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
||||||
#endif
|
#endif
|
||||||
textfile = fopen( "textfile.txt", "r" );
|
textfile = fopen( "resources/textfile.txt", "r" );
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning ( pop )
|
#pragma warning ( pop )
|
||||||
#endif
|
#endif
|
||||||
|
@ -589,9 +589,9 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
|
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( doctype );
|
doc.Parse( doctype );
|
||||||
doc.SaveFile( "test7.xml" );
|
doc.SaveFile( "resources/test7.xml" );
|
||||||
doc.DeleteChild( doc.RootElement() );
|
doc.DeleteChild( doc.RootElement() );
|
||||||
doc.LoadFile( "test7.xml" );
|
doc.LoadFile( "resources/test7.xml" );
|
||||||
doc.Print();
|
doc.Print();
|
||||||
|
|
||||||
const XMLUnknown* decl = doc.FirstChild()->NextSibling()->ToUnknown();
|
const XMLUnknown* decl = doc.FirstChild()->NextSibling()->ToUnknown();
|
||||||
|
@ -824,6 +824,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
|
|
||||||
static const char* result = "\xef\xbb\xbf<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
static const char* result = "\xef\xbb\xbf<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
||||||
XMLTest( "BOM and default declaration", printer.CStr(), result, false );
|
XMLTest( "BOM and default declaration", printer.CStr(), result, false );
|
||||||
|
XMLTest( "CStrSize", printer.CStrSize(), 42, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -838,7 +839,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
||||||
#pragma warning ( push )
|
#pragma warning ( push )
|
||||||
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
|
||||||
#endif
|
#endif
|
||||||
FILE* fp = fopen( "dream.xml", "r" );
|
FILE* fp = fopen( "resources/dream.xml", "r" );
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning ( pop )
|
#pragma warning ( pop )
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue