Subject: RE: [ubl] Validating UBL 2.0 genericode files with Altova XMLSpy
Hi Roberto, Thanks for the useful info. I come to the conclusion that the uncertainty of how each tool processes an XML catalog in detail (or my incomplete understanding of it anyway) does place some question marks around the interoperable use of XML Catalogs, unless the tool set to use is mandated amongst the data exchange parties, making the resolution results predictable. For example, I would have thought a local XML Catalog should really override the schemaLocation (specified by the sender of the message, referring to a remote absolute or relative storage location.) Thank you once again. Juerg -----Original Message----- From: firstname.lastname@example.org [mailto:email@example.com] Sent: Thursday, 28 September 2006 10:40 p.m. To: Juerg Tschumperlin Subject: Re: [ubl] Validating UBL 2.0 genericode files with Altova XMLSpy I am sorry I use a personal xml/ubl editor based on JAXP thus XERCES/XALAN by default. I think the right steps to successfully open an xml file are: 1) Check if there is a schemaLocation 2) Test if the schemaLocation URI is reachable and exists (e.g. is local or internet is available) 3) if the schemaLocation URI doesn't exists lookup the xml catalog. But someone could start 1st with the catalog and then if URI is not available switch to the schemaLocation check. Personally I prefere the 1st case, expecially when the xml catalog is handled by a third party API (e.g. common-catalog by Apache) This way 1st I try to handle the xml file by myself and than if I am not successfull I try to resolve it on a catalog. I really think the XMLSpy has a "bug" or just a limit. I personally prefere other tools. Have you got the latest versione of XMLSpy ? Roberto Cisternino > Hi Roberto, > > Thank you for your reply. Yes, that makes it clear, and I can follow your > instructions. (btw English is not my first language either) > > Obviously, what you say applies to the XML editor your are using (which > one is it?), as well as oXygen (according to Ken). > However, it does not work for XMLSpy, which requires the schemaLocation > attribute before it is searching the XML Catalog for a matching entry. > > So it seems that with XMLSpy, in order to validate a UBL gc file, one has > to add manually the schemaLocation attribute (with the correct urn and a > (possibly bogus) storage location). > > That also means that XMLSpy does not need the <system> tag to resolve > locally when a schemaLocation attribute is present. Seems like other tools > function differently here also? > > In short, it seems that the gc files are not compatible with XMLSpy and > its XML Catalog implementation, unless I am missing something. > > Am I right to conclude that the XML Catalog specification should be more > specific, and define which of the two uri MUST be used: the namespace uri, > or the schemaLocation URI. With that ambiguity, different tool vendors > will implement it differently, causing this very issue. > > What do you think? Does anyone validate gc files with Stylus Studio, or > any other XML editors? Is XMLSpy the only one that fails? > > Juerg > >> Roberto wrote: >> ------------------------------------------------------------------------- >> Hello Juerg, >> I answer you question: >> >> "That seems like a good idea to me in any case. But would this allow to >> validate a gc file using XMLSpy when the schemaLocation attribute is >> absent?" >> >> Using an XML Catalog in general you can resolve locally any URI even >> when >> the schemaLocation is missing. >> >> You have to fill the catalog with an URI tag as the below sample for >> genericode: >> >> <uri name="http://genericode.org/2006/ns/CodeList/0.4/"; >> uri="./xsd/CodeList.xsd"/> >> >> This way the genericode codelist you are using will be validated >> successfully. >> >> e.g. >> >> <gc:CodeList xmlns:gc="http://genericode.org/2006/ns/CodeList/0.4/";> >> ... >> >> the genericode namespace will be resolved with the catalog correctly. >> -------------- >> >> If you have a schemaLocation and you need to resolve locally a URI you >> have to use a "system" tag instead into your catalog. >> >> <system systemId="CodeList.xsd" uri="./xsd/CodeList.xsd"/> >> >> >> I hope I have been enought clear with my explanation as this is not may >> mother language. >> >> Best regards >> >> UBL ITLSC >> co-chair >> Roberto Cisternino >> >> >> Juerg wrote: >> ------------------------------------------------------------------------- >> >> Hi, >> >> Excerpts from previous replies on this subject: >> >> >> > Dear Juerg, >> > >> > What information were you expecting XML Spy to use to look up a Schema >> > location in the catalog? Were you expecting it to use the namespace >> URI? >> > You seem surprised that it uses the Schema location. >> > >> > Cheers, Tony. >> >> Tony, >> I am not surprised that it uses the Schema location. But I am surprised >> that the gc files shipped with UBL 2.0 rely on specific XML editor >> features in order to validate correctly. >> >> > So ... I can do what is necessary in oXygen ... >> > Juerg cannot, apparently, do the same in XMLSpy, >> > so the question is "is there some configuration >> > in XMLSpy to map a namespace to a schema?" >> > >> > . . . . . . . . . . Ken >> >> Ken, >> Thanks for clarifying. That seems to be the central question. >> - - - - - >> > The XML Spy docs are very vague on this. The text suggest that they >> only >> > use the catalog to match the public ID in a DOCTYPE declaration. >> However, >> > the subset of OASIS XML Catalogs that they use suggests that they >> might >> > also be able to match some URIs. From what Juerg wrote, it sounds >> like >> > XML Spy will match a Schema location to a URI in the catalog, but not >> a >> > namespace URI. >> > >> > Cheers, Tony. >> >> Tony, >> Correct, I have been able to use XMLSpy's XML catalog subset (the uri >> name=... uri=... clause) successfully, but only when a Schemalocation is >> present in the gc file. >> - - - - - >> > Yes, that is my interpretation of Juerg's >> > analysis. And I see no reference in the XML >> > Catalog specification for mapping a namespace >> > URI to a system resource. I've written to some >> > catalogue users off-line to see if I'm missing >> > something. If true, then it would be a feature >> > of an editing tool outside of support for the XML Catalog >> specification. >> > >> >> If that is true, then one would like to think that the OASIS standard >> for >> gc files should not depend on features of individual editing tools ...? >> >> > In oXygen I can configure precisely what I need >> > to edit the PRD3 genericode files: a mapping of >> > a namespace URI string to a schema location in >> > the absence of an xsi:schemaLocation attribute. >> > >> > I hope someone can point us to this feature, if it exists, in XML Spy. >> > >> >> I hope so too. Alternatively, how are other editing tools faring? >> >> > . . . . . . . . . . Ken >> - - - - - >> > I was part of the committee for OASIS XML Catalogs, as it happens. >> URI >> > rewriting is mentioned in section 4.2: >> > >> > http://www.oasis-open.org/committees/entity/spec-2001-08-06.html#s.uri.ent >> > >> > The thing is, it is up to a particular application to decide *which* >> URIs >> > are rewritten using the catalog. There is built-in support for public >> and >> > system IDs are defined for DTDs, but otherwise everything is just >> URLs. >> > >> > Cheers, Tony. >> >> Tony, >> I am not to familiar with the rewriteURI clause in the context of gc >> files >> urns. What would I have to specify for uriIDStartString= and >> rewritePrefix= ? >> Would this use the namespace URI, or the schemaLocation URI? If the >> latter, I fear the rewriteURI may not solve this problem either ... >> >> - - - - - >> >> > I really think we should include a pre-compiled xml catalog with the >> UBL >> > support package including all GCs and XSDs setting for URI resolving. >> > >> > - URI are more suitable to resolve namespaces >> > - SystemID are more indicated to resolve schemaLocations >> > >> > Thus we have to deal with URI rewrites only I think. >> > >> > This pre-compiled xml catalog could be located into the UBL >> distribution >> > root and have a base address like ./ >> > >> > What do you think about ? >> > >> > UBL ITLSC >> > co-chair >> > Roberto Cisternino >> >> Roberto, >> That seems like a good idea to me in any case. But would this allow to >> validate a gc file using XMLSpy when the schemaLocation attribute is >> absent? >> >> Many thanks for your contributions. >> Juerg >> > Roberto Cisternino DISCLAIMER This e-mail is intended for the addressee only and may contain information which is subject to legal privilege. The contents are not necessarily the official view or communication of the Ministry of Education. If you are not the intended recipient you must not use, disclose, copy or distribute this e-mail or any information in, or attached to it. If you have received this e-mail in error, please contact the sender immediately or return the original message to the Ministry by e-mail, and destroy any copies. The Ministry does not accept any liability for changes made to this e-mail or attachments after sending. All e-mails have been scanned for viruses and content by security software. The Ministry reserves the right to monitor all e-mail communications through its network.