diff --git a/Lua/lib/pugilua.dll b/Lua/lib/pugilua.dll index 187336a..94b26d7 100644 Binary files a/Lua/lib/pugilua.dll and b/Lua/lib/pugilua.dll differ diff --git a/Lua/lib/pugilua.lib b/Lua/lib/pugilua.lib index 42378b5..d50aa99 100644 Binary files a/Lua/lib/pugilua.lib and b/Lua/lib/pugilua.lib differ diff --git a/Lua/lib/test.lua b/Lua/lib/test.lua index 1995c24..b753bb4 100644 --- a/Lua/lib/test.lua +++ b/Lua/lib/test.lua @@ -28,4 +28,8 @@ for i=0,n-1 do print(a.name) a=a:next_attribute() end -end \ No newline at end of file +end + +---- +node=doc:root():child('Project') +print(node.text) \ No newline at end of file diff --git a/contrib/pugilua/pugilua_lib.cpp b/contrib/pugilua/pugilua_lib.cpp index ffa7156..5eb85fb 100644 --- a/contrib/pugilua/pugilua_lib.cpp +++ b/contrib/pugilua/pugilua_lib.cpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace pugi { namespace lua { @@ -158,6 +159,8 @@ namespace pugi { RefCountedPtr select_nodes(char const* query) const; + std::string text() const; + //todo: text(), xml_tree_walker somehow public: // non-lua interface @@ -457,6 +460,12 @@ namespace pugi { } } + std::string lxml_node::text() const { + std::stringstream ss; + node.print(ss); + return ss.str(); + } + /////////////////// RefCountedPtr lxml_document::load_file(char const* path) { return RefCountedPtr(new lxml_parse_result(doc.load_file(path))); @@ -546,6 +555,7 @@ void register_pugilua (lua_State* L) { .addProperty("value",&lxml_node::value) .addProperty("type",&lxml_node::type) .addProperty("path",&lxml_node::path) + .addProperty("text",&lxml_node::text) .addFunction("child",&lxml_node::child) .addFunction("first_attribute",&lxml_node::first_attribute) .addFunction("last_attribute",&lxml_node::last_attribute)