+ Initial implementation by sebastian Guenther

This commit is contained in:
michael 1999-07-09 21:06:59 +00:00
parent cb1f7d4994
commit fc2432bec3
5 changed files with 618 additions and 0 deletions

46
fcl/tests/cfgtest.pp Normal file
View File

@ -0,0 +1,46 @@
// $Id$
{$MODE objfpc}
{$H+}
program cfgtest;
uses xmlcfg;
var
cfg: TXMLConfig;
begin
WriteLn('Writing a sample XML configuration to "testcfg.xml"...');
cfg := TXMLConfig.Create('testcfg.xml');
cfg.SetValue('cfgtest/MainWindow/Constraints/Width', 600);
cfg.SetValue('cfgtest/MainWindow/Constraints/Height', 400);
cfg.SetValue('cfgtest/MainWindow/Caption', 'TXMLConfig Test');
cfg.SetValue('cfgtest/SomeForm/Presets/Preset1/Name', 'Example');
cfg.SetValue('TipOfTheDay/Disabled', True);
cfg.Free;
WriteLn('Ok; now I''ll try to read back all values...');
cfg := TXMLConfig.Create('testcfg.xml');
if cfg.GetValue('cfgtest/MainWindow/Constraints/Width', 0) <> 600 then
WriteLn('Invalid value: cfgtest/MainWindow/Constraints/Width');
if cfg.GetValue('cfgtest/MainWindow/Constraints/Height', 400) <> 400 then
WriteLn('Invalid value: cfgtest/MainWindow/Constraints/Height');
if cfg.GetValue('cfgtest/MainWindow/Caption', '') <> 'TXMLConfig Test' then
WriteLn('Invalid value: cfgtest/MainWindow/Caption');
if cfg.GetValue('cfgtest/SomeForm/Presets/Preset1/Name', '') <> 'Example' then
WriteLn('Invalid value: cfgtest/SomeForm/Presets/Preset1/Name');
if cfg.GetValue('TipOfTheDay/Disabled', False) <> True then
WriteLn('Invalid value: TipOfTheDay/Disabled');
cfg.Free;
WriteLn('Done!');
end.
{
$Log$
Revision 1.1 1999-07-09 21:06:59 michael
+ Initial implementation by sebastian Guenther
}

54
fcl/tests/fpdoc.dtd Normal file
View File

@ -0,0 +1,54 @@
<!-- $Id$
XML Document Type Definition (DTD) for FreePascal/KCL fpdoc documents.
This DTD is not finished yet!!! Currently it is mainly used as a demo/test
for the new FCL XML units.
(c) 1999 Sebastian Guenther, sguenther@gmx.de
-->
<!-- Elements used for descriptions -->
<!ELEMENT DESCR (#PCDATA|REF)*>
<!ELEMENT REF (DESCR)>
<!ATTLIST REF dest CDATA #IMPLIED>
<!-- Elements used for building up the logical structure -->
<!ELEMENT DOC (LIBRARY|UNIT|PROGRAM)>
<!ATTLIST DOC name CDATA #REQUIRED version CDATA #IMPLIED xml:lang NMTOKEN "en">
<!ELEMENT LIBRARY ((DESCR)?, (UNIT)*)>
<!ELEMENT UNIT ((DESCR)?, (CONST|VAR|PROCEDURE|FUNCTION|CLASS)+)>
<!ELEMENT CONST (DESCR)?>
<!ATTLIST CONST name CDATA #REQUIRED type CDATA #REQUIRED>
<!ELEMENT VAR (DESCR)?>
<!ATTLIST VAR name CDATA #REQUIRED type CDATA #REQUIRED>
<!ELEMENT PROCEDURE ((DESCR)?,(ARG)*)>
<!ATTLIST PROCEDURE name CDATA #REQUIRED>
<!ELEMENT FUNCTION ((DESCR)?,(ARG)*,(RESULT))>
<!ATTLIST FUNCTION name CDATA #REQUIRED>
<!ELEMENT ARG (DESCR)?>
<!ATTLIST ARG name CDATA #REQUIRED type CDATA #IMPLIED ref (const|var) #IMPLIED>
<!ELEMENT CLASS ((DESCR)?, (PUBLIC|PROTECTED|PRIVATE|PUBLISHED|CONSTRUCTOR|DESTRUCTOR|PROCEDURE|FUNCTION|VAR)*)>
<!ATTLIST CLASS name CDATA #REQUIRED ancestor CDATA #IMPLIED>
<!ELEMENT PUBLIC EMPTY>
<!ELEMENT PROTECTED EMPTY>
<!ELEMENT PRIVATE EMPTY>
<!ELEMENT PUBLISHED EMPTY>
<!ELEMENT CONSTRUCTOR ((DESCR)?,(ARG)*)>
<!ATTLIST CONSTRUCTOR name CDATA "Create">
<!ELEMENT DESTRUCTOR ((DESCR)?,(ARG)*)>
<!ATTLIST DESTRUCTOR name CDATA "Destroy">

436
fcl/tests/kword.xml Normal file
View File

@ -0,0 +1,436 @@
<?xml version="1.0"?>
<DOC author="Reginald Stadlbauer and Torben Weis" email="reggie@kde.org and weis@kde.org" editor="KWord" mime="application/x-kword">
<PAPER format="1" ptWidth="595" ptHeight="841" mmWidth ="210" mmHeight="297" inchWidth ="8.26772" inchHeight="11.6929" orientation="0" columns="2" ptColumnspc="5" mmColumnspc="2" inchColumnspc="0.0787402" hType="0" fType="0" ptHeadBody="9" ptFootBody="9" mmHeadBody="3.5" mmFootBody="3.5" inchHeadBody="0.137795" inchFootBody="0.137795">
<PAPERBORDERS mmLeft="10" mmTop="15" mmRight="10" mmBottom="15" ptLeft="28" ptTop="42" ptRight="28" ptBottom="42" inchLeft="0.393701" inchTop="0.590551" inchRight="0.393701" inchBottom="0.590551"/>
</PAPER>
<ATTRIBUTES processing="0" standardpage="1" hasHeader="0" hasFooter="0" unit="mm"/>
<FRAMESETS>
<FRAMESET frameType="1" autoCreateNewFrame="1" frameInfo="0">
<FRAME left="28" top="42" right="294" bottom="798" runaround="1" runaGapPT="2" runaGapMM="1" runaGapINCH="0.0393701" lWidth="1" lRed="255" lGreen="255" lBlue="255" lStyle="0" rWidth="1" rRed="255" rGreen="255" rBlue="255" rStyle="0" tWidth="1" tRed="255" tGreen="255" tBlue="255" tStyle="0" bWidth="1" bRed="255" bGreen="255" bBlue="255" bStyle="0" bkRed="255" bkGreen="255" bkBlue="255" bleftpt="0" bleftmm="0" bleftinch="0" brightpt="0" brightmm="0" brightinch="0" btoppt="0" btopmm="0" btopinch="0" bbottompt="0" bbottommm="0" bbottominch="0"/>
<FRAME left="300" top="42" right="566" bottom="798" runaround="1" runaGapPT="2" runaGapMM="1" runaGapINCH="0.0393701" lWidth="1" lRed="255" lGreen="255" lBlue="255" lStyle="0" rWidth="1" rRed="255" rGreen="255" rBlue="255" rStyle="0" tWidth="1" tRed="255" tGreen="255" tBlue="255" tStyle="0" bWidth="1" bRed="255" bGreen="255" bBlue="255" bStyle="0" bkRed="255" bkGreen="255" bkBlue="255" bleftpt="0" bleftmm="0" bleftinch="0" brightpt="0" brightmm="0" brightinch="0" btoppt="0" btopmm="0" btopinch="0" bbottompt="0" bbottommm="0" bbottominch="0"/>
<PARAGRAPH>
<TEXT>Just a XML test, this file has been created by an early alpha version of KWord...</TEXT>
<HARDBRK frame="0"/>
<FORMATS>
<FORMAT id="1" pos="0" len="81">
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
</FORMATS>
<LAYOUT>
<NAME value="Standard"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="0" depth="0" bullet="45" start="0" numberingtype="0" lefttext="" righttext="" bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
<TABULATOR mmpos="61" ptpos="174" inchpos="1.10089e+15" type="0"/>
<TABULATOR mmpos="31" ptpos="88" inchpos="1.10089e+15" type="0"/>
</LAYOUT>
</PARAGRAPH>
</FRAMESET>
<FRAMESET frameType="1" autoCreateNewFrame="0" frameInfo="1">
<FRAME left="28" top="42" right="566" bottom="61" runaround="0" runaGapPT="2" runaGapMM="1" runaGapINCH="0.0393701" lWidth="1" lRed="255" lGreen="255" lBlue="255" lStyle="0" rWidth="1" rRed="255" rGreen="255" rBlue="255" rStyle="0" tWidth="1" tRed="255" tGreen="255" tBlue="255" tStyle="0" bWidth="1" bRed="255" bGreen="255" bBlue="255" bStyle="0" bkRed="255" bkGreen="255" bkBlue="255" bleftpt="0" bleftmm="0" bleftinch="0" brightpt="0" brightmm="0" brightinch="0" btoppt="0" btopmm="0" btopinch="0" bbottompt="0" bbottommm="0" bbottominch="0"/>
<PARAGRAPH>
<TEXT></TEXT>
<HARDBRK frame="0"/>
<FORMATS>
</FORMATS>
<LAYOUT>
<NAME value="Standard"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="0" depth="0" bullet="-73" start="0" numberingtype="0" lefttext="" righttext="" bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
<TABULATOR mmpos="61" ptpos="174" inchpos="1.10089e+15" type="0"/>
<TABULATOR mmpos="31" ptpos="88" inchpos="1.10089e+15" type="0"/>
</LAYOUT>
</PARAGRAPH>
</FRAMESET>
<FRAMESET frameType="1" autoCreateNewFrame="0" frameInfo="3">
<FRAME left="28" top="42" right="566" bottom="61" runaround="0" runaGapPT="2" runaGapMM="1" runaGapINCH="0.0393701" lWidth="1" lRed="255" lGreen="255" lBlue="255" lStyle="0" rWidth="1" rRed="255" rGreen="255" rBlue="255" rStyle="0" tWidth="1" tRed="255" tGreen="255" tBlue="255" tStyle="0" bWidth="1" bRed="255" bGreen="255" bBlue="255" bStyle="0" bkRed="255" bkGreen="255" bkBlue="255" bleftpt="0" bleftmm="0" bleftinch="0" brightpt="0" brightmm="0" brightinch="0" btoppt="0" btopmm="0" btopinch="0" bbottompt="0" bbottommm="0" bbottominch="0"/>
<PARAGRAPH>
<TEXT></TEXT>
<HARDBRK frame="0"/>
<FORMATS>
</FORMATS>
<LAYOUT>
<NAME value="Standard"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="0" depth="0" bullet="-73" start="0" numberingtype="0" lefttext="" righttext="" bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
<TABULATOR mmpos="61" ptpos="174" inchpos="1.10089e+15" type="0"/>
<TABULATOR mmpos="31" ptpos="88" inchpos="1.10089e+15" type="0"/>
</LAYOUT>
</PARAGRAPH>
</FRAMESET>
<FRAMESET frameType="1" autoCreateNewFrame="0" frameInfo="2">
<FRAME left="28" top="42" right="566" bottom="61" runaround="0" runaGapPT="2" runaGapMM="1" runaGapINCH="0.0393701" lWidth="1" lRed="255" lGreen="255" lBlue="255" lStyle="0" rWidth="1" rRed="255" rGreen="255" rBlue="255" rStyle="0" tWidth="1" tRed="255" tGreen="255" tBlue="255" tStyle="0" bWidth="1" bRed="255" bGreen="255" bBlue="255" bStyle="0" bkRed="255" bkGreen="255" bkBlue="255" bleftpt="0" bleftmm="0" bleftinch="0" brightpt="0" brightmm="0" brightinch="0" btoppt="0" btopmm="0" btopinch="0" bbottompt="0" bbottommm="0" bbottominch="0"/>
<PARAGRAPH>
<TEXT></TEXT>
<HARDBRK frame="0"/>
<FORMATS>
</FORMATS>
<LAYOUT>
<NAME value="Standard"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="0" depth="0" bullet="-73" start="0" numberingtype="0" lefttext="" righttext="" bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
<TABULATOR mmpos="61" ptpos="174" inchpos="1.10089e+15" type="0"/>
<TABULATOR mmpos="31" ptpos="88" inchpos="1.10089e+15" type="0"/>
</LAYOUT>
</PARAGRAPH>
</FRAMESET>
<FRAMESET frameType="1" autoCreateNewFrame="0" frameInfo="4">
<FRAME left="28" top="779" right="566" bottom="798" runaround="0" runaGapPT="2" runaGapMM="1" runaGapINCH="0.0393701" lWidth="1" lRed="255" lGreen="255" lBlue="255" lStyle="0" rWidth="1" rRed="255" rGreen="255" rBlue="255" rStyle="0" tWidth="1" tRed="255" tGreen="255" tBlue="255" tStyle="0" bWidth="1" bRed="255" bGreen="255" bBlue="255" bStyle="0" bkRed="255" bkGreen="255" bkBlue="255" bleftpt="0" bleftmm="0" bleftinch="0" brightpt="0" brightmm="0" brightinch="0" btoppt="0" btopmm="0" btopinch="0" bbottompt="0" bbottommm="0" bbottominch="0"/>
<PARAGRAPH>
<TEXT></TEXT>
<HARDBRK frame="0"/>
<FORMATS>
</FORMATS>
<LAYOUT>
<NAME value="Standard"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="0" depth="0" bullet="-73" start="0" numberingtype="0" lefttext="" righttext="" bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
<TABULATOR mmpos="61" ptpos="174" inchpos="1.10089e+15" type="0"/>
<TABULATOR mmpos="31" ptpos="88" inchpos="1.10089e+15" type="0"/>
</LAYOUT>
</PARAGRAPH>
</FRAMESET>
<FRAMESET frameType="1" autoCreateNewFrame="0" frameInfo="6">
<FRAME left="28" top="779" right="566" bottom="798" runaround="0" runaGapPT="2" runaGapMM="1" runaGapINCH="0.0393701" lWidth="1" lRed="255" lGreen="255" lBlue="255" lStyle="0" rWidth="1" rRed="255" rGreen="255" rBlue="255" rStyle="0" tWidth="1" tRed="255" tGreen="255" tBlue="255" tStyle="0" bWidth="1" bRed="255" bGreen="255" bBlue="255" bStyle="0" bkRed="255" bkGreen="255" bkBlue="255" bleftpt="0" bleftmm="0" bleftinch="0" brightpt="0" brightmm="0" brightinch="0" btoppt="0" btopmm="0" btopinch="0" bbottompt="0" bbottommm="0" bbottominch="0"/>
<PARAGRAPH>
<TEXT></TEXT>
<HARDBRK frame="0"/>
<FORMATS>
</FORMATS>
<LAYOUT>
<NAME value="Standard"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="0" depth="0" bullet="-73" start="0" numberingtype="0" lefttext="" righttext="" bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
<TABULATOR mmpos="61" ptpos="174" inchpos="1.10089e+15" type="0"/>
<TABULATOR mmpos="31" ptpos="88" inchpos="1.10089e+15" type="0"/>
</LAYOUT>
</PARAGRAPH>
</FRAMESET>
<FRAMESET frameType="1" autoCreateNewFrame="0" frameInfo="5">
<FRAME left="28" top="779" right="566" bottom="798" runaround="0" runaGapPT="2" runaGapMM="1" runaGapINCH="0.0393701" lWidth="1" lRed="255" lGreen="255" lBlue="255" lStyle="0" rWidth="1" rRed="255" rGreen="255" rBlue="255" rStyle="0" tWidth="1" tRed="255" tGreen="255" tBlue="255" tStyle="0" bWidth="1" bRed="255" bGreen="255" bBlue="255" bStyle="0" bkRed="255" bkGreen="255" bkBlue="255" bleftpt="0" bleftmm="0" bleftinch="0" brightpt="0" brightmm="0" brightinch="0" btoppt="0" btopmm="0" btopinch="0" bbottompt="0" bbottommm="0" bbottominch="0"/>
<PARAGRAPH>
<TEXT></TEXT>
<HARDBRK frame="0"/>
<FORMATS>
</FORMATS>
<LAYOUT>
<NAME value="Standard"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="0" depth="0" bullet="-73" start="0" numberingtype="0" lefttext="" righttext="" bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
<TABULATOR mmpos="61" ptpos="174" inchpos="1.10089e+15" type="0"/>
<TABULATOR mmpos="31" ptpos="88" inchpos="1.10089e+15" type="0"/>
</LAYOUT>
</PARAGRAPH>
</FRAMESET>
</FRAMESETS>
<STYLES>
<STYLE>
<NAME value="Standard"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="0" depth="0" bullet="-73" start="0" numberingtype="0" lefttext="" righttext="" bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
<TABULATOR mmpos="61" ptpos="174" inchpos="1.10089e+15" type="0"/>
<TABULATOR mmpos="31" ptpos="88" inchpos="1.10089e+15" type="0"/>
</STYLE>
<STYLE>
<NAME value="Head 1"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="1" depth="0" bullet="-73" start="1" numberingtype="1" lefttext="" righttext="." bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="helvetica"/>
<SIZE value="24"/>
<WEIGHT value="75"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
</STYLE>
<STYLE>
<NAME value="Head 2"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="1" depth="1" bullet="-73" start="1" numberingtype="1" lefttext="" righttext="." bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="helvetica"/>
<SIZE value="16"/>
<WEIGHT value="75"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
</STYLE>
<STYLE>
<NAME value="Head 3"/>
<FOLLOWING name="Standard"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="1" depth="2" bullet="-73" start="1" numberingtype="1" lefttext="" righttext="." bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="helvetica"/>
<SIZE value="12"/>
<WEIGHT value="75"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
</STYLE>
<STYLE>
<NAME value="Enumerated List"/>
<FOLLOWING name="Enumerated List"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="1" depth="0" bullet="-73" start="1" numberingtype="0" lefttext="" righttext="." bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
</STYLE>
<STYLE>
<NAME value="Alphabetical List"/>
<FOLLOWING name="Alphabetical List"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="2" depth="0" bullet="-73" start="a" numberingtype="0" lefttext="" righttext=")" bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
</STYLE>
<STYLE>
<NAME value="Bullet List"/>
<FOLLOWING name="Bullet List"/>
<FLOW value="0"/>
<OHEAD pt="0" mm="0" inch="0"/>
<OFOOT pt="0" mm="0" inch="0"/>
<IFIRST pt="0" mm="0" inch="0"/>
<ILEFT pt="0" mm="0" inch="0"/>
<LINESPACE pt="0" mm="0" inch="0"/>
<COUNTER type="6" depth="0" bullet="-73" start="1" numberingtype="0" lefttext="" righttext="" bulletfont="symbol"/>
<LEFTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<RIGHTBORDER red="255" green="255" blue="255" style="0" width="0"/>
<TOPBORDER red="255" green="255" blue="255" style="0" width="0"/>
<BOTTOMBORDER red="255" green="255" blue="255" style="0" width="0"/>
<FORMAT>
<COLOR red="0" green="0" blue="0"/>
<FONT name="times"/>
<SIZE value="12"/>
<WEIGHT value="50"/>
<ITALIC value="0"/>
<UNDERLINE value="0"/>
<VERTALIGN value="0"/>
</FORMAT>
</STYLE>
</STYLES>
</DOC>

8
fcl/tests/simple.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version = '1.0' encoding='UTF-8' ?>
<!-- This is a comment -->
<TAG>
<SUBTAG value="TestValue"/>
Just a test! This &lt; was an entity reference.
<EMPTYTAG/>
<![CDATA[A CDATA section!]]>
</TAG>

74
fcl/tests/xmldump.pp Normal file
View File

@ -0,0 +1,74 @@
// $Id$
{$MODE objfpc}
{$H+}
program xmldump;
uses sysutils, DOM, xmlread;
const
NodeNames: array[ELEMENT_NODE..NOTATION_NODE] of String = (
'Element',
'Attribute',
'Text',
'CDATA section',
'Entity reference',
'Entity',
'Processing instruction',
'Comment',
'Document',
'Document type',
'Document fragment',
'Notation'
);
procedure DumpNode(node: TDOMNode; spc: String);
var
i: Integer;
attr: TDOMNode;
begin
Write(spc, NodeNames[node.NodeType]);
if Copy(node.NodeName, 1, 1) <> '#' then
Write(' "', node.NodeName, '"');
if node.NodeValue <> '' then
Write(' "', node.NodeValue, '"');
if (node.Attributes <> nil) and (node.Attributes.Length > 0) then begin
Write(',');
for i := 0 to node.Attributes.Length - 1 do begin
attr := node.Attributes.Item[i];
Write(' ', attr.NodeName, ' = "', attr.NodeValue, '"');
end;
end;
WriteLn;
if node.FirstChild <> nil then
DumpNode(node.FirstChild, spc + ' ');
if node.NextSibling <> nil then
DumpNode(node.NextSibling, spc);
end;
var
xml: TXMLDocument;
begin
if ParamCount <> 1 then begin
WriteLn('xmldump <xml or dtd file>');
exit;
end;
if UpCase(ExtractFileExt(ParamStr(1))) = '.DTD' then
xml := ReadDTDFile(ParamStr(1))
else
xml := ReadXMLFile(ParamStr(1));
WriteLn('Successfully parsed the document. Structure:');
WriteLn;
DumpNode(xml, '| ');
end.
{
$Log$
Revision 1.1 1999-07-09 21:06:59 michael
+ Initial implementation by sebastian Guenther
}