1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_dom_ProcessingInstruction_h
7 #define mozilla_dom_ProcessingInstruction_h
9 #include "mozilla/Attributes.h"
10 #include "nsIDOMProcessingInstruction.h"
11 #include "nsGenericDOMDataNode.h"
12 #include "nsAString.h"
17 class ProcessingInstruction
: public nsGenericDOMDataNode
,
18 public nsIDOMProcessingInstruction
21 ProcessingInstruction(already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
,
22 const nsAString
& aData
);
25 NS_DECL_ISUPPORTS_INHERITED
28 NS_FORWARD_NSIDOMNODE_TO_NSINODE
30 // nsIDOMCharacterData
31 NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
32 using nsGenericDOMDataNode::SetData
; // Prevent hiding overloaded virtual function.
34 // nsIDOMProcessingInstruction
35 NS_DECL_NSIDOMPROCESSINGINSTRUCTION
38 virtual bool IsNodeOfType(uint32_t aFlags
) const;
40 virtual nsGenericDOMDataNode
* CloneDataNode(mozilla::dom::NodeInfo
*aNodeInfo
,
41 bool aCloneText
) const MOZ_OVERRIDE
;
44 virtual void List(FILE* out
, int32_t aIndent
) const MOZ_OVERRIDE
;
45 virtual void DumpContent(FILE* out
, int32_t aIndent
, bool aDumpAll
) const MOZ_OVERRIDE
;
48 virtual nsIDOMNode
* AsDOMNode() MOZ_OVERRIDE
{ return this; }
51 void GetTarget(nsString
& aTarget
)
56 virtual ~ProcessingInstruction();
59 * This will parse the content of the PI, to extract the value of the pseudo
60 * attribute with the name specified in aName. See
61 * http://www.w3.org/TR/xml-stylesheet/#NT-StyleSheetPI for the specification
62 * which is used to parse the content of the PI.
64 * @param aName the name of the attribute to get the value for
65 * @param aValue [out] the value for the attribute with name specified in
66 * aAttribute. Empty if the attribute isn't present.
68 bool GetAttrValue(nsIAtom
*aName
, nsAString
& aValue
);
70 virtual JSObject
* WrapNode(JSContext
*aCx
) MOZ_OVERRIDE
;
74 } // namespace mozilla
77 * aNodeInfoManager must not be null.
79 already_AddRefed
<mozilla::dom::ProcessingInstruction
>
80 NS_NewXMLProcessingInstruction(nsNodeInfoManager
*aNodeInfoManager
,
81 const nsAString
& aTarget
,
82 const nsAString
& aData
);
84 #endif // mozilla_dom_ProcessingInstruction_h