1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Mozilla Public License Version
6
* 1.1 (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/MPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is the TransforMiiX XSLT processor.
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 2001
20
* the Initial Developer. All Rights Reserved.
23
* Peter Van der Beken <peterv@netscape.com>
25
* Alternatively, the contents of this file may be used under the terms of
26
* either the GNU General Public License Version 2 or later (the "GPL"), or
27
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
* in which case the provisions of the GPL or the LGPL are applicable instead
29
* of those above. If you wish to allow use of your version of this file only
30
* under the terms of either the GPL or the LGPL, and not to allow others to
31
* use your version of this file under the terms of the MPL, indicate your
32
* decision by deleting the provisions above and replace them with the notice
33
* and other provisions required by the GPL or the LGPL. If you do not delete
34
* the provisions above, a recipient may use your version of this file under
35
* the terms of any one of the MPL, the GPL or the LGPL.
37
* ***** END LICENSE BLOCK ***** */
39
#ifndef TRANSFRMX_XML_OUTPUT_H
40
#define TRANSFRMX_XML_OUTPUT_H
42
#include "txXMLEventHandler.h"
45
#include "txOutputFormat.h"
53
#define APOSTROPHE '\''
58
#define AMP_ENTITY "&"
59
#define APOS_ENTITY "'"
60
#define GT_ENTITY ">"
61
#define LT_ENTITY "<"
62
#define QUOT_ENTITY """
63
#define HEX_ENTITY "&#"
65
#define CDATA_END "]]>"
66
#define CDATA_START "<![CDATA["
67
#define COMMENT_START "<!--"
68
#define COMMENT_END "-->"
69
#define DOCTYPE_START "<!DOCTYPE "
70
#define DOCTYPE_END ">"
71
#define DOUBLE_QUOTE "\""
73
#define FORWARD_SLASH "/"
74
#define L_ANGLE_BRACKET "<"
77
#define PUBLIC "PUBLIC"
78
#define R_ANGLE_BRACKET ">"
81
#define SYSTEM "SYSTEM"
82
#define XML_DECL "xml version="
83
#define XML_VERSION "1.0"
87
txOutAttr(PRInt32 aNsID, nsIAtom* aLocalName, const nsAString& aValue);
93
class txXMLOutput : public txAOutputXMLEventHandler
96
txXMLOutput(txOutputFormat* aFormat, ostream* aOut);
97
virtual ~txXMLOutput();
99
static const int DEFAULT_INDENT;
101
TX_DECL_TXAXMLEVENTHANDLER
102
TX_DECL_TXAOUTPUTXMLEVENTHANDLER
105
virtual void closeStartTag(MBool aUseEmptyElementShorthand);
106
void printUTF8Char(PRUnichar& ch);
107
void printUTF8Chars(const nsAString& aData);
108
void printWithXMLEntities(const nsAString& aData,
109
MBool aAttribute = MB_FALSE);
112
txOutputFormat mOutputFormat;
113
MBool mUseEmptyElementShorthand;
114
MBool mHaveDocumentElement;
117
MBool mInCDATASection;
118
PRUint32 mIndentLevel;
120
txStack mCDATASections;
123
PRUnichar mBuffer[4];