Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
nsXMLDocument.cpp File Reference
#include "nsXMLDocument.h"
#include "nsParserCIID.h"
#include "nsIParser.h"
#include "nsIXMLContent.h"
#include "nsIXMLContentSink.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIContent.h"
#include "nsIContentViewerContainer.h"
#include "nsIContentViewer.h"
#include "nsIDocShell.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIDocumentLoader.h"
#include "nsHTMLParts.h"
#include "nsHTMLStyleSheet.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsIComponentManager.h"
#include "nsIDOMComment.h"
#include "nsIDOMElement.h"
#include "nsIDOMText.h"
#include "nsIBaseWindow.h"
#include "nsIDOMWindow.h"
#include "nsIDOMDocumentType.h"
#include "nsINameSpaceManager.h"
#include "nsCOMPtr.h"
#include "nsXPIDLString.h"
#include "nsIHttpChannel.h"
#include "nsIURI.h"
#include "nsIServiceManager.h"
#include "nsICharsetAlias.h"
#include "nsNetUtil.h"
#include "nsDOMError.h"
#include "nsIScriptSecurityManager.h"
#include "nsIPrincipal.h"
#include "nsLayoutCID.h"
#include "nsDOMAttribute.h"
#include "nsGUIEvent.h"
#include "nsIFIXptr.h"
#include "nsIXPointer.h"
#include "nsCExternalHandlerService.h"
#include "nsMimeTypes.h"
#include "nsIEventListenerManager.h"
#include "nsContentUtils.h"
#include "nsJSUtils.h"
#include "nsCRT.h"
#include "nsIWindowWatcher.h"
#include "nsIAuthPrompt.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIJSContextStack.h"
#include "nsNodeInfoManager.h"
#include "nsContentCreatorFunctions.h"
#include "nsHTMLAtoms.h"

Go to the source code of this file.

Functions

static NS_DEFINE_CID (kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID)
static NS_DEFINE_CID (kCharsetAliasCID, NS_CHARSETALIAS_CID)
nsresult NS_NewDOMDocument (nsIDOMDocument **aInstancePtrResult, const nsAString &aNamespaceURI, const nsAString &aQualifiedName, nsIDOMDocumentType *aDoctype, nsIURI *aBaseURI)
nsresult NS_NewDOMDocument_MOZILLA_1_8_BRANCH (nsIDOMDocument **aInstancePtrResult, const nsAString &aNamespaceURI, const nsAString &aQualifiedName, nsIDOMDocumentType *aDoctype, nsIURI *aBaseURI, nsIScriptGlobalObject *aScriptHandler, PRBool aLoadedAsData)
nsresult NS_NewXMLDocument (nsIDocument **aInstancePtrResult)
nsIContentMatchElementId (nsIContent *aContent, const nsACString &aUTF8Id, const nsAString &aId)

Variables

static const char kLoadAsData [] = "loadAsData"

Function Documentation

nsIContent* MatchElementId ( nsIContent aContent,
const nsACString &  aUTF8Id,
const nsAString &  aId 
)

Definition at line 739 of file nsXMLDocument.cpp.

{
  if (aContent->IsContentOfType(nsIContent::eHTML)) {
    if (aContent->HasAttr(kNameSpaceID_None, nsHTMLAtoms::id)) {
      nsAutoString value;
      aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::id, value);

      if (aId.Equals(value)) {
        return aContent;
      }
    }
  }
  else if (aContent->IsContentOfType(nsIContent::eELEMENT)) {
    nsCOMPtr<nsIXMLContent> xmlContent = do_QueryInterface(aContent);    

    if (xmlContent) {
      nsIAtom* value = xmlContent->GetID();
      if (value && value->EqualsUTF8(aUTF8Id)) {
        return aContent;
      }
    }
  }
  
  nsIContent *result = nsnull;
  PRUint32 i, count = aContent->GetChildCount();

  for (i = 0; i < count && result == nsnull; i++) {
    result = MatchElementId(aContent->GetChildAt(i), aUTF8Id, aId);
  }  

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kCharsetAliasCID  ,
NS_CHARSETALIAS_CID   
) [static]
nsresult NS_NewDOMDocument ( nsIDOMDocument **  aInstancePtrResult,
const nsAString &  aNamespaceURI,
const nsAString &  aQualifiedName,
nsIDOMDocumentType aDoctype,
nsIURI aBaseURI 
)

Definition at line 109 of file nsXMLDocument.cpp.

{
  return NS_NewDOMDocument_MOZILLA_1_8_BRANCH(aInstancePtrResult,
                                              aNamespaceURI,
                                              aQualifiedName,
                                              aDoctype,
                                              aBaseURI,
                                              nsnull,
                                              PR_FALSE);
}

Here is the call graph for this function:

nsresult NS_NewDOMDocument_MOZILLA_1_8_BRANCH ( nsIDOMDocument **  aInstancePtrResult,
const nsAString &  aNamespaceURI,
const nsAString &  aQualifiedName,
nsIDOMDocumentType aDoctype,
nsIURI aBaseURI,
nsIScriptGlobalObject aScriptHandler,
PRBool  aLoadedAsData 
)

Definition at line 125 of file nsXMLDocument.cpp.

{
  nsresult rv;

  *aInstancePtrResult = nsnull;

  nsRefPtr<nsXMLDocument> doc = new nsXMLDocument();
  if (!doc)
    return NS_ERROR_OUT_OF_MEMORY;

  rv = doc->Init();

  if (NS_FAILED(rv)) {
    return rv;
  }

  doc->SetScriptHandlingObject(aScriptHandler);
  // This is not used on 1.8 branch because of
  // https://bugzilla.mozilla.org/show_bug.cgi?id=414856
  // doc->SetLoadedAsData(aLoadedAsData);
  doc->nsIDocument::SetDocumentURI(aBaseURI);
  doc->SetBaseURI(aBaseURI);

  if (aDoctype) {
    nsCOMPtr<nsIDOMNode> tmpNode;
    rv = doc->AppendChild(aDoctype, getter_AddRefs(tmpNode));
    NS_ENSURE_SUCCESS(rv, rv);
  }
  
  if (!aQualifiedName.IsEmpty()) {
    nsCOMPtr<nsIDOMElement> root;
    rv = doc->CreateElementNS(aNamespaceURI, aQualifiedName,
                              getter_AddRefs(root));
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsIDOMNode> tmpNode;

    rv = doc->AppendChild(root, getter_AddRefs(tmpNode));
    NS_ENSURE_SUCCESS(rv, rv);
  }

  *aInstancePtrResult = doc;
  NS_ADDREF(*aInstancePtrResult);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewXMLDocument ( nsIDocument **  aInstancePtrResult)

Definition at line 180 of file nsXMLDocument.cpp.

{
  nsXMLDocument* doc = new nsXMLDocument();
  NS_ENSURE_TRUE(doc, NS_ERROR_OUT_OF_MEMORY);

  NS_ADDREF(doc);
  nsresult rv = doc->Init();

  if (NS_FAILED(rv)) {
    NS_RELEASE(doc);
  }

  *aInstancePtrResult = doc;

  return rv;
}

Here is the call graph for this function:


Variable Documentation

const char kLoadAsData[] = "loadAsData" [static]

Definition at line 97 of file nsXMLDocument.cpp.