Re: [xml] Download Link to LIBXML2 built on VC 9 on windows 7 (32 bit)

2011-01-19 Thread Darko Miletic
As stated on this page:

http://www.zlatkovic.com/libxml.en.html

All binaries have been built using C/C++ compiler version 13, linker version 7 
and nmake version 6, all of them by Microsoft Corporation. To avoid any 
confusion, these are not the tools you get when you install Microsoft Visual 
Studio. These are a part of the Windows XP DDK. If you have other development 
tools, such as Borland's, check if you can use these binaries as they are 
before building your own. You should be able to.
___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


[xml] Changes in relaxng error reporting

2010-10-06 Thread Darko Miletic
Title: signature




Hello, 

Working on a project I just discovered an interesting "feature" in
libxml2. 

In version of the library prior to 2.7.4 if we had a  relaxng  schema
that defines type with additional validation in regular _expression_
format in case when type validation fails library would report two
errors:
XML_RELAXNG_ERR_TYPEVAL
XML_RELAXNG_ERR_CONTENTVALID

which is great

But in version starting from 2.7.4 and onwards library reports only 
XML_RELAXNG_ERR_CONTENTVALID

Is there a way to get back the old behaviour?

Here is a sample xml and relaxng schema to demonstrate this:
//sample.xml start

?xml version="1.0" encoding="utf-8" standalone="yes"?
root xmlns="http://www.idpf.org/2007/opf"
    items
    item href="" /
    item href="" /  
    /items
/root
//sample.xml end

//sample.rng start
?xml version="1.0"?
grammar xmlns="http://relaxng.org/ns/structure/1.0" 
 ns="http://www.idpf.org/2007/opf"

datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"

start
  ref name="root-element"/
/start

define name="root-element"
    element name="root"
    ref name="items-element"/
    /element
/define
 
define name="items-content"
  oneOrMore
    ref name="item-element"/
  /oneOrMore
/define

define name="item-element"
    element name="item"
    attribute name="href"
  data type="anyURI"
    param name="pattern"[^\s]+.[^\s]+/param
  /data
    /attribute    
    ref name="item-content"/
    /element
/define

define name="item-content"
  empty/
/define

define name="items-element"
    element name="items"
    ref name="items-content"/
    /element
/define
/grammar
//sample.rng end

command line to use:
xmllint --noout --relaxng sample.rng sample.xml

On libxml2 2.7.7 I get this 
sample.xml:5: element item: Relax-NG validity error : Element item
failed to validate attributes
sample.xml fails to validate

On libxml2 2.7.3 I get this:
sample.xml:5: element item: Relax-NG validity error : Type anyURI
doesn't allow value 'something with spaces'
sample.xml:5: element item: Relax-NG validity error : Element item
failed to validate attributes
sample.xml fails to validate

Which is a desired behaviour to me.


Thanks,
-- 




  

  
  
  Darko Miletić
  Chief Software Architect
  


   UVCMS
S.R.L.
Buenos Aires: +54 (11) 4831-0385/0389 - New York: +1 (646) 775-2914 -
da...@uvcms.com - www.uvcms.com
  

  





___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


Re: [xml] HTMLparser

2010-04-28 Thread Darko Miletic
Probably not. You should clean up that html with tidy before passing it 
through xml parser.


Sergio Monteiro Basto wrote:

who is the maintainer of HTMLparser , I had report a bug , and no one
had reply .
What I could do about that ?  
Should HTMLparser parse bad broken html or not ? 


Thanks,
  



___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml



__ Information from ESET Smart Security, version of virus signature 
database 5069 (20100428) __

The message was checked by ESET Smart Security.

http://www.eset.com

  
___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


Re: [xml] XPath issue

2010-03-18 Thread Darko Miletic
Your library version is old. Before doing anything else try using more 
recent version. You can do that on your dev. machine for test purporses.


Joshua Kwan wrote:

Hi there!

I've got an interesting problem about libxml2's XPath support posted on 
stackoverflow:
http://stackoverflow.com/questions/2459428/weird-xpath-behavior-in-libxml2
Please read about it there.

There haven't been any answers, so I thought I would consult the real libxml2 
mailing list before trying something else. I'm not subscribed to the list, so 
please CC me on replies.

Thanks in advance for any help you could provide!
BTW, I'm using libxml2 2.6.27 and a brief scan of the changelog didn't reveal 
anything that might describe my issue as a bug that's been fixed since.

-Josh
___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


__ Information from ESET Smart Security, version of virus signature 
database 4954 (20100318) __

The message was checked by ESET Smart Security.

http://www.eset.com


  

___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


Re: [xml] Regarding LibXML Schema validation

2009-11-11 Thread Darko Miletic


Sudhindra Kulkarni wrote:


Hi,

I have a problem validating a xml generated from a schema which 
contains an element having xs:any namespace=##other /. When I try 
to include a element from another schema I get an error


No matching global element declaration available but demanded by the 
strict wildcard


This is a limitation of libxml. You must have all declarations from all 
schemas in one file. So if your xml file uses 6 schemas in order to 
validate them in libxml you must create new schema that includes all 6 
separate schemas and than use that xsd for validation. Something like this:


?xml version = 1.0 encoding = UTF-8?
xs:schema xmlns=http://dummy.libxml2.validator;
   targetNamespace =http://dummy.libxml2.validator;
   xmlns:xs=http://www.w3.org/2001/XMLSchema;
   xmlns:xsi   =http://www.w3.org/2001/XMLSchema-instance;
   xmlns:somenamespace =namespaceurl
   xmlns:somenamespace2 =namespaceurl2
   xmlns:somenamespace3 =namespaceurl3

   version=1.0
   elementFormDefault  =qualified
   attributeFormDefault=unqualified   
   
  
   xs:import namespace =namespaceurl schemaLocation = schema 
location /
   xs:import namespace =namespaceurl2 schemaLocation = schema 
location2 /
   xs:import namespace =namespaceurl3 schemaLocation = schema 
location3 /


/xs:schema


___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


Re: [xml] Avoiding emediate close of elements

2009-10-07 Thread Darko Miletic


Martin Olsen wrote:

On Wednesday 07 October 2009 13:07:41 you wrote:
  

Use xmlTextWriterStartElement or xmlTextWriterStartElementNS with
xmlTextWriterFullEndElement


Thanks! Unfortunately, I still get the same result.

Here's the smallest code to reproduce:
writer = xmlNewTextWriterDoc( doc, 0 );
xmlTextWriterStartDocument( writer, NULL, UTF-8, NULL );
xmlTextWriterStartElement( writer, BAD_CAST element );
xmlTextWriterFullEndElement( writer );
xmlTextWriterEndDocument( writer );
xmlSaveFile( -, doc );

Any other suggestions?
  


Just add empty space in the tag. That will force the tag/tag


___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


Re: [xml] LoadLibrary needs to be LoadLibraryA

2008-02-21 Thread Darko Miletic
Roumen Petrov wrote:
 If file system is fatNN can we use LoadLibraryW ?

Yes. Difference between so called unicode and ansi functions is 
primarily in input/output string parameters.
 If file is on network file system how to detect at run time that 
 LoadLibraryW will succeed ?
   
You detect any problem by checking result value of API call and by 
calling GetLastError() API.

Like in these two functions

#include windows.h
#include string
#include iostream

std::string GetSysMsg(DWORD err) {
std::string result;
LPVOID lpMsgBuf = NULL;
if (FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
reinterpret_castLPSTR(lpMsgBuf),
0U,
NULL ))
{
result = reinterpret_castLPSTR(lpMsgBuf);
LocalFree( lpMsgBuf );
lpMsgBuf = NULL;
}
return result;
}

bool CheckLoadLibrary(const std::wstring filename) {
 HMODULE mod = LoadLibraryW(filename.c_str());
 bool result = (NULL != mod);
 if (!result) {
   DWORD err = GetLastError();
   std::cerr  GetSysMsg(err)  std::endl;
 } else {
   FreeLibrary(mod);
   mod = NULL;
 }
 return result;
}

 And what about OS like 95x ? Did Microsoft Windows 95x support 
 unicode/wchar_t ?
   
win 9x has very small subset of unicode API implemented and rest are 
just A versions that accept common char*. To support unicode API on 
these system it is possible to use MSLU 
(http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx).
There is a reason why it would be convenient to pass windows version of 
libxml2 to unicode API. All Windows versions from Windows NT are 
internaly UNICODE, so their native API are with W extension. When you 
call Ansi API on UNICODE OS it internaly converts common string to 
unicode and than call's unicode version of API. Since win9x line is 
basically dead and 64-bit is already with us there is no much reason to 
keep non-unicode version floating.
 modules located in pathes containing unicode characters - I cannot 
 understand this.
   
This basically means LoadLibraryW can load dll's that are located in 
path that may contain chinese, russian or whatever non-latin characters 
and this is because it's input parameter is unicode string.

 If LoadLibraryA is called with file name in short format (microsoft 
 terminology) should expect to succeed ?

   
If the path is correct it will. That goes for the LoadLibraryW too.
 Many questions but well designed OS should care for this transparently 
 to the user.
   
There is a very good reason why are things as they are on windows. You 
can find digest version on this url:
http://www.jorendorff.com/articles/unicode/windows.html

-- 
Darko Miletic


___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


Re: [xml] A rare bug?

2008-01-04 Thread Darko Miletic
David Zhuo wrote:
 the test is performed with the same XML and schema and the only 
 different is the version of xmllint used. Build version 20620 
 successfully validate the XML while version 20623 does not.

 the sample XML is attached. can someone tell me if this is a bug or not?


I tried it with same version on windows and it fails. Here is the output:

C:\projs\xml_testxmllint --noout --version --schema 
http://www.youtube.com/xsd/metadata_0.2.xsd test.xml
xmllint: using libxml version 20623CVS2717
   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 
FTP HTTP DTDValid HTML Legacy C14N Cat
alog XPath XPointer XInclude Iconv Unicode Regexps Automata Expr Schemas 
Schematron Modules Debug
test.xml:18: element keywords: Schemas validity error : Element 
'{http://search.yahoo.com/mrss}keywords': [fac
et 'pattern'] The value 'London,Sci fi,Aliens' is not accepted by the 
pattern '(.*,){2,}.*'.
test.xml:18: element keywords: Schemas validity error : Element 
'{http://search.yahoo.com/mrss}keywords': 'L,S
ci fi,Aliens' is not a valid value of the local atomic type.
test.xml fails to validate

I also validated with msxml 6 and it checks out fine so I would assume 
it is bug related to the way processing of xs:pattern element in schema.

-- 
Darko Miletic


___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


[xml] How to validate xml against several xsd files using libxml2?

2008-01-03 Thread Darko Miletic
Hi to all,

Recently I started working with e-learning content that includes 
producing, parsing managing  SCORM compliant manifest xml files. All 
such files have declared parts of structure in several scheme files so 
validation must be made using all that files at the same time. I tried 
to validate using xmllint but it does not support specifying more than 
one schema file.

I also saw that in libxml2 API the function for specifying schema 
validation context supports only one file at the time and thus It is not 
possible AFAIK to do that even writing custom code.

Any ideas? Am I missing something?

You can generate simple SCORM manifest using reload editor from here:

http://www.reload.ac.uk/download/ReloadEditor202_ManualInstall.zip

Thanks,

-- 
Darko Miletic
Chief Software Architect
UVCMS e-learning
Costa Rica 4752 street
Buenos Aires C1414BSL
Argentina
+1 646 8439869
+54 11 48316086

___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


Re: [xml] How to validate xml against several xsd files using libxml2?

2008-01-03 Thread Darko Miletic
Sebastian Rahtz wrote:
 if you mean distinct areas in their own namespaces with
 different schemas, I recommend you look at NVDL (http://nvdl.org/).
 It's designed for just this sort of thing. I'm
 not saying its easy to get working, mind...

This looks quite complicated... I'll see if I can understand this
 if you mean that the schema is delivered in several files,
 then there should be a wrapper schema which includes them.

I see. Thank you for this suggestion I'll check it out.

-- 
Darko Miletic
Chief Software Architect
UVCMS e-learning
Costa Rica 4752 street
Buenos Aires C1414BSL
Argentina
+1 646 8439869
+54 11 48316086

___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml


Re: [xml] How to validate xml against several xsd files using libxml2?

2008-01-03 Thread Darko Miletic
Darko Miletic wrote:
 if you mean that the schema is delivered in several files,
 then there should be a wrapper schema which includes them.

 
 I see. Thank you for this suggestion I'll check it out.

   
It works with generating third wrapping xsd files. Too bad it is not 
documented anywhere. Thanks again for valuable help.

-- 
Darko Miletic
Chief Software Architect
UVCMS e-learning
Costa Rica 4752 street
Buenos Aires C1414BSL
Argentina
+1 646 8439869
+54 11 48316086

___
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml