Class TWPCustomXMLInterface
Hierarchy
System.TObject | System.Classes.TPersistent | System.Classes.TComponent | TWPCustomXMLInterface
Subclasses
WPXMLint.TWPCustomXMLTree | WPXMLint.TWPXMLInterface
Description
Component to load and save an XML file. While loading and saving the tags, parameters and texts are created/provided by/to events. TWPCustomXMLTree - Component (based on TWPCustomXMLInterface) to load and save XML files to a tree representation stored in memory.This is a basic XML Interface class. It was not created as an utility for a simple interface to XML for property definitions and to load and save XML/CSS format.
It provides the following intelligence:
reading
- if a not matching end-tag is found it looks in the stack if it finds a previous start tag of this kind and if it does not it ignores the tag but reports and error Otherwise it automatically closes the not closed tags up to this position
- if a comment is found it automatically removes the XML comments and spaces at the beginning and at the end.
- In HTMLmode a few tags are detected to be closed, this are META, BR, HR and BASEFONT.
- for each opened stack a new record is saved (DataSize). You can use this record to store data. When you get the close data event automatically the previous data record is available! You can use the Data in the OnReadText.
writing
- Encoding is written
- The comma separated list of CSS references is automatically written as xml-stylesheets
- OpenTag automatically creates a empty record on the Stack The record must not contain any strings (shortstrings are ok). It is accessible using the function Data
- CloseTag is able to automatically close several open tags until the tag which has the same name is found. This produces only an error if such a tag does not exist on the stack.
Properties
Property AsString : AnsiString
Property Compress : Boolean
Property DataSize : Integer
Property Depth : Integer
Property Encoding : string
Property HTMLMode : Boolean
Property IgnoredTags : TStringList
Property LoadEmptyParams : Boolean
Property MemoryStream : TMemoryStream
Property NoXMLHeader : Boolean
Property ObjectStack : TObject
Property Password : string
Property SaveEmptyParams : Boolean
Property Stack : Pointer
Property StyleSheets : TWPXMLStyleSheetCollection
Property TagsToReadAsClosed : TStringList
Property UseOnlyXMLEntities : Boolean
Property UTF8 : Boolean
Property WorkStringList : TStringList
Property WriteIndented : Boolean
Methods
Procedure CloseTag(Tag:AnsiString)
Procedure CloseTagID(ID:Integer)
Function CurrentTag : string
Procedure DoWriteStart
Procedure LoadFromFile(Filename:string)
Procedure LoadFromStream(Stream:TStream)
Function MakeStyleParam(s:string) : TStringList
Function OpenTag(Tag:AnsiString; params:TStringList; WriteLineBreakForParam:Boolean) : Integer
Procedure SaveToFile(Filename:string)
Procedure SaveToStream(Stream:TStream)
Function StripHTML(inhtml:AnsiString) : AnsiString
Procedure Writeln(s:AnsiString)
Procedure WriteNative(s:AnsiString)
Procedure WriteTag(Tag:AnsiString; params:TStringList; WriteLineBreakForParams:Boolean)
Procedure WriteTo(Data:TStream; s:AnsiString; UseOnlyXMLEntities:Boolean; HTMLMode:Boolean)