Re: [basex-talk] Schema Validation issues

2017-01-02 Thread Christian Grün
Hi George,

This looks like a bug in the Apache Xerces implementation that has
been included in Java. Unfortunately, there hasn’t been an update for
a long time now. Maybe things will work out if you integrate a more
recent version of Xerces in the classpath.

Hope this helps,
Christian

PS: If there’s some chance to make your issues with validate and
fn:doc reproducible, I’ll be happy to have a closer look at it.


On Fri, Dec 30, 2016 at 1:35 PM, George Sofianos  wrote:
> Because of issues with schema validation (can't properly use doc() in the
> validate function - see https://github.com/BaseXdb/basex/issues/1324), I'm
> not using BaseX to do schema validation in my workflow.
>
> But I needed it today to make some result comparisons with my own
> implementation of XML Validator, and I noticed that using the beta Xerces
> version which is documented in the wiki can make it crash, so I thought I
> should report it here.
>
> Other than that, I noticed one some XML files that it only reports fatal
> errors, and hides any other non-fatal error. I think it has something to do
> with the process method but I'm not sure.


[basex-talk] Schema Validation issues

2016-12-30 Thread George Sofianos
Because of issues with schema validation (can't properly use doc() in 
the validate function - see 
https://github.com/BaseXdb/basex/issues/1324), I'm not using BaseX to do 
schema validation in my workflow.


But I needed it today to make some result comparisons with my own 
implementation of XML Validator, and I noticed that using the beta 
Xerces version which is documented in the wiki 
 can 
make it crash, so I thought I should report it here.


Other than that, I noticed one some XML files that it only reports fatal 
errors, and hides any other non-fatal error. I think it has something to 
do with the process 
 
method but I'm not sure.


Error:
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 8.6 beta baadd29
Java: Oracle Corporation, 1.8.0_112
OS: Linux, amd64
Stack Trace: 
java.lang.ArrayIndexOutOfBoundsException: 27
at org.apache.xerces.impl.xs.XSConstraints.overlapUPA(Unknown Source)
at org.apache.xerces.impl.xs.XSConstraints.overlapUPA(Unknown Source)
at 
org.apache.xerces.impl.xs.models.XSDFACM.checkUniqueParticleAttribution(Unknown 
Source)
at org.apache.xerces.impl.xs.XSConstraints.fullSchemaChecking(Unknown 
Source)
at 
org.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(Unknown 
Source)
at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source)
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at 
org.apache.xerces.jaxp.validation.StreamValidatorHelper.validate(Unknown Source)
at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown 
Source)
at javax.xml.validation.Validator.validate(Validator.java:124)
at 
org.basex.query.func.validate.ValidateXsd$1.process(ValidateXsd.java:97)
at org.basex.query.func.validate.ValidateFn.process(ValidateFn.java:120)
at org.basex.query.func.validate.ValidateXsd.errors(ValidateXsd.java:55)
at org.basex.query.func.validate.ValidateFn.report(ValidateFn.java:88)
at 
org.basex.query.func.validate.ValidateXsdReport.value(ValidateXsdReport.java:15)
at org.basex.query.func.validate.ValidateFn.iter(ValidateFn.java:53)
at org.basex.query.scope.MainModule.iter(MainModule.java:118)
at org.basex.query.QueryContext.iter(QueryContext.java:331)
at org.basex.query.QueryContext.cache(QueryContext.java:622)
at org.basex.query.QueryProcessor.cache(QueryProcessor.java:116)
at org.basex.core.cmd.AQuery.query(AQuery.java:87)
at org.basex.core.cmd.XQuery.run(XQuery.java:22)
at org.basex.core.Command.run(Command.java:255)
at org.basex.core.Command.execute(Command.java:93)
at org.basex.gui.GUI.exec(GUI.java:479)
at org.basex.gui.GUI.access$3(GUI.java:433)
at org.basex.gui.GUI$7.run(GUI.java:421)
Query:
validate:xsd-report(root())
Query plan:

  

  



Re: [basex-talk] Schema validation

2016-07-19 Thread George Sofianos
Indeed, looking at the code seems it's already using it. I wonder what 
creates that delay though. I will have to investigate it a bit, probably 
by debugging BaseX, unless someone already knows. Could a SaxSource vs 
StreamSource be the issue? Or that doesn't affect performance? If my 
question is stupid, just ignore ;)


Thanks, George


On 7/19/2016 4:40 PM, Andy Bunce wrote:

Looks like it wants to use it [1]. You could try running below in the GUI:

Q{java:org.basex.util.Reflect}find("org.apache.xerces.jaxp.validation.XMLSchemaFactory")

/Andy

[1] 
https://github.com/BaseXdb/basex/blob/b8c1ae7738664aa3912ade783b8a01a0a2285d25/basex-core/src/main/java/org/basex/query/func/validate/ValidateXsd.java#L65






Re: [basex-talk] Schema validation

2016-07-19 Thread Andy Bunce
Looks like it wants to use it [1]. You could try running below in the GUI:

Q{java:org.basex.util.Reflect}find("org.apache.xerces.jaxp.validation.XMLSchemaFactory")

/Andy

[1]
https://github.com/BaseXdb/basex/blob/b8c1ae7738664aa3912ade783b8a01a0a2285d25/basex-core/src/main/java/org/basex/query/func/validate/ValidateXsd.java#L65

On 19 July 2016 at 13:10, George Sofianos  wrote:

> Thanks, it looks like it's in the classpath. But is it actually used? I
> can't be sure. I have seen some strange things happening with Xerces
> versions in the past with Saxon.
>
> Anyway, it would be great if BaseX can have a feature to change the
> validation options. Should I open a BaseX ticket about it? or is there
> already a way to set these.
>
> https://xerces.apache.org/xerces2-j/features.html
>
>
>
> On 7/19/2016 3:05 PM, Andy Bunce wrote:
>
>> Hi George,
>>
>> Just on point #1
>> I think BaseX does not install Xerces. Entering the line below in the GUI
>> will tell you the version from the JDK
>>
>> Q{java:com.sun.org.apache.xerces.internal.impl.Version}getVersion()
>>
>> For me this returns:
>> Xerces-J 2.7.1
>>
>> If you have manually added Xerces to the classpath, then you can get the
>> version by:
>> Q{java:org.apache.xerces.impl.Version}getVersion()
>>
>> /Andy
>>
>>
>


Re: [basex-talk] Schema validation

2016-07-19 Thread George Sofianos
Thanks, it looks like it's in the classpath. But is it actually used? I 
can't be sure. I have seen some strange things happening with Xerces 
versions in the past with Saxon.


Anyway, it would be great if BaseX can have a feature to change the 
validation options. Should I open a BaseX ticket about it? or is there 
already a way to set these.


https://xerces.apache.org/xerces2-j/features.html


On 7/19/2016 3:05 PM, Andy Bunce wrote:

Hi George,

Just on point #1
I think BaseX does not install Xerces. Entering the line below in the 
GUI will tell you the version from the JDK


Q{java:com.sun.org.apache.xerces.internal.impl.Version}getVersion()

For me this returns:
Xerces-J 2.7.1

If you have manually added Xerces to the classpath, then you can get 
the version by:

Q{java:org.apache.xerces.impl.Version}getVersion()

/Andy





Re: [basex-talk] Schema validation

2016-07-19 Thread Andy Bunce
Hi George,

Just on point #1
I think BaseX does not install Xerces. Entering the line below in the GUI
will tell you the version from the JDK

Q{java:com.sun.org.apache.xerces.internal.impl.Version}getVersion()

For me this returns:
Xerces-J 2.7.1

If you have manually added Xerces to the classpath, then you can get the
version by:
Q{java:org.apache.xerces.impl.Version}getVersion()

/Andy

On 19 July 2016 at 12:46, George Sofianos  wrote:

> Hi, I wonder what is the status of schema validation in BaseX? I have a
> Java web service that is used to validate some schemas, which is using
> xerces2 to validate XML files. I want to transfer some of this work to my
> XQuery scripts in BaseX, so I can minimize the bandwidth on large files
> (the XML files are being retrieved from a remote repository). I did try to
> put xercesImpl.java on the lib directory, the validation does run, but I'm
> not sure about these two things
>
> 1) Is the new version of xerces being used, or is the Java default one
> being used? Maybe it's possible to add a function to return the library
> being used?
>
> 2) My Java service (which is using xerces2) is running the validation in
> about 5 seconds, the same validation takes 32 seconds in BaseX 8.5.1
>
>
> Any ideas, tips etc are welcome
>
> Thanks, George.
>
>


[basex-talk] Schema validation

2016-07-19 Thread George Sofianos
Hi, I wonder what is the status of schema validation in BaseX? I have a 
Java web service that is used to validate some schemas, which is using 
xerces2 to validate XML files. I want to transfer some of this work to 
my XQuery scripts in BaseX, so I can minimize the bandwidth on large 
files (the XML files are being retrieved from a remote repository). I 
did try to put xercesImpl.java on the lib directory, the validation does 
run, but I'm not sure about these two things


1) Is the new version of xerces being used, or is the Java default one 
being used? Maybe it's possible to add a function to return the library 
being used?


2) My Java service (which is using xerces2) is running the validation in 
about 5 seconds, the same validation takes 32 seconds in BaseX 8.5.1



Any ideas, tips etc are welcome

Thanks, George.



Re: [basex-talk] schema validation

2015-02-20 Thread Christian Grün
Hi Paul,

In BaseX, validation is done on XQuery level. If you want to validate
a document before updating it in the database, you can e.g. do
something like..

  let $db := 'database'
  let $path := 'collection/doc.xml'
  let $schema := 'path/to/schema.xsd'
  let $doc := db:open($db, $path) update (
delete node //text()
  )
  return (
validate:xsd($doc, $schema),
db:replace($db, $path, $doc)
  )

Hope this helps,
Christian



On Fri, Feb 20, 2015 at 3:33 AM,  pmens...@comcast.net wrote:
 Hi all.

 Is it possible to enforce schema validation on update in BaseX?

 Regards,
 Paul Mensonides


[basex-talk] schema validation

2015-02-19 Thread pmenso57
Hi all.

Is it possible to enforce schema validation on update in BaseX?

Regards,
Paul Mensonides


Re: [basex-talk] Schema Validation Error

2013-11-19 Thread Paul Fancher
You are right; the prolog was removed during the import process. Any ideas
what to do now? If nothing else, I could always convert the node() into a
string and concatenate the prolog to the beginning, but I don't know if
that would work for large XML files or not...

Paul


On Tue, Nov 19, 2013 at 4:54 PM, Zachary DeLuca zadel...@gmail.com wrote:

 I don't know anything about the actual validation features in BaseX, but
 as far as your XSD and XML documents are concerned, you appear to missing
 the prolog statement.

 See here: http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd

 Zach



 On Tue, Nov 19, 2013 at 5:46 PM, Paul Fancher fancherp...@gmail.comwrote:

 I am trying to get a working schema validation, and I'm hitting a hangup:

 Context:
 db:open(Test,NewXMLSchema.xsd)
 schema xmlns=http://www.w3.org/2001/XMLSchema; xmlns:tns=
 http://www.example.org/NewXMLSchema; targetNamespace=
 http://www.example.org/NewXMLSchema; elementFormDefault=qualified
   element name=test type=tns:test/
   complexType name=test
 sequence
   element name=item type=string maxOccurs=unbounded
 minOccurs=1/
 /sequence
   /complexType
 /schema

 db:open(Test,NewFile1.xml)
 tns:test xmlns:tns=http://www.example.org/NewXMLSchema; xmlns:xsi=
 http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=
 http://www.example.org/NewXMLSchema NewXMLSchema.xsd 
   tns:itemPoke/tns:item
   tns:itemPoke/tns:item
   tns:itemPoke/tns:item
 /tns:test

 Test Code:
 declare namespace tns = http://www.example.org/NewXMLSchema;;
 validate:xsd-info(/tns:test, db:open(Test,NewXMLSchema.xsd))

 The error message I get back is
 Fatal: Content is not allowed in prolog.

 Any ideas what's going on?


 Paul

 shoutout to the the people behind eclipse and the Eclipse XML Editors and
 Tools for some really awesome development software!

 ___
 BaseX-Talk mailing list
 BaseX-Talk@mailman.uni-konstanz.de
 https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk



___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Schema Validation Error

2013-11-19 Thread Zachary DeLuca
Maybe I'm confused about what you are trying to do. Shouldn't your test
code line be:

validate:xsd-info(db:open(Test, NewFile1.xml),
db:open(Test,NewXMLSchema.xsd))


On Tue, Nov 19, 2013 at 6:16 PM, Paul Fancher fancherp...@gmail.com wrote:

 You are right; the prolog was removed during the import process. Any ideas
 what to do now? If nothing else, I could always convert the node() into a
 string and concatenate the prolog to the beginning, but I don't know if
 that would work for large XML files or not...

 Paul



 On Tue, Nov 19, 2013 at 4:54 PM, Zachary DeLuca zadel...@gmail.comwrote:

 I don't know anything about the actual validation features in BaseX, but
 as far as your XSD and XML documents are concerned, you appear to missing
 the prolog statement.

 See here: http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd

 Zach



 On Tue, Nov 19, 2013 at 5:46 PM, Paul Fancher fancherp...@gmail.comwrote:

 I am trying to get a working schema validation, and I'm hitting a hangup:

 Context:
 db:open(Test,NewXMLSchema.xsd)
 schema xmlns=http://www.w3.org/2001/XMLSchema; xmlns:tns=
 http://www.example.org/NewXMLSchema; targetNamespace=
 http://www.example.org/NewXMLSchema; elementFormDefault=qualified
   element name=test type=tns:test/
   complexType name=test
 sequence
   element name=item type=string maxOccurs=unbounded
 minOccurs=1/
 /sequence
   /complexType
 /schema

 db:open(Test,NewFile1.xml)
 tns:test xmlns:tns=http://www.example.org/NewXMLSchema; xmlns:xsi=
 http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=
 http://www.example.org/NewXMLSchema NewXMLSchema.xsd 
   tns:itemPoke/tns:item
   tns:itemPoke/tns:item
   tns:itemPoke/tns:item
 /tns:test

 Test Code:
 declare namespace tns = http://www.example.org/NewXMLSchema;;
 validate:xsd-info(/tns:test, db:open(Test,NewXMLSchema.xsd))

 The error message I get back is
 Fatal: Content is not allowed in prolog.

 Any ideas what's going on?


 Paul

 shoutout to the the people behind eclipse and the Eclipse XML Editors
 and Tools for some really awesome development software!

 ___
 BaseX-Talk mailing list
 BaseX-Talk@mailman.uni-konstanz.de
 https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk




 ___
 BaseX-Talk mailing list
 BaseX-Talk@mailman.uni-konstanz.de
 https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk