JavaScript XPath fails with mixed-caps in element names

RESOLVED INCOMPLETE

Status

()

Firefox
General
RESOLVED INCOMPLETE
11 years ago
7 years ago

People

(Reporter: Michael Westbay, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [CLOSEME 2010-11-01])

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

Running XPath queries on XML documents where all element names are all lower case works fine.  However, XML documents with mixed case fail.

Works: "//person/personid"
<people>
  <person>
    <personid>1</personid>
    . . .
  </person>
  . . .
</people>

Fails: "//Person/PersonID"
<People>
  <Person>
    <PersonID>1</PersonID>
    . . .
  </Person>
  . . .
</People>


Reproducible: Always

Steps to Reproduce:
1. Setup xpath method:

xpath = function (doc, path, asString) {
	var type = XPathResult.ANY_TYPE;
	if (asString) {
		type = XPathResult.STRING_TYPE;
	}
	if (!doc) {
		return null;
	}
	var rValue = document.evaluate(path, doc, NSResolver, type, null);
	if (asString) {
		return rValue.stringValue;
	} else {
		return rValue;
	}
};

2. AJAX application queries XML document

3. XML document with mixed case tag names is returned to callback function as doc

4. var pid = xpath(doc, "//Person/PersonID", true);

5. Try with "//person/personid"

6. Return XML with all lower case element names
Actual Results:  
#4 returns an empty string to pid

#5 returns an empty string to pid

#6 returns "1" to pid - correct

Expected Results:  
Expected "1" for both #4 and #6.

Expected empty string for #5.

Using FireBug, I see that tag names (localName, tagName, nodeName properties) are in mixed case for the various nodes in the result XML document.  However, it shows the node for PersonID as "<personid>" in the debugger.  I don't know if that is something that FireBug displays or if it's something in the Mozilla DOM.
This is a mass search for bugs that are in the Firefox General component, are UNCO, and have not been changed for 1000 days and have an unspecified version. 

Reporter, can you please update to Firefox 3.6.10, create a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles, and test again. If you still see the bug, please update this bug. If the issue is gone, please set the resolution to RESOLVED > WORKSFORME.
Whiteboard: [CLOSEME 2010-11-01]
No reply from reporter, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.