Hi all, I've been using libxml 2.7.7 in the past with BCB6 and it was working fine. Now I use libxml 2.9.0 with MSVC 2010 (_MSC_VER = 1600) and I get strange validation errors when I try to read the file back that I wrote out before.
I am getting a bit frustrated because I am using the exact same code as I
did in BCB6 and despite all my efforts, it always fails.
When I validate the XML with a third-party tool, it all checks out just
fine.
When I run: "xmllint.exe --valid testme.xml", it simply dumps the XML back
without any validation errors.
For some reason, libxml 2.9.0 on MSVC 2010 won't validate it (even though
it's from the same build as xmllint.exe itself).
This is the code that opens the file:
#include "libxml/xmlreader.h"
.
.
.
m_pxmlTextReader=xmlReaderForFile(sXML.c_str(), NULL, XML_PARSE_COMPACT |
XML_PARSE_BIG_LINES | XML_PARSE_DTDVALID);
if(m_pxmlTextReader)
{
if(xmlTextReaderRead(m_pxmlTextReader)==1 &&
xmlTextReaderIsValid(m_pxmlTextReader)==1)
{
// processing
}
...
"// processing" is never reached due to the validation errors.
I attached a simple XML with the DTD that can be used to test it in case
you're willing to give it a go.
I captured the errors I see in output.txt, please find it attached.
As you can see from the output, the DTD is found but for some reason,
libxml can't match it vs. the XML file.
I don't think it's relevant but this is the libxml config that I use at the
moment:
Config command:
cscript configure.js iconv=no static=yes debug=yes compiler=msvc
prefix=..\..\..\libxml2
Build commands:
call "C:\Program Files (x86)\MSVS10\VC\vcvarsall.bat"
nmake /f Makefile.msvc
nmake /f Makefile.msvc install
Config output:
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
libxml2 version: 2.9.0
Created Makefile.
Created config.h.
XML processor configuration
---------------------------
Trio: no
Thread safety: native
FTP client: yes
HTTP client: yes
HTML processor: yes
C14N support: yes
Catalog support: yes
DocBook support: yes
XPath support: yes
XPointer support: yes
XInclude support: yes
iconv support: no
icu support: no
iso8859x support: no
zlib support: no
lzma support: no
Debugging module: yes
Memory debugging: no
Runtime debugging: no
Regexp support: yes
Module support: yes
Tree support: yes
Reader support: yes
Writer support: yes
Walker support: yes
Pattern support: yes
Push support: yes
Validation support: yes
SAX1 support: yes
Legacy support: yes
Output support: yes
XML Schema support: yes
Schematron support: yes
Python bindings: no
Win32 build configuration
-------------------------
Compiler: msvc
C-Runtime option: /MD
Embed Manifest: no
Debug symbols: yes
Static xmllint: yes
Install prefix: ..\..\..\libxml2
Put tools in: $(PREFIX)\bin
Put headers in: $(PREFIX)\include
Put static libs in: $(PREFIX)\lib
Put shared libs in: $(PREFIX)\bin
Include path: .
Lib path: .
I guess it must be something I have overlooked.
Thank you!
Best regards: Zoltán Ördögh
testme.xml:4: element XMLTestMe: validity error :
No declaration for attribute Type of element XMLTestMe
<XMLTestMe Type="1234" SubType="9876" Flags="en" Version="1">
^
testme.xml:4: element XMLTestMe: validity error :
No declaration for attribute SubType of element XMLTestMe
<XMLTestMe Type="1234" SubType="9876" Flags="en" Version="1">
^
testme.xml:4: element XMLTestMe: validity error :
No declaration for attribute Flags of element XMLTestMe
<XMLTestMe Type="1234" SubType="9876" Flags="en" Version="1">
^
testme.xml:4: element XMLTestMe: validity error :
No declaration for attribute Version of element XMLTestMe
<XMLTestMe Type="1234" SubType="9876" Flags="en" Version="1">
^
testme.xml:5: element LeafLvl1: validity error : N
o declaration for attribute Name of element LeafLvl1
<LeafLvl1 Name="test">
^
testme.xml:6: element LeafLvl2: validity error : N
o declaration for attribute ColorIndex of element LeafLvl2
<LeafLvl2 ColorIndex="41" Name="Neutral">
^
testme.xml:6: element LeafLvl2: validity error : N
o declaration for attribute Name of element LeafLvl2
<LeafLvl2 ColorIndex="41" Name="Neutral">
^
testme.xml:7: element LeafLvl3: validity error : N
o declaration for element LeafLvl3
<LeafLvl3/>
^
testme.xml:8: element LeafLvl2: validity error : N
o declaration for element LeafLvl2
</LeafLvl2>
^
testme.xml:9: element LeafLvl1: validity error : N
o declaration for element LeafLvl1
</LeafLvl1>
^
testme.xml:10: element XMLTestMe: validity error :
No declaration for element XMLTestMe
</XMLTestMe>
^
testme.dtd
Description: Binary data
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE XMLTestMe SYSTEM "file:///./testme.dtd"> <XMLTestMe Type="1234" SubType="9876" Flags="en" Version="1"> <LeafLvl1 Name="test"> <LeafLvl2 ColorIndex="41" Name="Neutral"> <LeafLvl3/> </LeafLvl2> </LeafLvl1> </XMLTestMe>
_______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] https://mail.gnome.org/mailman/listinfo/xml
