Menu

problem with Xpath as co-occurrence constrain

Help
nunoni
2009-09-29
2012-12-07
  • nunoni

    nunoni - 2009-09-29

    I am new here, so I don't know if this is the best way to report a bug/problem!

    I am trying to use Xpath to impose co-occurrence constraints. Basically, to either usre an attribute or a child element to define the same thing. In the typical library example, something like

    xs:unique name="isbn"

    xs:selector path="."/

    xs:field path="isbn|@isbn"/

    /xs:unique

    meaning that either the child element "isbn" or the attibute "isbn" may be present, but not both.

    I then proceed to create an instance document with an error (both present), and Copy Editor says it's valid.

    My real example is a big larger than this, but basically this is what is happening. I checked that both the selector and the field are correct.

    When I put my real example in Altova (I downloaded the trial version just to test this), everything works as it should.

     
  • gnschmidt

    gnschmidt - 2009-09-30

    Could you send me the XSD and a short sample doc to gnschmidt at users dot sourceforge dot net?

    I'm happy to take a look.

    (Perhaps I need to update the validator to a more recent version of Xerces-C.)

    Best,
    Gerald

     
  • gnschmidt

    gnschmidt - 2009-10-02

    I think it's possible that Xerces-C does not support XML Schema 1.1 (and thus ), but I'd be happy to be corrected if I'm wrong!

    Neither port (Windows or Linux) has switched to Xerces-C 3.x yet, so it's possible that this will resolve the problem. (Not sure why Ubuntu doesn't yet support the new version.)

    It does seem as if open source C++ implementations trail their Java counterparts by a wide margin.

      : http://www.ibm.com/developerworks/library/x-xml11pt2/

     
  • gnschmidt

    gnschmidt - 2009-10-02

    PS: Xerces-C has had a 'full constraint checking' option for ages, but it's already switched on:

        parser->setFeature ( XMLUni::fgXercesSchemaFullChecking, true );

     
  • nunoni

    nunoni - 2009-10-02

    thanks for the help!

    Actually, with exactly the same schema, different co-occurrence constraints located elsewhere do work correctly! I will send you a new instance file (and updated schema since I am actively working on it!)

     
  • nunoni

    nunoni - 2009-10-02

    sorry, my mistake; it's different sort of Xpath use, not co-occurrence constraints, that I was using and that XMLCE is correctly processing in my file

     

Log in to post a comment.