|
@@ -37,6 +37,8 @@ procedure WriteXML(Element: TDOMElement; var AStream: TStream);
|
|
|
|
|
|
implementation
|
|
implementation
|
|
|
|
|
|
|
|
+uses SysUtils;
|
|
|
|
+
|
|
// -------------------------------------------------------------------
|
|
// -------------------------------------------------------------------
|
|
// Writers for the different node types
|
|
// Writers for the different node types
|
|
// -------------------------------------------------------------------
|
|
// -------------------------------------------------------------------
|
|
@@ -270,8 +272,15 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure WritePI(node: TDOMNode);
|
|
procedure WritePI(node: TDOMNode);
|
|
|
|
+var
|
|
|
|
+ s: String;
|
|
begin
|
|
begin
|
|
- WriteLn('WritePI');
|
|
|
|
|
|
+ s := '<!' + TDOMProcessingInstruction(node).Target + ' ' +
|
|
|
|
+ TDOMProcessingInstruction(node).Data + '>';
|
|
|
|
+ if InsideTextNode then
|
|
|
|
+ wrt(s)
|
|
|
|
+ else
|
|
|
|
+ wrtln(Indent + s);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure WriteComment(node: TDOMNode);
|
|
procedure WriteComment(node: TDOMNode);
|
|
@@ -314,15 +323,20 @@ var
|
|
begin
|
|
begin
|
|
InitWriter;
|
|
InitWriter;
|
|
wrt('<?xml version="');
|
|
wrt('<?xml version="');
|
|
- if doc.XMLVersion <> '' then
|
|
|
|
|
|
+ if Length(doc.XMLVersion) > 0 then
|
|
wrt(doc.XMLVersion)
|
|
wrt(doc.XMLVersion)
|
|
else
|
|
else
|
|
wrt('1.0');
|
|
wrt('1.0');
|
|
wrt('"');
|
|
wrt('"');
|
|
- if doc.Encoding <> '' then
|
|
|
|
|
|
+ if Length(doc.Encoding) > 0 then
|
|
wrt(' encoding="' + doc.Encoding + '"');
|
|
wrt(' encoding="' + doc.Encoding + '"');
|
|
wrtln('?>');
|
|
wrtln('?>');
|
|
|
|
|
|
|
|
+ if Length(doc.StylesheetType) > 0 then
|
|
|
|
+ // !!!: Can't handle with HRefs which contain special chars (" and so on)
|
|
|
|
+ wrtln(Format('<?xml-stylesheet type="%s" href="%s"?>',
|
|
|
|
+ [doc.StylesheetType, doc.StylesheetHRef]));
|
|
|
|
+
|
|
indent := '';
|
|
indent := '';
|
|
|
|
|
|
child := doc.FirstChild;
|
|
child := doc.FirstChild;
|
|
@@ -398,7 +412,10 @@ end.
|
|
|
|
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.4 2000-07-29 14:52:25 sg
|
|
|
|
|
|
+ Revision 1.5 2000-10-03 20:16:31 sg
|
|
|
|
+ * Now writes Processing Instructions and a stylesheet link, if set
|
|
|
|
+
|
|
|
|
+ Revision 1.4 2000/07/29 14:52:25 sg
|
|
* Modified the copyright notice to remove ambiguities
|
|
* Modified the copyright notice to remove ambiguities
|
|
|
|
|
|
Revision 1.3 2000/07/25 09:20:08 sg
|
|
Revision 1.3 2000/07/25 09:20:08 sg
|