XML validation question.

W

WideBoy

I am aware that XML is case sensitive on the whole but for some
business-specific reasons I was wondering if it is possible to some
how change this behaviour?

Basically, I have an XML schema and would like it to validate docs but
not fall over when case of the element names don't match.

Many thanks.

Naran
 
P

Philippe Poulard

WideBoy a écrit :
I am aware that XML is case sensitive on the whole but for some
business-specific reasons I was wondering if it is possible to some
how change this behaviour?

Basically, I have an XML schema and would like it to validate docs but
not fall over when case of the element names don't match.

hi,

IMHO, the best way to achieve this is not to validate your document, but
to validate a lower-case view of your document (or an upper-case view or
a camel-case or whatever you schema expect to encounter).

This can be achieved with a very simple SAX filter that would act on
elements : change them according to what you want, and pipe the modified
stream to your validator ; of course, you can also act similarly on your
attributes.

Alternatively, if the size of your document doesn't exceed, say 10MB,
you can do it with XSLT.

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
-----------------------------
http://reflex.gforge.inria.fr/
Have the RefleX !
 
J

Joseph Kesselman

I agree with Philippe's comments. f you insist on writing the document
without respecting case, it isn't actually XML. You would need to
convert it to XML before trying to process it, by running it through
some sort of preprocessing stage.

The better answer is to fix whatever's generating the document in the
first place so it actually conforms to the schema. That may involve
attacking the users with surgical equipment, but they're gonna have to
learn the rules sooner or later and it might as well be now.
 
A

Andy Dingley

I am aware that XML is case sensitive on the whole but for some
business-specific reasons I was wondering if it is possible to some
how change this behaviour?

For much more general reasons, you should make it case-sensitive.

XML is case-sensitive. XML is widespread across businesses and well-
standardised. XML has many easily available tools.

Trying to change this behaviour for any business-specific reason is
possible, but you're no longer using "XML" and you've lost the
advantages of it. In particular, you can supply case-varying XML to a
partner business who won't be able to process it. This all outweighs
any possible advantage of case-insensitivity for the business' more
narrow needs (valid though they might be).
 
P

Peter Flynn

WideBoy said:
I am aware that XML is case sensitive on the whole but for some
business-specific reasons I was wondering if it is possible to some
how change this behaviour?

No, not if you want to conform to XML.
Basically, I have an XML schema and would like it to validate docs but
not fall over when case of the element names don't match.

Another solution, in addition to those posted, is to use SGML, which
*does* allow case-insensitivity, and convert the document to XML once
you're finished validation. I have used this on a number of occasions to
extricate clients from tight corners, but it does require a knowledge of
SGML.

The problem is that SGML uses only DTDs, not Schemas, so if your Schema
defines structures or validation criteria which cannot be expressed in a
DTD, this way is a non-starter.

///Peter
 
W

WideBoy

WideBoy a écrit :



hi,

IMHO, the best way to achieve this is not to validate your document, but
to validate a lower-case view of your document (or an upper-case view or
a camel-case or whatever you schema expect to encounter).

This can be achieved with a very simple SAX filter that would act on
elements : change them according to what you want, and pipe the modified
stream to your validator ; of course, you can also act similarly on your
attributes.

Alternatively, if the size of your document doesn't exceed, say 10MB,
you can do it with XSLT.

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |

Many thanks for all your replies.
They've made me realize that trying to stick to the XML standard is a
far better choice than trying to bend it to appease end users. So I am
now going to use gentle persuasion on end users generating 'invalid'
XML.

Best regards,

W.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top