[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    RE: [SPAM] relative paths possible bug?
From:       "david garry" <david.garry () nomos-software ! com>
Date:       2012-07-31 14:21:01
Message-ID: 001601cd6f27$b67fd110$237f7330$ () nomos-software ! com
[Download RAW message or body]

Thanks Peter,

That's was indeed the problem.
 
Thanks for your time

David

-----Original Message-----
From: Peter Keller [mailto:pkeller@globalphasing.com] 
Sent: 31 July 2012 14:14
To: dev@xmlbeans.apache.org
Subject: Re: [SPAM] relative paths possible bug?

Hi David,

I think that the problem is that you are using "\" characters in schemaLocation. \
According to the XSD spec here:

<http://www.w3.org/TR/xmlschema-1/#element-import>

the value of schemaLocation in an import statement must be an anyURI.
anyURI must conform to a URI as defined in RFC3986:

<http://tools.ietf.org/html/rfc3986>

(this RFC obsoletes the older ones referred to in the XSD spec).

Careful reading of section 3.3 of this RFC shows that the path component of a URI (in \
this case the whole string) must consist of zero or more path segments separated by \
'/' characters. A path segment can contain characters of the following types:

  unreserved (i.e. ALPHA / DIGIT / "-" / "." / "_" / "~" )
  %-encoded characters
  sub-delims (i.e. "!" / "$" / "&" / "'" / "(" / ")"
                 / "*" / "+" / "," / ";" / "=" )
  ":"
  "@"

i.e. '\' characters are not allowed in URI's at all.

I am not familiar with using XMLBeans on Windows systems, but I would suggest using \
'/' instead of '\', and relying on XMLBeans to interpret the string as a filesystem \
path.

I suppose that using '%1c' instead of '\' and relying on Windows to interpret the \
string as a filesystem path might work, but I wouldn't recommend that.

Remember that even when a URI refers to a path on a local filesystem, it is still \
using an abstraction of a path in which '/' is the path element separator, not a \
physical path as implemented on particular operating systems. It is the \
responsibility of whatever software interprets that URI to convert it to path strings \
as required by the underlying operating system.

Regards,
Peter.

On Tue, 2012-07-31 at 12:50 +0100, david garry wrote:
> Hi there,
> 
> 
> 
> I wondering if I could ask the XMLBeans community about an issue I've 
> encountered when parsing a schema (exchange-schema.xsd attached).
> 
> 
> 
> When attempting to import the Schema I get the following error:
> 
> 
> 
> "error: Could not find resource – invalid location URL"
> 
> The problem is to do with the import of other namespaces. It looks 
> like the schemaLocation value on the import statement is not correct.
> The schemaLocation value is a relative path value, e.g.
> 
> 
> 
> <xsd:import
> namespace="http://doj.ca.gov/niem/SearchWrnt/Extension/1.0"
> schemaLocation="..\SearchWrnt\extension-schema.xsd"/>
> 
> I understand that the problem is because the relative path used above 
> should probably contain the prefix ‘file://'.
> 
> I have followed the email thread between Jacob and another user which 
> seems to be closely related.
> 
> http://mail-archives.apache.org/mod_mbox/xmlbeans-user/200905.mbox/%
> 3Cbb04eb0a0905121445k4c3c8ac1ve5ace62be01d9318@mail.gmail.com%3E
> 
> I have followed the suggestions above without any success for a couple 
> of days.
> 
> In order to progress my issue, I checked-out the trunk
> (http://svn.apache.org/repos/asf/xmlbeans/trunk) and made the 
> following code change on line 264 to 
> org.apache.xmlbeans.impl.schema.StscImporter
> 
> Old:
> 
> 
> 
> URI childUri = new URI(child);
> 
> 
> 
> New:
> 
> 
> 
> URI childUri = null;
> 
> try
> 
> {
> 
> childUri = new URL(base.toURL(),child).toURI();
> 
> }
> 
> catch(MalformedURLException e)
> 
> {
> 
> childUri = new URI(child);
> 
> }
> 
> This has resolved my issue.
> 
> Would the XMlbeans community be able to tell me:
> 
> 1)      – Is the issue I encountered an actual problem that needs
> fixing?
> 
> 2)      – If so, can you inform of the code modification procedures so
> I may go ahead and make the fix assumming my change is deemed 
> appropriate?
> 
> 3)      – If this is not a problem, can someone suggest ways I can
> resolve my issue. (I'm not permitted to modify the XML Schemas)
> 
> Kind Regards
> 
> David
> 
> 
> 
> __________________________
> David Garry
> Description: Description: Description: NOMOS-logo-email CTO, Nomos 
> Software Direct Line: +353-21-4928945
> Mobile: +353-86-1980236
> Skype: david.garry3
> Description: Description: Description:
> cid:image002.gif@01CD6A46.64269EC0 Description: Description:
> Description: cid:image003.gif@01CD6A46.64269EC0
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: dev-help@xmlbeans.apache.org

-- 
Peter Keller                                     Tel.: +44 (0)1223 353033
Global Phasing Ltd.,                             Fax.: +44 (0)1223 366889
Sheraton House,
Castle Park,
Cambridge CB3 0AX
United Kingdom



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic