Hi,

2009/3/19 G. Ken Holman <[email protected]>

> At 2009-03-19 10:19 +0100, Romain Pelisse wrote:
>
>> Provided I got this
>> page<http://wiki.services.openoffice.org/wiki/Xml#Validation>right it
>> seems to be no way to run an XSD validation either on import or
>> export (when using an XSL filter to convert the document). This is
>> definitely a "show-stopper" for me
>>
>
> It would help me to understand why this is a show-stopper.  It it only
> because you do not have the opportunity to validate your inputs
> imperatively?  Is it too awkward to write your content validation checks in
> XSLT 2 logic that you need to use the schema?
>

Well basicly, the idea is to use the XSL Filter to transform some of my
customer specific XML datafile into something that OOo can displays. To
ensure the user does not import an invalid XML file, we just want, prior to
running the XSL transformation itself, to check if the XML file loaded is
valid according to my customer XSD.

Therefore, to be concrete, if I load a file that pretends to be an OpenXML
for instance, prior to trying to actually, transform it, i would like to
assert it is what it claims to be.

Then, when the OOo's user has finished his work on the document, is going to
export it back into our customer's specific format. There again, we want to
validate that the exported document still comply to the XSD...


> I ask because I teach these topics (I'm in the middle of a 5-day
> XSLT/XQuery delivery in Prague this week) and I am curious to know which use
> cases users would qualify as "show-stoppers".
>

Well, our customer wants to give its own customer juridical document, as
XML, and help them edit them using OpenOffice to render and displays the
content. The last thing he wants, it's having OOo exporting invalid document
(that doesn't match the original document XSD).


> Would you propose writing W3C Schema validation on your own?  I think it
> would be an incredible challenge to do it well ... which is why I have such
> respect for Michael Kay and his high conformance and high performance tools.
>
> It is my opinion that you are mistaken.  And you wouldn't be the first one!
>  Some of my students come to class thinking the same.



Yes, i think i either misunderstood something or you misunderstand me. I
neither wanted to re implement myself an XSD Validator ! Merely trigger such
a validation at runtime... Basicly, changing this behavior documented on
your wiki:

* Validation * *Currently, no XML validation takes place during the import
or export of documents. *

... but maybe this refers to something else ?

Also, were you aware that "turning on validation" also requires changes to
> an XSLT stylesheet to engage the validation features?  Not only will you
> need to install a schema-aware processor, and change the invocation to turn
> on validation, but you also need import statements in the XSLT to pull in
> the type definitions that your validation instructions refer to in order to
> indicate the validation you want.
>
> BTW, there may very well be other validating W3C Schema processors out
> there, but I'm not aware of them so I've not used them.
>

I'm confused again here... It sounds like you think I want to validate the
XSLT itself ! All I want here is to prior to import/export. From my point of
view, the XSLT filter is not even load in memory when this happens.

Here is what would like OOo to do when I import one of our file:

1. Load the File
2. Validate that the file is valid regarding an XSD
3. If the file is OK, run the transformation (no validation during this
part).
4. Render the doc, work on it.
5. Run the export filter
6. Validate that the exported file is still valid

>From my point of view, it sounds like a very simple use case, and it does
not seems so hard to implement. In fact, i'm wondering what is not already
implemented ! Just validate the XML document either with an embedded URL to
the appropriate XSD (requires connexion) or simply by validating it with a
ship in XSD.

Then, run the XSL transformation... That's all.

But again, maybe i got this wrong, maybe an XSD validation can occur when
you import/export XML file...

-- 
Romain PELISSE,
"The trouble with having an open mind, of course, is that people will insist
on coming along and trying to put things in it" -- Terry Pratchett
http://belaran.eu/

Reply via email to