A minimal lua wrapper of Xerces-C++ in order to be able to validate xml files in lua
C++ Lua Makefile Other
Switch branches/tags
Nothing to show
Latest commit 2718793 Aug 15, 2015 @d-led Update .travis.yml
Permalink
Failed to load latest commit information.
Build
deps
premake @ deda65b
src
test
.gitignore
.gitmodules
.travis.yml
README.md
premake4.lua

README.md

xerceslua

A minimal lua wrapper of Xerces-C++ in order to be able to validate xml files

Build Status

Usage

assert(require 'xerceslua')

local parser=xerces.XercesDOMParser()
parser:loadGrammar("sample.xsd",xerces.GrammarType.SchemaGrammarType)
parser:setValidationScheme(xerces.ValSchemes.Val_Always)
local log=parser:parse("sample.xml")
print('parse ok: ',log.Ok)
if not log.Ok then
    print('error count: ', log.Count)
    for i=0,log.Count-1 do
        local err=log:GetLogEntry(i)
        print(err.SystemId
        		..', l:'..err.LineNumber
        		..', c:'..err.ColumnNumber
        		..', e:'..err.Message
		)
    end
end

Example

run test.bat (or test.lua) from the test directory.

Dependencies

  • Xerces-C++ the original library, unpack the source into the xerceslua directory
  • lua the language, Lua 5.1.4 from luaforwindows, but it should work for every proper lua which is supported by LuaBridge
  • LuaBridge for the declarative bindings to Lua

License

This library is distributed under the MIT License:

Copyright (c) 2012-2014 Dmitry Ledentsov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.