traperjeff
Member
Thank you lou........I thought I was doing something wrong, or just didn't know what I was doing....Thanks again..Jeff
loumaag said:Don, you need to adjust the software, this will happen again and again as the ° symbol is going to appear over and and over.
Don, you make some good points, but you miss the main point. &blob is not a valid HTML character; & is. It is accetable to use it becuase it is valid. &blob is not. The problem isn't on RR's end, it is in your parser, did you use a standard parser library or did you roll your own? A proper XML parser must accept all Unicode Characters according to the W3C Recommendation:DonS said:Uh-uh. If RR is going to supply something it calls XML, it needs to be well-formed XML.
Sure, Win9x could be modified to handle °, but this is only because a) we know about ° and b) Win9x receives the text directly via HTTP then passes it off to an XML parser.
But:
1. What about other invalid XML? What if something like &blob; appeared? RR should, when it forms the XML, verify that the text it's including is actually valid. If it's not, RR should either escape it, translate it to valid XML, or omit it entirely.
2. What about other apps? If I was using .NET, VB, or some other framework that writes most of my code for me, it's possible that I wouldn't have access to the plain-text XML. Some underlying libraries might receive the HTML body, pass it through an XML parser, then hand me the output. The parser would barf, and I'd never have a chance to fix the offending "XML".
This really needs to happen on RR's side. In my opinion, it isn't realistic to expect multiple apps (existing and not-yet-created) written in multiple languages to handle known and unknown violations of XML's content rules.
I am pretty sure that " ° " fits in that range. Whether you choose to use or discard the character & in your application is up to you, but it since it is valid, your parser has to accept it and not just stop.Consequently, XML processors MUST accept any character in the range specified for Char.
Character Range
[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
The mechanism for encoding character code points into bit patterns MAY vary from entity to entity. All XML processors MUST accept the UTF-8 and UTF-16 encodings of Unicode 3.1 [Unicode3]; the mechanisms for signaling which of the two is in use, or for bringing other encodings into play, are discussed later, in 4.3.3 Character Encoding in Entities.
We're talking about "& d e g ;", not "& a m p ;". In the context of this thread, "& b l o b ;" and "& d e g ;" are equally invalid.loumaag said:Don, you make some good points, but you miss the main point. &blob is not a valid HTML character; & is.
No, it's on RR's end. RR is sending the 5-character sequence "& d e g ;". This is not valid XML.The problem isn't on RR's end, it is in your parser.
RR is NOT sending the single-character Unicode ISO/IEC 10646 value for the degree symbol " ° ". It is sending the 5-character sequence "& d e g ;".A proper XML parser must accept all Unicode Characters according to the W3C Recommendation:I am pretty sure that " ° " fits in that range.
Again, we're not talking about "& a m p ;" in this thread. "& a m p ;" is OK. It's a predefined entity reference that is replaced with a single ampersand character. However, "& d e g ;" is invalid. When the 5-character sequence "& d e g ;" appears in character data, it is, by definition, an entity reference. But there's no 'deg' entity declared previously, so the reference is an error.Whether you choose to use or discard the character & in your application is up to you, but it since it is valid, your parser has to accept it and not just stop.
rfmobile said:An XML <!ENTITY ... > declaration should take care of that.
Try this ...
<!ENTITY deg CDATA "°" -- degree sign, U+00B0 ISOnum -->
Sorry about the mistake there Don, I really meant to type ° and somehow got off on &. However, I am sorry to say, you are wrong. ° is valid whereas &blob is not. The length of the character definition is not set at 5 or any other length. For example, whereas ° is 5 characters long and stands for ° (the degrees symbol), © is 6 characters long and stands for © (the copyright symbol). It is a good thing you are not dealing in math or else you would have a little trouble with the 4 character code π for π (greek small Pi).DonS said:We're talking about "& d e g ;", not "& a m p ;". In the context of this thread, "& b l o b ;" and "& d e g ;" are equally invalid.
Whats funny about this is the block of text I quoted in my post of mid-afternoon of 9/15 is from that particular page you supplied the link to. Ah, well, this is certainly not a subject for this thread anyway and I guess Lindsay solved the OP's problem so we can take our different interpretations of what that page says off thread.DonS said:Take a look at the constraints in section 4.1 (Character and Entity References) of Extensible Markup Language (XML) 1.1 W3C Recommendation. You'll see that an entity must be declared, unless it's one of amp, lt, gt, apos, or quot.
Yes, the text you quoted previously is from the same document. However, that quoted text merely defines the characters that may be used in an XML document - it doesn't say that every combination of those characters (e.g. °) is valid XML.Whats funny about this is the block of text I quoted in my post of mid-afternoon of 9/15 is from that particular page you supplied the link to.
I think that you are correct here. I will retract my position.DonS said:It seems that the initial confusion stemmed from HTML's pre-defined entity names, and an assumption that XML processors were required to accept the HTML set. I think we've established that this isn't so, and XML documents that make use of such HTML-like entity references, or any other entity references that aren't among the five that XML defines, must explicitly define those entities.