View Full Version : Query Strings and XHTML Validation

01-29-2004, 02:19 AM
If the ampersand character will invalidate my XHTML documents, how am I supposed to pass query strings with multiple variables along with certain links?

01-29-2004, 02:37 AM

// freak

01-29-2004, 02:58 AM
ah.. dur..



01-29-2004, 03:00 AM
that's fairly annoying though. is there a really good reason i'm ignorant of for this?

i mean, i was already using the "&" before, and now for "valid" markup i'm going to have to get used to a simple, but tediously annoying extra four characters everytime i wanna pass some freakin' variables?


01-29-2004, 10:50 AM
Yes, it's because & has been reserved for entity references the whole time, but XML is stricter in how you are allowed to use it. In other words, XML will not allow you to use & for anything other than an entity reference, while SGML was laxer and only parsed them as entity references when they were obviously a part of an entity reference.

XML has a few quirks like that. It's not intended to be a more space efficient language than SGML - it's indented to be a less ambigous language than SGML.

01-29-2004, 04:06 PM
yeah, but i just think that's one exception that could reasonably be made at least. just in that one instance, where an & is deteceted in an anchor's href attribute. 'cause as i said, it just seems needlessly excessive to require it there. i guess i'm just being a whiney *****, but.. *shrug*

but yeknow, i was just thinking about it, and it would actually be beneficial at making href's with longer query strings easier to read. (the ;'s)

so meh.. guess i'll just get used to is

01-29-2004, 04:44 PM
But, you know, from an XML point of view, an attribute named href is no different from an attribute named id or an attribute named boo. XML doesn't give any specific element, attribute or entity name any special treatment compared to the others - all are equal (Well, with the exception of anything that starts with xml, since that means it's from one of the additional XML specs, such as the 'xmlns' for XML namespaces).

One of the reasons XML is a preferred language to SGML is just that there are no special cases. Another is that nothing may be minimised. Yet another is that you must explicitly close an element, because if you don't give the element name any specific properties, how do you know if the element is intended to be empty or contain content?

01-30-2004, 03:46 PM
so, to switch topics a bit, is XML in its simplest form just a set of very specifics and semantic tags designed to more accurately describe their content? no scripts, fancy functions, etc? and then CSS (or XSL i guess, though i know next to nothing about it) is used for presentation?

i feel like i have a decent, VAGUE grasp on XML, but i wouldn't know how to implement it, when it's warranted for sure, etc.

can you offer any insights, links, etc? the W3C is too dry and technical, and i've not found many tutorials that say anything other than "XML is a metalanguage, a language for describing languages, blah blah blah." Show me it in action! Explain what and why! Bah!

01-30-2004, 04:52 PM
Ok, I'll try to explain it in plain English, if I can. Let's start with describing what XML is not, however, since the confusion generally is that people think of XML as something it isn't - namely an end document language.

- XML does not have any elements or attributes*.
- XML does not have any semantical meaning.
- XML does not have any presentational or rendering properties whatsoever.
- XML does not have any behavior or functionality properties whatsoever.

* Well, when it goes for attributes, it has. More on that later.

Ok, then when I say that, I might have to explain what XML really is, right? OH well:

- XML is a set of syntax rules for markup. These describe the usage of tags for creating PIs*, comments, notations, and elements. It also describes the usage of entities and entity references, as well as attributes on elements.
- XML describes how an XML application** encodes a document structure with tags.
- XML defines what characters are allowed in tags and entities.
- XML defines mechanisms for describing what XML application a docuemnt is written in.

* PI is an abbreviation for processing instruction.
** An XML application is an XML markup language, for example RSS, Atom, XHTML, XSL-FO, SVG, MathML.

So, what is an XML application?
- And XML application is a markup language described as XML.
- An XML application provides a set of elements, describing element names, their allowed contents, and their attributes, as well as entities, in the form of either a DTD*, an XML Schema or a RelaxNG document.
- An XML application may have default behaviors and functionality as well as presentational and rendering properties associated with it through either DOCTYPE recognition, namespace recognition, metadata recognition (outside the scope of XML), or proprietary recognition mechanisms.
- And XML application may provide semantics through the specification for the language, through readable and meaningful names on elements and attributes,

* DTD meaning Document Type Definition, not to be confused with DOCTYPE, Document Type Declaration, which only describes which DTD to use.

And, finally, what is an XML document?
- An XML document is a document conforming to the conforming to XML well formedness and the XML syntax rules.
- An XML document may, or may not, be written according to an XML application.
- If so, it may describe what XML application or applications it conforms to through DOCTYPE, XML Schema, XML Namespace, or metadata recognition.
- An XML document is valid if it not only conforms to the XML syntax and well formedness rules, but also to the validation method (DTD, XML Schema, RelaxNG) and the additional restrictions both XML and the XML application puts on it when validating. Some of these restrictions may not be evident from the validation method, and only be described in the specification itself.

There are some special cases, though. XLink, XML Events, XForms, XInclude, XFrames may be considered XML applications but are really extensions of XML. There are also a few default attribute names and namespaces in XML, these being xml:*, xml:space, xml:lang, xml:base, xmlns, xmlns:*. Attribute and element names may not begin with /[xX][mM][lL]/ unless they are part of an XML specification or extension.

01-30-2004, 07:45 PM

liorean, you get the terse award for the week.

01-30-2004, 07:55 PM
Somehow, I can't say if that was an ironic comment or not.

02-01-2004, 11:33 PM
Hmm, good post. Interesting. Useful.