• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2005 Frerich Raabe <raabe@kde.org>
3  * Copyright (C) 2006 Apple Computer, Inc.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #include "config.h"
28 #include "XPathNamespace.h"
29 
30 #if ENABLE(XPATH)
31 
32 #include "Element.h"
33 
34 namespace WebCore {
35 
XPathNamespace(PassRefPtr<Element> ownerElement,const String & prefix,const String & uri)36 XPathNamespace::XPathNamespace(PassRefPtr<Element> ownerElement, const String& prefix, const String& uri)
37     : Node(ownerElement->document())
38     , m_ownerElement(ownerElement)
39     , m_prefix(prefix)
40     , m_uri(uri)
41 {
42 }
43 
~XPathNamespace()44 XPathNamespace::~XPathNamespace()
45 {
46 }
47 
ownerDocument() const48 Document* XPathNamespace::ownerDocument() const
49 {
50     return m_ownerElement->ownerDocument();
51 }
52 
ownerElement() const53 Element* XPathNamespace::ownerElement() const
54 {
55     return m_ownerElement.get();
56 }
57 
prefix() const58 const AtomicString& XPathNamespace::prefix() const
59 {
60     return m_prefix;
61 }
62 
nodeName() const63 String XPathNamespace::nodeName() const
64 {
65     return "#namespace";
66 }
67 
nodeValue() const68 String XPathNamespace::nodeValue() const
69 {
70     return m_uri;
71 }
72 
namespaceURI() const73 const AtomicString& XPathNamespace::namespaceURI() const
74 {
75     return m_uri;
76 }
77 
nodeType() const78 Node::NodeType XPathNamespace::nodeType() const
79 {
80     return Node::XPATH_NAMESPACE_NODE;
81 }
82 
83 }
84 
85 #endif // ENABLE(XPATH)
86