Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Validating Newlines and Carriage Returns via Schema

Reply
Thread Tools

Validating Newlines and Carriage Returns via Schema

 
 
Porthos
Guest
Posts: n/a
 
      07-20-2005
Hello all,

Is there a facet pattern that will allow for the inclusion of a
newline or carriage return to occur within a tag? From the W3C schema
document and from previous posts I've read that [\n\r] should take care
of this situation, however when I include that pattern (and a
newline\carriage return) I still recieve an error telling me that my
data is an invalid value according to its data type. When I remove the
returns and new lines the error is alieviated.

Any thoughts would be appreciated.

Thanks,

James

 
Reply With Quote
 
 
 
 
C. M. Sperberg-McQueen
Guest
Posts: n/a
 
      07-26-2005
"Porthos" <(E-Mail Removed)> writes:

> Hello all,


> Is there a facet pattern that will allow for the inclusion
> of a newline or carriage return to occur within a tag?


I'm going to assume you mean "within an element", i.e.
after the start-tag and before the end-tag.

(If you actually do mean "within a tag", i.e. within the
start-tag or end-tag, the answer is no, XML Schema does
not allow conditions on the white space within start- and
end-tags.)

> From the W3C schema document and from previous posts I've
> read that [\n\r] should take care of this situation, however
> when I include that pattern (and a newline\carriage return)
> I still recieve an error telling me that my data is an
> invalid value according to its data type. When I remove the
> returns and new lines the error is alieviated.


> Any thoughts would be appreciated.


You need to show us the type declaration and some sample
data. Without more detail, you won't get any responses
except vague generalities.

In the following, I am assuming that you are talking
about simple types, not complex types.

Vague generality no. 1: the XML Schema pattern facet
can restrict the lexical space of a type, but cannot
enlarge it. If the base type does not allow newlines,
the derived type won't allow them just because they
occur in a pattern: the lexical forms for the derived
type must match the pattern, but they must also be
in the lexical space of the base type. (The effective
lexical space of any type is the intersection of the
language defined by its pattern facet and the lexical
space of its base type.)

Vague generality no. 2: Remember that whitespace
processing is independent of the lexical space; what
happens in validation is that (1) the string you see in
the document is handled by the XML parser, and then
(2) the output from the XML parser (what the XML
Schema spec calls the 'actual value') undergoes the
whitespace processing appropriate to the type, and
then (3) the result is checked to see whether it's
a legal lexical form for the type in question.

So perhaps what you want to do is adjust the value
of the whitespace facet, rather than adding a pattern
facet.

Vague generality no. 3: on Usenet, specific questions
often get better answers than vague ones. If this is
not intuitively obvious to you, you should probably
read http://catb.org/~esr/faqs/smart-questions.html

--C. M. Sperberg-McQueen
World Wide Web Consortium
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Carriage returns in XML Excel sheet created using XmlDocument and XmlTextWriter st@jpa.co.jp ASP .Net 1 10-07-2005 10:47 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
How to match carriage returns and line feeds Schroeder Perl 1 01-26-2005 06:53 PM
Help: Delete a single carriage return in a file, but not a double carriage return? Steve Anderson Perl Misc 3 06-21-2004 12:48 AM
Carriage Returns and sockets Iceberg Perl 1 09-06-2003 04:49 PM



Advertisments