Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-15055

SchemaLoader fails to load included schema files with relative URL paths if they are not relative to the flex application

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Later
    • Adobe Flex SDK 3.2 (Release)
    • None
    • RPC: General
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Language Found: English

    Description

      If an schema file contains an included schemaLocation with a URL that is relative to the parent xsd file (but not the Flex Application) then SchemaLoader fails to load the included schema. This is not an issue with included schemaLocations using absolute URLs.

      Steps to reproduce:

      1. In the bin folder create a schema file (xsd/example.xsd) containing an included schema (xsd/schema.xsd) that is referenced using a relative path ( schemaLocation="schema.xsd")

      e.g. xsd/example.xsd

      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.foo.bar" >
      <xs:include schemaLocation="schema.xsd"></xs:include>
      </xs:schema>

      e.g. xsd/schema.xsd

      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.foo.bar" >
      </xs:schema>

      2. In the flex application create an instance of SchemaLoader and load the example schema file (xsd) using a relative path. Add listeners to the fault and schemaLoad events.

      var schemaLoader:SchemaLoader = new SchemaLoader();
      schemaLoader.load("xsd/example.xsd");

      Actual Results:

      The schemaLoader fault event occurs due to the url of the included schema resolving to "schema.xsd" instead of "xsd/schema.xsd"

      Expected Results:

      SchemaLocator should resolve the path of the included schemaLocation relative to the parent schema location

      Workaround (if any):

      This is caused by
      SchemaLocator. schemaIncludes() calling getQualifiedLocation() which in turn uses URLUtil.getFullURL() to qualify the target path for the included schema.

      Because the parent location ("xsd/example.xsd") is a relative path, URLUtil.getFullURL() ignores the parent URL completely.

      Either URLUtil.getFullURL() should resolve the target url relative to the rootURL even if the rootURL is not fully qualified, or XMLoader.getQualifiedLocation() should call a seperate method to resolve a non-fully qualified parent URL

      Attachments

        Activity

          People

            adobejira Adobe JIRA
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: