- From: <bugzilla@wiggum.w3.org>
- Date: Wed, 02 May 2007 23:24:56 +0000
- To: public-qt-comments@w3.org
- CC:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=4523 Summary: Default Unprefixed Namespace Handling is Problematic Product: XPath / XQuery / XSLT Version: Recommendation Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: XQuery AssignedTo: chamberl@almaden.ibm.com ReportedBy: Kenneth.B.Sall@saic.com QAContact: public-qt-comments@w3.org CC: mike@saxonica.com [This may be related to Bug ID 4463.] There appears to be a namespace usability problem in XQuery 1.0: when the source document is in no namespace and you need the result elements to be in a default (unprefixed) namespace. My use case is KML, the markup for Google Earth [see http://code.google.com/apis/kml/documentation/kml_tut.html ] I’ve having difficulty outputting the correct default namespace from a query. [I'm using SaxonB 8.9J on Windows XP with jre 1.6.0_01.] With this trivial input: <?xml version="1.0" encoding="UTF-8"?> <bar>foobar</bar> and trivial XQuery #1: <kml> <Folder> { for $i in doc("namespace.xml")//bar return $i } </Folder> </kml> I get the result #1: <?xml version="1.0" encoding="UTF-8"?> <kml> <Folder> <bar>foobar</bar> </Folder> </kml> However, I need the opening <kml> to appear as: <kml xmlns="http://earth.google.com/kml/2.1"> With XQuery #2: <kml xmlns="http://earth.google.com/kml/2.1"> <Folder> { for $i in doc("namespace.xml")//bar return $i } </Folder> </kml> I get result #2: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://earth.google.com/kml/2.1"> <Folder/> </kml> Which isn't correct for the <Folder> content. I've also tried adding a default namespace declaration to XQuery #2: declare default element namespace "http://earth.google.com/kml/2.1"; but that has no impact; I still get result #2. Unfortunately, Google Earth really seems to expect an unprefixed default namespace. When I take their basic examples and add a prefix, like so: <?xml version="1.0" encoding="UTF-8"?> <ge:kml xmlns:ge="http://earth.google.com/kml/2.1"> <ge:Folder> <ge:Placemark> <ge:name>Simple placemark</ge:name> <ge:description>Attached to the ground. Intelligently places itself at the height of the underlying terrain. </ge:description> <ge:Point> <ge:coordinates>-122.0822035425683,37.42228990140251,0</ge:coordinates> </ge:Point> </ge:Placemark> </ge:Folder> </ge:kml> Google Earth thinks the root <kml> element is "bad or missing". Therefore, my use case is problematic with XQuery 1.0, as far as I understand. The workaround is to simply output "<kml>" with no namespace attribute, which Google Earth appears to understand, although the usability issue remains for XQuery.
Received on Wednesday, 2 May 2007 23:25:04 UTC