|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Enthusiast
![]() Join Date: Mar 2003
Location: dublin
Posts: 78
|
XML validation problem
Hi
When I use a url with more than one = symbol e.g. http://www.fis.org.nz/index.php?map=yes&app=BreakOut the xml fails to validate. The reason given is that "the production 'entity ref' not satisfied" - I looked up the entity escape character for = and got Code:
& # 6 1 ; - I replaced the = with the entity escape character but that didn't work either. Can anyone help me with where I am doing wrong? Many thanks |
|
|
|
|
|
#2 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Nov 2005
Location: Moss, Norway.
Posts: 274
|
Why do you use decimal character references and not entitiy references?
< = < & = & > = > " = " ' = ' |
|
|
|
|
|
#3 |
|
SitePoint Enthusiast
![]() Join Date: Mar 2003
Location: dublin
Posts: 78
|
Hi kgun
that worked for http://www.fis.org.nz/index.php?map=...p;app=BreakOut but for http://www.minedu.govt.nz/index.cfm?...xparentid=1028 replacing '&' with & doesn't render a well formed url - do you know why that is? Is there anything else in this url that I need to escape other than the '&'? And when I replace: http://www.careers.govt.nz/default.a...=39907&id1=305 with http://www.careers.govt.nz/default.a...07&id1=305 Though the url validates as well-formed if you put both into a browser the well-formed link appears to be broken. Is there any online tool that converts mal-formed urls into well formed ones? Thanks |
|
|
|
|
|
#4 | |||
|
SitePoint Addict
![]() ![]() ![]() Join Date: Nov 2005
Location: Moss, Norway.
Posts: 274
|
Quote:
Quote:
Quote:
File + Check page + validate as xml. Then you usually get meaningful error messages, so you find the error. That is in my way also the best way to do it, since you learn how to write well-formed code. You find a lot of tools on my site: MultiFinanceIT Along the left edge under the heading "Quality control". Scroll down. Alternatively and fast, especially in FF: CTRL + F + Quality control |
|||
|
|
|
|
|
#5 | ||
|
SitePoint Enthusiast
![]() Join Date: Mar 2003
Location: dublin
Posts: 78
|
thanks for the info Kgun
Quote:
Code:
http://www.careers.govt.nz/default.aspx?id0=39907&id1=305 Code:
http://www.careers.govt.nz/default.aspx?id0=39907&id1=305 Code:
http://www.careers.govt.nz/default.aspx?id0=39907&id1=305 Quote:
thanks for your help and the resources |
||
|
|
|
|
|
#6 | |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Nov 2005
Location: Moss, Norway.
Posts: 274
|
Quote:
Simple answer. Because the coding from the server side is "wrong". And the browser do not translate the url with & that does not exist to the url with the &, that exists. The correct way is for the third party to code the url with & from the start to make it well-formed in the xml space. There are a lot of such problems with affilate links. Even large providers supply mal-formed code. You have two choices:
|
|
|
|
|
|
|
#7 |
|
SitePoint Enthusiast
![]() Join Date: Mar 2003
Location: dublin
Posts: 78
|
thanks kgun - at least I now know its not something I am doing or not doing.
T |
|
|
|
|
|
#8 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Nov 2005
Location: Moss, Norway.
Posts: 274
|
Some people struggle for standards. Cite from my favorite XML + PHP Robert Richards (2006) "Pro PHP XML and Web Services" Apress, paper edition, page 17.
"Except for markup delimiters or within a comment, PI or, CDATA section, & and < can never be used directly. The > character must never be used when creating a string containing ]]> within content and not being used at that time to close a CDATA section. The double and single quote characters must never be used in literal form within an attribute value. Attribute values may be enclosed within either double or single quotes, so to avoid potential conflicts, those characters are not allowed within the value. All these characters, according to their particular rule sets, must be represented using either the numeric character references or the entity references." My bolding. Recommendation 1: Never advice a person new to web development to learn HTML. Say that (s)he should not learn that bad dialect. Advice her / him to learn XML or at least XHTML from the very start. Then (s)he will be used to write well-formed code from the beginning and (s)he will have no problem understanding HTML. Recommendation 2: Buy the above book of Robert Richards if you do not already own it. It is soon, not least if you care about developing for Web 2.0 (AJAX and XML driven sites etc.) worth it's weight in gold. Related thread: The XML family of technologies will revolutionize web linking etc. Note: There is also a new trend on databases. Object oriented databases have not been so popular so long, even if they should since they are much more flexible than traditional relational database. E.g. in a pure OO database, a relation is a reference and fields can contain mixed content etc. Native XML databases (NXD) specializes in XML storage. An NXD, uses XML technologies like XPath and the Document Object Model (DOM) to create and manipulate documents within the database. Traditional relational databases, however, have also made strides in this area. Many begin to include advanced XML features. Think of the flexibility of an OO Database. You can store a movie in one record (row) and a picture in another record in the same field (column). Time will show if the NDX concept becomes the final starter (and driver) for OO (relational) Databases like Versant and FlexPro P. S. I was so lucky that I participated at a lecture with Kristen Nygaard on this topic (OODB PHYLA) and BETA before he died. Last edited by kgun; Aug 1, 2007 at 03:49. |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 18:02.









Linear Mode
