Re: [xml] Error on including and importing schemas already parsed



Thank you Jason!  I can also confirm validate_me.xml validates with this
patch applied, although patching 2.7.3 doesn't work, I had to grab the
svn version (currently r3819).  Thanks for the help.

-Luke

-----------
Luke Robison
robison arlut utexas edu
Applied Research Laboratories: University of Texas
Engineering Scientist Associate

On Wed, 2009-03-04 at 18:19 -0500, Oblivian wrote:
Here's a patch, seems to work ok but needs review.  validate_me.xml
now validates...

On Wed, Mar 4, 2009 at 5:54 PM, Oblivian
<oblivian users sourceforge net> wrote:
        Nope, looks like your problem is different.  This appears to
        be an incomplete or just an unsure implementation.  The code
        that is causing it is in xmlschemas.c, just a different
        location:
        
                   /*
                    * Chameleons: the original target namespace will
                    * differ from the resulting namespace.
                    */
                    isChameleon = 1;
                    if (bucket->parsed &&
                        (bucket->targetNamespace !=
        pctxt->targetNamespace)) {
                        /*
                        * This is a sanity check, I dunno yet if this
        can happen.
                        */
                        PERROR_INT("xmlSchemaParseIncludeOrRedefine",
                            "trying to use an already parsed schema
        for a "
                            "different targetNamespace");
                        return(-1);
                    }
        
        Obviously the comment says it all.  Your case shows this can
        happen and from the XML Schema Part 1: Structures document
        
        "The ÂXML Schema corresponding to <schema> contains not only
        the components corresponding to its definition and declaration
        [children], but also all the components of all the ÂXML
        Schemas corresponding to any <include>d schema documents.
        Such included schema documents must either (a) have the same
        targetNamespace as the <include>ing schema document, or (b) no
        targetNamespace at all, in which case the <include>d schema
        document is converted to the <include>ing schema document's
        targetNamespace."
        
        Your case is the last where no namespace is in the included
        schema.  So it should allow a generic schema with no
        targetNamespace to be pulled into the current document's
        targetNamespace.
        
        The problem will be to implement pulling the same file into
        multiple namespaces which is what it really seems to be
        complaining about.  I'm not familiar enough with the code yet
        to know if it is as simple as pulling this check out to fix,
        and if that may create any wierd redefinition problems as the
        xml file is parsed against common.xsd in different namespaces
        at the same time.
        
        Hopefully this helps :)
        
        Jason
        
        
        
        On Wed, Mar 4, 2009 at 9:39 AM, Luke Robison
        <robison arlut utexas edu> wrote:
                
                
                On Tue, 2009-03-03 at 20:53 -0500, Oblivian wrote:
                > And I was so busy getting the test cases and patch
                done, I didn't
                > check today's list threads:
                >
                >
                http://mail.gnome.org/archives/xml/2009-March/msg00007.html
                >
                > Seems related too...
                
                
                Indeed it does seem related.  I tried applying your
                patch to my 2.7.3
                code, and while it fixed your test case, it fails to
                fix mine.  Glad I
                could provide another corner case :-).
                
                -Luke
                
                -----------
                Luke Robison
                robison arlut utexas edu
                Applied Research Laboratories: University of Texas
                Engineering Scientist Associate
                
        
        






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]