2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsXPathNSResolver.h"
|
2011-10-03 12:11:31 -07:00
|
|
|
#include "nsDOMClassInfoID.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsDOMString.h"
|
|
|
|
|
2014-04-25 09:49:00 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION(nsXPathNSResolver, mNode)
|
2007-09-27 09:39:13 -07:00
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXPathNSResolver)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXPathNSResolver)
|
2010-01-12 05:08:43 -08:00
|
|
|
|
|
|
|
DOMCI_DATA(XPathNSResolver, nsXPathNSResolver)
|
|
|
|
|
2007-09-27 09:39:13 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXPathNSResolver)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNSResolver)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathNSResolver)
|
2010-03-17 08:09:05 -07:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XPathNSResolver)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
nsXPathNSResolver::nsXPathNSResolver(nsIDOMNode* aNode)
|
2011-06-14 00:56:48 -07:00
|
|
|
: mNode(aNode)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
NS_ASSERTION(mNode, "Need a node to resolve namespaces.");
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXPathNSResolver::LookupNamespaceURI(const nsAString & aPrefix,
|
|
|
|
nsAString & aResult)
|
|
|
|
{
|
|
|
|
if (aPrefix.EqualsLiteral("xml")) {
|
|
|
|
aResult.AssignLiteral("http://www.w3.org/XML/1998/namespace");
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mNode) {
|
|
|
|
SetDOMStringToNull(aResult);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mNode->LookupNamespaceURI(aPrefix, aResult);
|
|
|
|
}
|