> getElementsByClassName, getElementById and some others are never usd on XML > documents. The only function that works on them is getElementsByTagName.
Ja, I was saying ByClassName and ById wouldn't work on the documents because they are schemaless islands, but you're right that ClassName primarily wouldn't work on the document because it is XML, period, not just because it is not in the main DOM. Oops. On the other hand, getElementById is in DOM 2 Core and is equally applicable to XML + HTML documents. The catch is that without an ID attribute defined in a loaded schema, there is nothing for ById to search for -- and XHR-fetched XML can't be relied upon to have schemas loaded (usually by design but not by intuition). In my tests, when a schema with an ID type can be loaded, then it works fine: for example, if the main document is an XMLDocument then getElementById will work, finding els where (attributes.id.isId && attributes.id.value = <the_id>). If you build an XMLDoc island manually with a DOCTYPE it also works. So I would still say the main reason that ById doesn't work on a schemaless document is that it's not in the DOM and so doesn't get the main document's schema, not that it's XML. -- S.
