Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
ProcessingInstruction Class Reference

#include <dom.h>

Inheritance diagram for ProcessingInstruction:
Inheritance graph
[legend]
Collaboration diagram for ProcessingInstruction:
Collaboration graph
[legend]

List of all members.

Public Types

enum  NodeType {
  ELEMENT_NODE = 1, ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE,
  ENTITY_REFERENCE_NODE, ENTITY_NODE, PROCESSING_INSTRUCTION_NODE, COMMENT_NODE,
  DOCUMENT_NODE, DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE, NOTATION_NODE
}

Public Member Functions

 ~ProcessingInstruction ()
MBool getLocalName (nsIAtom **aLocalName)
nsresult getNodeName (nsAString &aName) const
nsresult getNodeValue (nsAString &aValue)
unsigned short getNodeType () const
NodegetParentNode () const
NodegetFirstChild () const
NodegetLastChild () const
NodegetPreviousSibling () const
NodegetNextSibling () const
virtual NamedNodeMapgetAttributes ()
DocumentgetOwnerDocument () const
virtual void setNodeValue (const nsAString &nodeValue)
virtual NodeappendChild (Node *newChild)
MBool hasChildNodes () const
virtual nsresult getBaseURI (nsAString &aURI)
nsresult getNamespaceURI (nsAString &aNSURI)
virtual PRInt32 getNamespaceID ()
virtual PRInt32 lookupNamespaceID (nsIAtom *)
virtual NodegetXPathParent ()
virtual PRInt32 compareDocumentPosition (Node *aOther)
Nodeitem (PRUint32 index)
PRUint32 getLength ()
void appendData (const PRUnichar *aData, int aLength)

Public Attributes

char * function
unsigned count
unsigned hits
Nodenext

Protected Member Functions

NodeDefinitionimplAppendChild (NodeDefinition *newChild)
NodeDefinitionimplRemoveChild (NodeDefinition *oldChild)
void DeleteChildren ()

Protected Attributes

nsString nodeName
nsString nodeValue
PRUint32 length

Private Member Functions

 ProcessingInstruction (const nsAString &theTarget, const nsAString &theData, Document *owner)

Private Attributes

nsCOMPtr< nsIAtommLocalName

Friends

class Document
class txXPathTreeWalker
class txXPathNodeUtils

Detailed Description

Definition at line 535 of file dom.h.


Member Enumeration Documentation

enum Node::NodeType [inherited]
Enumerator:
ELEMENT_NODE 
ATTRIBUTE_NODE 
TEXT_NODE 
CDATA_SECTION_NODE 
ENTITY_REFERENCE_NODE 
ENTITY_NODE 
PROCESSING_INSTRUCTION_NODE 
COMMENT_NODE 
DOCUMENT_NODE 
DOCUMENT_TYPE_NODE 
DOCUMENT_FRAGMENT_NODE 
NOTATION_NODE 

Definition at line 90 of file dom.h.


Constructor & Destructor Documentation

Definition at line 66 of file ProcessingInstruction.cpp.

{
}
ProcessingInstruction::ProcessingInstruction ( const nsAString &  theTarget,
const nsAString &  theData,
Document owner 
) [private]

Definition at line 54 of file ProcessingInstruction.cpp.

Here is the call graph for this function:


Member Function Documentation

Node * NodeDefinition::appendChild ( Node newChild) [virtual, inherited]

Implements Node.

Reimplemented in Attr, Element, Document, and DocumentFragment.

Definition at line 225 of file NodeDefinition.cpp.

{
  return nsnull;
}
void NodeDefinition::appendData ( const PRUnichar aData,
int  aLength 
) [inline, inherited]

Definition at line 282 of file dom.h.

    {
      nodeValue.Append(aData, aLength);
    };
PRInt32 NodeDefinition::compareDocumentPosition ( Node aOther) [virtual, inherited]

Implements Node.

Definition at line 409 of file NodeDefinition.cpp.

{
  OrderInfo* myOrder = getOrderInfo();
  OrderInfo* otherOrder = ((NodeDefinition*)aOther)->getOrderInfo();
  if (!myOrder || !otherOrder)
      return -1;

  if (myOrder->mRoot == otherOrder->mRoot) {
    int c = 0;
    while (c < myOrder->mSize && c < otherOrder->mSize) {
      if (myOrder->mOrder[c] < otherOrder->mOrder[c])
        return -1;
      if (myOrder->mOrder[c] > otherOrder->mOrder[c])
        return 1;
      ++c;
    }
    if (c < myOrder->mSize)
      return 1;
    if (c < otherOrder->mSize)
      return -1;
    return 0;
  }

  if (myOrder->mRoot < otherOrder->mRoot)
    return -1;

  return 1;
}

Here is the call graph for this function:

void NodeDefinition::DeleteChildren ( ) [protected, inherited]

Definition at line 130 of file NodeDefinition.cpp.

{
  NodeDefinition* pCurrent = firstChild;
  NodeDefinition* pDestroyer;

  while (pCurrent)
    {
      pDestroyer = pCurrent;
      pCurrent = pCurrent->nextSibling;
      delete pDestroyer;
    }

  length = 0;
  firstChild = nsnull;
  lastChild = nsnull;
}

Here is the caller graph for this function:

NamedNodeMap * NodeDefinition::getAttributes ( ) [virtual, inherited]

Implements Node.

Reimplemented in Element.

Definition at line 189 of file NodeDefinition.cpp.

{
  return 0;
}
nsresult NodeDefinition::getBaseURI ( nsAString &  aURI) [virtual, inherited]

Implements Node.

Reimplemented in Document.

Definition at line 367 of file NodeDefinition.cpp.

{
  Node* node = this;
  nsStringArray baseUrls;
  nsAutoString url;

  while (node) {
    switch (node->getNodeType()) {
      case Node::ELEMENT_NODE :
        if (((Element*)node)->getAttr(txXMLAtoms::base, kNameSpaceID_XML,
                                      url))
          baseUrls.AppendString(url);
        break;

      case Node::DOCUMENT_NODE :
        node->getBaseURI(url);
        baseUrls.AppendString(url);
        break;
    
      default:
        break;
    }
    node = node->getXPathParent();
  }

  PRInt32 count = baseUrls.Count();
  if (count) {
    baseUrls.StringAt(--count, aURI);

    while (count > 0) {
      nsAutoString dest;
      URIUtils::resolveHref(*baseUrls[--count], aURI, dest);
      aURI = dest;
    }
  }
  
  return NS_OK;
} // getBaseURI

Here is the call graph for this function:

Here is the caller graph for this function:

Node * NodeDefinition::getFirstChild ( ) const [virtual, inherited]

Implements Node.

Definition at line 169 of file NodeDefinition.cpp.

{
  return firstChild;
}

Here is the caller graph for this function:

Node * NodeDefinition::getLastChild ( ) const [virtual, inherited]

Implements Node.

Definition at line 174 of file NodeDefinition.cpp.

{
  return lastChild;
}
PRUint32 NodeDefinition::getLength ( ) [virtual, inherited]

Implements NodeList.

Definition at line 215 of file NodeDefinition.cpp.

{
  return length;
}
MBool ProcessingInstruction::getLocalName ( nsIAtom **  aLocalName) [virtual]

Reimplemented from NodeDefinition.

Definition at line 75 of file ProcessingInstruction.cpp.

{
  if (!aLocalName)
    return MB_FALSE;
  *aLocalName = mLocalName;
  NS_ADDREF(*aLocalName);
  return MB_TRUE;
}

Here is the call graph for this function:

PRInt32 NodeDefinition::getNamespaceID ( ) [virtual, inherited]

Implements Node.

Reimplemented in Attr, and Element.

Definition at line 299 of file NodeDefinition.cpp.

{
  return kNameSpaceID_None;
}

Here is the caller graph for this function:

nsresult NodeDefinition::getNamespaceURI ( nsAString &  aNSURI) [virtual, inherited]

Implements Node.

Definition at line 293 of file NodeDefinition.cpp.

Here is the call graph for this function:

Node * NodeDefinition::getNextSibling ( ) const [virtual, inherited]

Implements Node.

Definition at line 184 of file NodeDefinition.cpp.

{
  return nextSibling;
}
nsresult NodeDefinition::getNodeName ( nsAString &  aName) const [virtual, inherited]

Implements Node.

Definition at line 147 of file NodeDefinition.cpp.

{
  aName = nodeName;
  return NS_OK;
}
unsigned short NodeDefinition::getNodeType ( ) const [virtual, inherited]

Implements Node.

Definition at line 159 of file NodeDefinition.cpp.

{
  return nodeType;
}

Here is the caller graph for this function:

nsresult NodeDefinition::getNodeValue ( nsAString &  aValue) [virtual, inherited]

Implements Node.

Reimplemented in Attr.

Definition at line 153 of file NodeDefinition.cpp.

{
  aValue = nodeValue;
  return NS_OK;
}
Document * NodeDefinition::getOwnerDocument ( ) const [virtual, inherited]

Implements Node.

Definition at line 194 of file NodeDefinition.cpp.

{
  return ownerDocument;
}

Here is the caller graph for this function:

Node * NodeDefinition::getParentNode ( ) const [virtual, inherited]

Implements Node.

Definition at line 164 of file NodeDefinition.cpp.

{
  return parentNode;
}

Here is the caller graph for this function:

Node * NodeDefinition::getPreviousSibling ( ) const [virtual, inherited]

Implements Node.

Definition at line 179 of file NodeDefinition.cpp.

{
  return previousSibling;
}
Node * NodeDefinition::getXPathParent ( ) [virtual, inherited]

Implements Node.

Reimplemented in Attr.

Definition at line 356 of file NodeDefinition.cpp.

{
  return parentNode;
}

Here is the caller graph for this function:

MBool NodeDefinition::hasChildNodes ( ) const [virtual, inherited]

Implements Node.

Definition at line 277 of file NodeDefinition.cpp.

{
  if (firstChild)
    return MB_TRUE;
  else
    return MB_FALSE;
}
NodeDefinition * NodeDefinition::implAppendChild ( NodeDefinition newChild) [protected, inherited]

Definition at line 230 of file NodeDefinition.cpp.

{
  // The new child should not be a child of any other node
  if (!newChild->previousSibling && !newChild->nextSibling &&
      !newChild->parentNode)
    {
      newChild->previousSibling = lastChild;

      if (lastChild)
        lastChild->nextSibling = newChild;

      lastChild = newChild;

      newChild->parentNode = this;

      if (!newChild->previousSibling)
        firstChild = newChild;

      ++length;

      return newChild;
    }

  return nsnull;
}

Here is the caller graph for this function:

NodeDefinition * NodeDefinition::implRemoveChild ( NodeDefinition oldChild) [protected, inherited]

Definition at line 256 of file NodeDefinition.cpp.

{
  if (oldChild != firstChild)
    oldChild->previousSibling->nextSibling = oldChild->nextSibling;
  else
    firstChild = oldChild->nextSibling;

  if (oldChild != lastChild)
    oldChild->nextSibling->previousSibling = oldChild->previousSibling;
  else
    lastChild = oldChild->previousSibling;

  oldChild->nextSibling = nsnull;
  oldChild->previousSibling = nsnull;
  oldChild->parentNode = nsnull;

  --length;

  return oldChild;
}

Here is the caller graph for this function:

Node * NodeDefinition::item ( PRUint32  index) [virtual, inherited]

Implements NodeList.

Definition at line 199 of file NodeDefinition.cpp.

{
  PRUint32 selectLoop;
  NodeDefinition* pSelectNode = firstChild;

  if (index < length)
    {
      for (selectLoop=0;selectLoop<index;selectLoop++)
        pSelectNode = pSelectNode->nextSibling;

      return pSelectNode;
    }

  return nsnull;
}

Here is the caller graph for this function:

PRInt32 NodeDefinition::lookupNamespaceID ( nsIAtom aPrefix) [virtual, inherited]

Implements Node.

Definition at line 310 of file NodeDefinition.cpp.

{
  // this is http://www.w3.org/2000/xmlns/,
  // ID = kNameSpaceID_XMLNS, see txStandaloneNamespaceManager::Init
  if (aPrefix == txXMLAtoms::xmlns)
    return kNameSpaceID_XMLNS; 
  // this is http://www.w3.org/XML/1998/namespace,
  // ID = kNameSpaceID_XML, see txStandaloneNamespaceManager::Init
  if (aPrefix == txXMLAtoms::xml)
    return kNameSpaceID_XML; 

  Node* node = this;
  if (node->getNodeType() != Node::ELEMENT_NODE)
    node = node->getXPathParent();

  nsAutoString name(NS_LITERAL_STRING("xmlns:"));
  if (aPrefix && (aPrefix != txXMLAtoms::_empty)) {
      //  We have a prefix, search for xmlns:prefix attributes.
      nsAutoString prefixString;
      aPrefix->ToString(prefixString);
      name.Append(prefixString);
  }
  else {
      // No prefix, look up the default namespace by searching for xmlns
      // attributes. Remove the trailing :, set length to 5 (xmlns).
      name.Truncate(5);
  }
  Attr* xmlns;
  while (node && node->getNodeType() == Node::ELEMENT_NODE) {
    if ((xmlns = ((Element*)node)->getAttributeNode(name))) {
      /*
       * xmlns:foo = "" makes "" a valid URI, so get that.
       * xmlns = "" resolves to 0 (null Namespace) (caught above)
       * in Element::getNamespaceID()
       */
      nsAutoString nsURI;
      xmlns->getNodeValue(nsURI);
      return txStandaloneNamespaceManager::getNamespaceID(nsURI);
    }
    node = node->getXPathParent();
  }
  if (!aPrefix || (aPrefix == txXMLAtoms::_empty))
      return kNameSpaceID_None;
  return kNameSpaceID_Unknown;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NodeDefinition::setNodeValue ( const nsAString &  nodeValue) [virtual, inherited]

Implements Node.

Reimplemented in Attr.

Definition at line 220 of file NodeDefinition.cpp.

{
  nodeValue = newNodeValue;
}

Friends And Related Function Documentation

friend class Document [friend]

Reimplemented from NodeDefinition.

Definition at line 544 of file dom.h.

friend class txXPathNodeUtils [friend, inherited]

Definition at line 290 of file dom.h.

friend class txXPathTreeWalker [friend, inherited]

Definition at line 289 of file dom.h.


Member Data Documentation

unsigned Node::count [inherited]

Definition at line 112 of file trace.cpp.

char* Node::function [inherited]

Definition at line 110 of file trace.cpp.

unsigned Node::hits [inherited]

Definition at line 113 of file trace.cpp.

PRUint32 NodeList::length [protected, inherited]

Definition at line 154 of file dom.h.

Definition at line 548 of file dom.h.

Node* Node::next [inherited]

Definition at line 114 of file trace.cpp.

nsString NodeDefinition::nodeName [protected, inherited]

Definition at line 299 of file dom.h.

nsString NodeDefinition::nodeValue [protected, inherited]

Definition at line 300 of file dom.h.


The documentation for this class was generated from the following files: