2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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
|
|
|
|
|
|
|
/*
|
|
|
|
* nsIContentSerializer implementation that can be used with an
|
|
|
|
* nsIDocumentEncoder to convert an XML DOM to an XML string that
|
|
|
|
* could be parsed into more or less the original DOM.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsXMLContentSerializer_h__
|
|
|
|
#define nsXMLContentSerializer_h__
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIContentSerializer.h"
|
|
|
|
#include "nsISupportsUtils.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2009-03-20 01:15:35 -07:00
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsString.h"
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
#define kIndentStr NS_LITERAL_STRING(" ")
|
|
|
|
#define kEndTag NS_LITERAL_STRING("</")
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsIAtom;
|
2013-03-21 17:05:20 -07:00
|
|
|
class nsIDOMNode;
|
|
|
|
class nsINode;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsXMLContentSerializer : public nsIContentSerializer {
|
|
|
|
public:
|
|
|
|
nsXMLContentSerializer();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD Init(uint32_t flags, uint32_t aWrapColumn,
|
2011-09-28 23:19:26 -07:00
|
|
|
const char* aCharSet, bool aIsCopying,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aRewriteEncodingDeclaration) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD AppendText(nsIContent* aText, int32_t aStartOffset,
|
2013-05-29 13:43:41 -07:00
|
|
|
int32_t aEndOffset, nsAString& aStr) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-05-04 06:19:54 -07:00
|
|
|
NS_IMETHOD AppendCDATASection(nsIContent* aCDATASection,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aStartOffset, int32_t aEndOffset,
|
2013-05-29 13:43:41 -07:00
|
|
|
nsAString& aStr) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-05-04 06:19:54 -07:00
|
|
|
NS_IMETHOD AppendProcessingInstruction(nsIContent* aPI,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset,
|
2013-05-29 13:43:41 -07:00
|
|
|
nsAString& aStr) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD AppendComment(nsIContent* aComment, int32_t aStartOffset,
|
2013-05-29 13:43:41 -07:00
|
|
|
int32_t aEndOffset, nsAString& aStr) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-05-04 06:19:54 -07:00
|
|
|
NS_IMETHOD AppendDoctype(nsIContent *aDoctype,
|
2013-05-29 13:43:41 -07:00
|
|
|
nsAString& aStr) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-10-22 14:25:22 -07:00
|
|
|
NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement,
|
|
|
|
mozilla::dom::Element* aOriginalElement,
|
2013-05-29 13:43:41 -07:00
|
|
|
nsAString& aStr) MOZ_OVERRIDE;
|
2010-10-22 14:25:22 -07:00
|
|
|
|
|
|
|
NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement,
|
2013-05-29 13:43:41 -07:00
|
|
|
nsAString& aStr) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
NS_IMETHOD Flush(nsAString& aStr) MOZ_OVERRIDE { return NS_OK; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-05-04 06:19:54 -07:00
|
|
|
NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument,
|
2013-05-29 13:43:41 -07:00
|
|
|
nsAString& aStr) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
2014-06-24 19:09:15 -07:00
|
|
|
virtual ~nsXMLContentSerializer();
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
/**
|
2014-01-04 07:02:17 -08:00
|
|
|
* Appends a char16_t character and increments the column position
|
2009-04-25 02:00:14 -07:00
|
|
|
*/
|
2014-01-04 07:02:17 -08:00
|
|
|
void AppendToString(const char16_t aChar,
|
2010-07-19 03:35:02 -07:00
|
|
|
nsAString& aOutputStr);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Appends a nsAString string and increments the column position
|
|
|
|
*/
|
2010-07-19 03:35:02 -07:00
|
|
|
void AppendToString(const nsAString& aStr,
|
|
|
|
nsAString& aOutputStr);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Appends a string by replacing all line-endings
|
|
|
|
* by mLineBreak, except in the case of raw output.
|
|
|
|
* It increments the column position.
|
|
|
|
*/
|
2010-07-19 03:35:02 -07:00
|
|
|
void AppendToStringConvertLF(const nsAString& aStr,
|
|
|
|
nsAString& aOutputStr);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Appends a string by wrapping it when necessary.
|
|
|
|
* It updates the column position.
|
|
|
|
*/
|
2010-07-19 03:35:02 -07:00
|
|
|
void AppendToStringWrapped(const nsASingleFragmentString& aStr,
|
|
|
|
nsAString& aOutputStr);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Appends a string by formating and wrapping it when necessary
|
|
|
|
* It updates the column position.
|
|
|
|
*/
|
2010-07-19 03:35:02 -07:00
|
|
|
void AppendToStringFormatedWrapped(const nsASingleFragmentString& aStr,
|
|
|
|
nsAString& aOutputStr);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// used by AppendToStringWrapped
|
|
|
|
void AppendWrapped_WhitespaceSequence(
|
|
|
|
nsASingleFragmentString::const_char_iterator &aPos,
|
|
|
|
const nsASingleFragmentString::const_char_iterator aEnd,
|
|
|
|
const nsASingleFragmentString::const_char_iterator aSequenceStart,
|
|
|
|
nsAString &aOutputStr);
|
|
|
|
|
|
|
|
// used by AppendToStringFormatedWrapped
|
|
|
|
void AppendFormatedWrapped_WhitespaceSequence(
|
|
|
|
nsASingleFragmentString::const_char_iterator &aPos,
|
|
|
|
const nsASingleFragmentString::const_char_iterator aEnd,
|
|
|
|
const nsASingleFragmentString::const_char_iterator aSequenceStart,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool &aMayIgnoreStartOfLineWhitespaceSequence,
|
2009-04-25 02:00:14 -07:00
|
|
|
nsAString &aOutputStr);
|
|
|
|
|
|
|
|
// used by AppendToStringWrapped and AppendToStringFormatedWrapped
|
|
|
|
void AppendWrapped_NonWhitespaceSequence(
|
|
|
|
nsASingleFragmentString::const_char_iterator &aPos,
|
|
|
|
const nsASingleFragmentString::const_char_iterator aEnd,
|
|
|
|
const nsASingleFragmentString::const_char_iterator aSequenceStart,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool &aMayIgnoreStartOfLineWhitespaceSequence,
|
|
|
|
bool &aSequenceStartAfterAWhiteSpace,
|
2009-04-25 02:00:14 -07:00
|
|
|
nsAString &aOutputStr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* add mLineBreak to the string
|
|
|
|
* It updates the column position and other flags.
|
|
|
|
*/
|
2010-07-19 03:35:02 -07:00
|
|
|
void AppendNewLineToString(nsAString& aOutputStr);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Appends a string by translating entities
|
|
|
|
* It doesn't increment the column position
|
|
|
|
*/
|
|
|
|
virtual void AppendAndTranslateEntities(const nsAString& aStr,
|
|
|
|
nsAString& aOutputStr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* retrieve the text content of the node and append it to the given string
|
|
|
|
* It doesn't increment the column position
|
|
|
|
*/
|
2010-05-04 06:19:54 -07:00
|
|
|
nsresult AppendTextData(nsIContent* aNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAString& aStr,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aTranslateEntities);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult PushNameSpaceDecl(const nsAString& aPrefix,
|
|
|
|
const nsAString& aURI,
|
2010-05-04 06:19:54 -07:00
|
|
|
nsIContent* aOwner);
|
|
|
|
void PopNameSpaceDeclsFor(nsIContent* aOwner);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The problem that ConfirmPrefix fixes is that anyone can insert nodes
|
|
|
|
* through the DOM that have a namespace URI and a random or empty or
|
|
|
|
* previously existing prefix that's totally unrelated to the prefixes
|
|
|
|
* declared at that point through xmlns attributes. So what ConfirmPrefix
|
|
|
|
* does is ensure that we can map aPrefix to the namespace URI aURI (for
|
|
|
|
* example, that the prefix is not already mapped to some other namespace).
|
|
|
|
* aPrefix will be adjusted, if necessary, so the value of the prefix
|
|
|
|
* _after_ this call is what should be serialized.
|
|
|
|
* @param aPrefix the prefix that may need adjusting
|
|
|
|
* @param aURI the namespace URI we want aPrefix to point to
|
|
|
|
* @param aElement the element we're working with (needed for proper default
|
|
|
|
* namespace handling)
|
2011-10-17 07:59:28 -07:00
|
|
|
* @param aIsAttribute true if we're confirming a prefix for an attribute.
|
|
|
|
* @return true if we need to push the (prefix, uri) pair on the namespace
|
2007-03-22 10:30:00 -07:00
|
|
|
* stack (note that this can happen even if the prefix is
|
|
|
|
* empty).
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ConfirmPrefix(nsAString& aPrefix,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsAString& aURI,
|
2010-05-04 06:19:54 -07:00
|
|
|
nsIContent* aElement,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aIsAttribute);
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* GenerateNewPrefix generates a new prefix and writes it to aPrefix
|
|
|
|
*/
|
|
|
|
void GenerateNewPrefix(nsAString& aPrefix);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t ScanNamespaceDeclarations(nsIContent* aContent,
|
2010-05-04 06:19:54 -07:00
|
|
|
nsIContent *aOriginalElement,
|
2009-04-25 02:00:14 -07:00
|
|
|
const nsAString& aTagNamespaceURI);
|
|
|
|
|
|
|
|
virtual void SerializeAttributes(nsIContent* aContent,
|
2010-05-04 06:19:54 -07:00
|
|
|
nsIContent *aOriginalElement,
|
2009-04-25 02:00:14 -07:00
|
|
|
nsAString& aTagPrefix,
|
|
|
|
const nsAString& aTagNamespaceURI,
|
|
|
|
nsIAtom* aTagName,
|
|
|
|
nsAString& aStr,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aSkipAttr,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aAddNSAttr);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
void SerializeAttr(const nsAString& aPrefix,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aValue,
|
|
|
|
nsAString& aStr,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aDoEscapeEntities);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsJavaScript(nsIContent * aContent,
|
2010-07-19 03:35:02 -07:00
|
|
|
nsIAtom* aAttrNameAtom,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aAttrNamespaceID,
|
2010-07-19 03:35:02 -07:00
|
|
|
const nsAString& aValueString);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This method can be redefined to check if the element can be serialized.
|
|
|
|
* It is called when the serialization of the start tag is asked
|
|
|
|
* (AppendElementStart)
|
|
|
|
* In this method you can also force the formating
|
2011-10-17 07:59:28 -07:00
|
|
|
* by setting aForceFormat to true.
|
|
|
|
* @return boolean true if the element can be output
|
2009-04-25 02:00:14 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool CheckElementStart(nsIContent * aContent,
|
|
|
|
bool & aForceFormat,
|
2009-04-25 02:00:14 -07:00
|
|
|
nsAString& aStr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* this method is responsible to finish the start tag,
|
|
|
|
* in particulary to append the "greater than" sign
|
|
|
|
*/
|
2010-05-04 06:19:54 -07:00
|
|
|
virtual void AppendEndOfElementStart(nsIContent *aOriginalElement,
|
2009-04-25 02:00:14 -07:00
|
|
|
nsIAtom * aName,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aNamespaceID,
|
2009-04-25 02:00:14 -07:00
|
|
|
nsAString& aStr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method can be redefine to serialize additional things just after
|
|
|
|
* after the serialization ot the start tag.
|
|
|
|
* (called at the end of AppendElementStart)
|
|
|
|
*/
|
|
|
|
virtual void AfterElementStart(nsIContent * aContent,
|
2010-05-04 06:19:54 -07:00
|
|
|
nsIContent *aOriginalElement,
|
2009-04-25 02:00:14 -07:00
|
|
|
nsAString& aStr) { };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method can be redefined to check if the element can be serialized.
|
|
|
|
* It is called when the serialization of the end tag is asked
|
|
|
|
* (AppendElementEnd)
|
|
|
|
* In this method you can also force the formating
|
2011-10-17 07:59:28 -07:00
|
|
|
* by setting aForceFormat to true.
|
|
|
|
* @return boolean true if the element can be output
|
2009-04-25 02:00:14 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool CheckElementEnd(nsIContent * aContent,
|
|
|
|
bool & aForceFormat,
|
2009-04-25 02:00:14 -07:00
|
|
|
nsAString& aStr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method can be redefine to serialize additional things just after
|
|
|
|
* after the serialization ot the end tag.
|
|
|
|
* (called at the end of AppendElementStart)
|
|
|
|
*/
|
|
|
|
virtual void AfterElementEnd(nsIContent * aContent,
|
|
|
|
nsAString& aStr) { };
|
|
|
|
|
|
|
|
/**
|
2011-10-17 07:59:28 -07:00
|
|
|
* Returns true if a line break should be inserted before an element open tag
|
2009-04-25 02:00:14 -07:00
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool LineBreakBeforeOpen(int32_t aNamespaceID, nsIAtom* aName);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
/**
|
2011-10-17 07:59:28 -07:00
|
|
|
* Returns true if a line break should be inserted after an element open tag
|
2009-04-25 02:00:14 -07:00
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool LineBreakAfterOpen(int32_t aNamespaceID, nsIAtom* aName);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
/**
|
2011-10-17 07:59:28 -07:00
|
|
|
* Returns true if a line break should be inserted after an element close tag
|
2009-04-25 02:00:14 -07:00
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool LineBreakBeforeClose(int32_t aNamespaceID, nsIAtom* aName);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
/**
|
2011-10-17 07:59:28 -07:00
|
|
|
* Returns true if a line break should be inserted after an element close tag
|
2009-04-25 02:00:14 -07:00
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool LineBreakAfterClose(int32_t aNamespaceID, nsIAtom* aName);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* add intendation. Call only in the case of formating and if the current
|
|
|
|
* position is at 0. It updates the column position.
|
|
|
|
*/
|
|
|
|
void AppendIndentation(nsAString& aStr);
|
2010-07-19 03:35:02 -07:00
|
|
|
void IncrIndentation(nsIAtom* aName);
|
|
|
|
void DecrIndentation(nsIAtom* aName);
|
2008-10-21 13:30:09 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Functions to check for newlines that needs to be added between nodes in
|
2009-04-25 02:00:14 -07:00
|
|
|
// the root of a document. See mAddNewlineForRootNode
|
|
|
|
void MaybeAddNewlineForRootNode(nsAString& aStr);
|
2010-05-04 06:19:54 -07:00
|
|
|
void MaybeFlagNewlineForRootNode(nsINode* aNode);
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// Functions to check if we enter in or leave from a preformated content
|
|
|
|
virtual void MaybeEnterInPreContent(nsIContent* aNode);
|
|
|
|
virtual void MaybeLeaveFromPreContent(nsIContent* aNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mPrefixIndex;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
2009-03-26 01:29:49 -07:00
|
|
|
struct NameSpaceDecl {
|
|
|
|
nsString mPrefix;
|
|
|
|
nsString mURI;
|
2010-05-04 06:19:54 -07:00
|
|
|
nsIContent* mOwner;
|
2009-03-26 01:29:49 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
nsTArray<NameSpaceDecl> mNameSpaceStack;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-10-21 13:30:09 -07:00
|
|
|
// nsIDocumentEncoder flags
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mFlags;
|
2008-10-21 13:30:09 -07:00
|
|
|
|
|
|
|
// characters to use for line break
|
|
|
|
nsString mLineBreak;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// The charset that was passed to Init()
|
|
|
|
nsCString mCharset;
|
|
|
|
|
2009-04-25 02:00:14 -07:00
|
|
|
// current column position on the current line
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mColPos;
|
2008-10-21 13:30:09 -07:00
|
|
|
|
2009-04-25 02:00:14 -07:00
|
|
|
// true = pretty formating should be done (OutputFormated flag)
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mDoFormat;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// true = no formatting,(OutputRaw flag)
|
|
|
|
// no newline convertion and no rewrap long lines even if OutputWrap is set.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mDoRaw;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// true = wrapping should be done (OutputWrap flag)
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mDoWrap;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// number of maximum column in a line, in the wrap mode
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mMaxColumn;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// current indent value
|
|
|
|
nsString mIndent;
|
|
|
|
|
|
|
|
// this is the indentation level after the indentation reached
|
|
|
|
// the maximum length of indentation
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mIndentOverflow;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// says if the indentation has been already added on the current line
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsIndentationAddedOnCurrentLine;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// the string which is currently added is in an attribute
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mInAttribute;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// true = a newline character should be added. It's only
|
|
|
|
// useful when serializing root nodes. see MaybeAddNewlineForRootNode and
|
|
|
|
// MaybeFlagNewlineForRootNode
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mAddNewlineForRootNode;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// Indicates that a space will be added if and only if content is
|
|
|
|
// continued on the same line while serializing source. Otherwise,
|
|
|
|
// the newline character acts as the whitespace and no space is needed.
|
|
|
|
// used when mDoFormat = true
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mAddSpace;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
|
|
|
// says that if the next string to add contains a newline character at the
|
|
|
|
// begining, then this newline character should be ignored, because a
|
|
|
|
// such character has already been added into the output string
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mMayIgnoreLineBreakSequence;
|
2009-04-25 02:00:14 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mBodyOnly;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mInBody;
|
2010-07-19 03:35:02 -07:00
|
|
|
|
2009-04-25 02:00:14 -07:00
|
|
|
// number of nested elements which have preformated content
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mPreLevel;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
NS_NewXMLContentSerializer(nsIContentSerializer** aSerializer);
|
|
|
|
|
|
|
|
#endif
|