473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Validating Newlines and Carriage Returns via Schema

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

Jul 20 '05 #1
1 1775
"Porthos" <ja*****@vt.edu> 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
Jul 26 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Will | last post by:
I have been having problems validating an XForms document against the XForms schema located at http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd. I have reduced the XForm to its bare bones...
1
by: Andy | last post by:
I am having some trouble validating XML using the XmlValidatingReader. I have created some xml and used the visual studio to generate the schema. So I am confident that the xml and schema match. ...
2
by: Joris Janssens | last post by:
I'm trying to write a program for validating XHTML 1.1-documents against the XHTML 1.1 DTD (which is actually the same as validating an XML-file) but I always get a "(404) Not found" error. This...
1
by: Craig Beuker | last post by:
Hello, I am experimenting with this XmlValidatingReader and have a question about how it is working (or not working as would be the case) The sample documents and code are included at the end...
2
by: eagleofjade | last post by:
I am trying to import data from a Word document into an Access table with VBA. The Word document is a form which has various fields. One of the fields is a field for notes. In some cases, this...
2
by: Matt Mercer | last post by:
Hi all, I am having a frustration problem, and I have read about 25 newsgroup postings that do not have a satisfying answer :) The problem appears to be common where carriage returns are lost...
6
by: dbee | last post by:
So I can't seem to urlencode a file with newlines ... it just gives me a series of T_STRING unexpected parse errors... cat job_description | while read file ; do php -r "echo...
7
by: mattrapoport | last post by:
I have a page with a div on it. The div displays a user comment. When the user logs into this page, their current comment is pulled from a db and displayed in the div. The user can edit the...
5
by: barcaroller | last post by:
I have a text file with mixed carriage returns ('\n' and '\r\n'). On Linux, both the std::string getline() global function and the std::iostream getline() member function are keeping some of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.