1 {
2 A set of helper functions for libxml2 for FreePascal
3 Copyright (C) 2008 by Ivo Steinmann
4 }
5
6 unit xmlxsd;
7
8 {$mode objfpc}
9 {$H+}
10
11 interface
12
13 uses
14 ctypes,
15 xml2,
16 xmlxsdparser,
17 Math,
18 Classes,
19 DateUtils,
20 SysUtils;
21
22 resourcestring
23 SChildNotFound = 'child %s not found';
24 SPropNotFound = 'attribute %s not found';
25
26 const
27 IGNORE_LAST = Pointer(-1);
28
29 type
30 XSDException = class(Exception)
31 public
32 constructor CreateNode(const Msg: String; name, nameSpace: xmlCharPtr);
33 end;
34
35 { Node creation functions }
xsdNewChildBase64null36 function xsdNewChildBase64(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: TStream): xmlNodePtr;
xsdNewChildCDatanull37 function xsdNewChildCData(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: AnsiString): xmlNodePtr;
xsdNewChildStringnull38 function xsdNewChildString(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: AnsiString): xmlNodePtr;
xsdNewChildBooleannull39 function xsdNewChildBoolean(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean; UseWords: Boolean = False): xmlNodePtr;
xsdNewChildDatenull40 function xsdNewChildDate(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day: Longword; BC: Boolean = False; Timezone: PXsdTimezone = nil): xmlNodePtr;
xsdNewChildDatenull41 function xsdNewChildDate(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Date: TDateTime; Timezone: PXsdTimezone = nil): xmlNodePtr;
xsdNewChildTimenull42 function xsdNewChildTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil): xmlNodePtr;
xsdNewChildTimenull43 function xsdNewChildTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Time: TDateTime; Timezone: PXsdTimezone = nil): xmlNodePtr;
xsdNewChildDateTimenull44 function xsdNewChildDateTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; BC: Boolean = False; Timezone: PXsdTimezone = nil): xmlNodePtr;
xsdNewChildDateTimenull45 function xsdNewChildDateTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; DateTime: TDateTime; Timezone: PXsdTimezone = nil): xmlNodePtr;
xsdNewChildDecimalnull46 function xsdNewChildDecimal(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Extended; Precision: Integer = 4; Digits: Integer = 1): xmlNodePtr;
xsdNewChildDoublenull47 function xsdNewChildDouble(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Double): xmlNodePtr;
xsdNewChildFloatnull48 function xsdNewChildFloat(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Single): xmlNodePtr;
xsdNewChildBytenull49 function xsdNewChildByte(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Shortint): xmlNodePtr;
xsdNewChildShortnull50 function xsdNewChildShort(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Smallint): xmlNodePtr;
xsdNewChildIntnull51 function xsdNewChildInt(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Longint): xmlNodePtr;
xsdNewChildLongnull52 function xsdNewChildLong(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Int64): xmlNodePtr;
xsdNewChildUnsignedBytenull53 function xsdNewChildUnsignedByte(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Byte): xmlNodePtr;
xsdNewChildUnsignedShortnull54 function xsdNewChildUnsignedShort(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Word): xmlNodePtr;
xsdNewChildUnsignedIntnull55 function xsdNewChildUnsignedInt(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Longword): xmlNodePtr;
xsdNewChildUnsignedLongnull56 function xsdNewChildUnsignedLong(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: QWord): xmlNodePtr;
xsdNewChildEnumnull57 function xsdNewChildEnum(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; enum: array of AnsiString; Value: Integer): xmlNodePtr;
58
59 { Property creation functions }
xsdNewPropStringnull60 function xsdNewPropString(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: AnsiString): xmlAttrPtr;
xsdNewPropBooleannull61 function xsdNewPropBoolean(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean; UseWords: Boolean = False): xmlAttrPtr;
xsdNewPropDatenull62 function xsdNewPropDate(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day: Longword; BC: Boolean = False; Timezone: PXsdTimezone = nil): xmlAttrPtr;
xsdNewPropDatenull63 function xsdNewPropDate(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Date: TDateTime; Timezone: PXsdTimezone = nil): xmlAttrPtr;
xsdNewPropTimenull64 function xsdNewPropTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil): xmlAttrPtr;
xsdNewPropTimenull65 function xsdNewPropTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Time: TDateTime; Timezone: PXsdTimezone = nil): xmlAttrPtr;
xsdNewPropDateTimenull66 function xsdNewPropDateTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; BC: Boolean = False; Timezone: PXsdTimezone = nil): xmlAttrPtr;
xsdNewPropDateTimenull67 function xsdNewPropDateTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; DateTime: TDateTime; Timezone: PXsdTimezone = nil): xmlAttrPtr;
xsdNewPropDecimalnull68 function xsdNewPropDecimal(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Extended; Precision: Integer = 4; Digits: Integer = 1): xmlAttrPtr;
xsdNewPropDoublenull69 function xsdNewPropDouble(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Double): xmlAttrPtr;
xsdNewPropFloatnull70 function xsdNewPropFloat(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Single): xmlAttrPtr;
xsdNewPropBytenull71 function xsdNewPropByte(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Shortint): xmlAttrPtr;
xsdNewPropShortnull72 function xsdNewPropShort(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Smallint): xmlAttrPtr;
xsdNewPropIntnull73 function xsdNewPropInt(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Longint): xmlAttrPtr;
xsdNewPropLongnull74 function xsdNewPropLong(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Int64): xmlAttrPtr;
xsdNewPropUnsignedBytenull75 function xsdNewPropUnsignedByte(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Byte): xmlAttrPtr;
xsdNewPropUnsignedShortnull76 function xsdNewPropUnsignedShort(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Word): xmlAttrPtr;
xsdNewPropUnsignedIntnull77 function xsdNewPropUnsignedInt(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Longword): xmlAttrPtr;
xsdNewPropUnsignedLongnull78 function xsdNewPropUnsignedLong(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: QWord): xmlAttrPtr;
xsdNewPropEnumnull79 function xsdNewPropEnum(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; enum: array of AnsiString; Value: Integer): xmlAttrPtr;
80
81 { Query functions }
82 const
83 NS_IGNORE : xmlCharPtr = nil;
84 NS_EXCLUDE : xmlCharPtr = pointer(-1);
85
86 { Node query functions }
xsdTestNodeNsnull87 function xsdTestNodeNs(node: xmlNodePtr; nameSpace: xmlCharPtr): Boolean;
xsdTestNodenull88 function xsdTestNode(node: xmlNodePtr; name, nameSpace: xmlCharPtr): Boolean;
89
xsdTryGetChildnull90 function xsdTryGetChild(node: xmlNodePtr; name, nameSpace: xmlCharPtr; Index: Integer = 0): xmlNodePtr;
xsdTryGetChildnull91 function xsdTryGetChild(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out child: xmlNodePtr; Index: Integer = 0): Boolean;
xsdTryGetChildCharsnull92 function xsdTryGetChildChars(node: xmlNodePtr; name, nameSpace: xmlCharPtr; Index: Integer = 0): xmlCharPtr;
xsdTryGetChildBase64null93 function xsdTryGetChildBase64(node: xmlNodePtr; name, nameSpace: xmlCharPtr; const Value: TStream; Index: Integer = 0): Boolean;
xsdTryGetChildStringnull94 function xsdTryGetChildString(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString; Index: Integer = 0): Boolean;
xsdTryGetChildBooleannull95 function xsdTryGetChildBoolean(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean; Index: Integer = 0): Boolean;
xsdTryGetChildDatenull96 function xsdTryGetChildDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil; Index: Integer = 0): Boolean;
xsdTryGetChildDatenull97 function xsdTryGetChildDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil; Index: Integer = 0): Boolean;
xsdTryGetChildTimenull98 function xsdTryGetChildTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil; Index: Integer = 0): Boolean;
xsdTryGetChildTimenull99 function xsdTryGetChildTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil; Index: Integer = 0): Boolean;
xsdTryGetChildDateTimenull100 function xsdTryGetChildDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil; Index: Integer = 0): Boolean;
xsdTryGetChildDateTimenull101 function xsdTryGetChildDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil; Index: Integer = 0): Boolean;
xsdTryGetChildDecimalnull102 function xsdTryGetChildDecimal(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended; Index: Integer = 0): Boolean;
xsdTryGetChildDoublenull103 function xsdTryGetChildDouble(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double; Index: Integer = 0): Boolean;
xsdTryGetChildFloatnull104 function xsdTryGetChildFloat(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single; Index: Integer = 0): Boolean;
xsdTryGetChildBytenull105 function xsdTryGetChildByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint; Index: Integer = 0): Boolean;
xsdTryGetChildShortnull106 function xsdTryGetChildShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint; Index: Integer = 0): Boolean;
xsdTryGetChildIntnull107 function xsdTryGetChildInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint; Index: Integer = 0): Boolean;
xsdTryGetChildLongnull108 function xsdTryGetChildLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64; Index: Integer = 0): Boolean;
xsdTryGetChildUnsignedBytenull109 function xsdTryGetChildUnsignedByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte; Index: Integer = 0): Boolean;
xsdTryGetChildUnsignedShortnull110 function xsdTryGetChildUnsignedShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word; Index: Integer = 0): Boolean;
xsdTryGetChildUnsignedIntnull111 function xsdTryGetChildUnsignedInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword; Index: Integer = 0): Boolean;
xsdTryGetChildUnsignedLongnull112 function xsdTryGetChildUnsignedLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord; Index: Integer = 0): Boolean;
xsdTryGetChildEnumnull113 function xsdTryGetChildEnum(node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer; Index: Integer = 0): Boolean;
114
xsdGetChildnull115 function xsdGetChild(node: xmlNodePtr; name, nameSpace: xmlCharPtr; Index: Integer = 0): xmlNodePtr;
xsdGetChildCharsnull116 function xsdGetChildChars(node: xmlNodePtr; name, nameSpace: xmlCharPtr; Index: Integer = 0): xmlCharPtr;
117 procedure xsdGetChildBase64(node: xmlNodePtr; name, nameSpace: xmlCharPtr; const Value: TStream; Index: Integer = 0);
118 procedure xsdGetChildString(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString; Index: Integer = 0);
119 procedure xsdGetChildBoolean(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean; Index: Integer = 0);
120 procedure xsdGetChildDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil; Index: Integer = 0);
121 procedure xsdGetChildDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil; Index: Integer = 0);
122 procedure xsdGetChildTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil; Index: Integer = 0);
123 procedure xsdGetChildTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil; Index: Integer = 0);
124 procedure xsdGetChildDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil; Index: Integer = 0);
125 procedure xsdGetChildDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil; Index: Integer = 0);
126 procedure xsdGetChildDecimal(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended; Index: Integer = 0);
127 procedure xsdGetChildDouble(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double; Index: Integer = 0);
128 procedure xsdGetChildFloat(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single; Index: Integer = 0);
129 procedure xsdGetChildByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint; Index: Integer = 0);
130 procedure xsdGetChildShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint; Index: Integer = 0);
131 procedure xsdGetChildInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint; Index: Integer = 0);
132 procedure xsdGetChildLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64; Index: Integer = 0);
133 procedure xsdGetChildUnsignedByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte; Index: Integer = 0);
134 procedure xsdGetChildUnsignedShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word; Index: Integer = 0);
135 procedure xsdGetChildUnsignedInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword; Index: Integer = 0);
136 procedure xsdGetChildUnsignedLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord; Index: Integer = 0);
137 procedure xsdGetChildEnum(node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer; Index: Integer = 0);
138
139 { Node parsing functions }
xsdTryNextnull140 function xsdTryNext(var node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlNodePtr;
xsdTryNextnull141 function xsdTryNext(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out last: xmlNodePtr): Boolean;
xsdTryNextCharsnull142 function xsdTryNextChars(var node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlCharPtr;
xsdTryNextBase64null143 function xsdTryNextBase64(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; const Value: TStream): Boolean;
xsdTryNextStringnull144 function xsdTryNextString(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString): Boolean;
xsdTryNextBooleannull145 function xsdTryNextBoolean(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean): Boolean;
xsdTryNextDatenull146 function xsdTryNextDate(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil): Boolean;
xsdTryNextDatenull147 function xsdTryNextDate(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil): Boolean;
xsdTryNextTimenull148 function xsdTryNextTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil): Boolean;
xsdTryNextTimenull149 function xsdTryNextTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil): Boolean;
xsdTryNextDateTimenull150 function xsdTryNextDateTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil): Boolean;
xsdTryNextDateTimenull151 function xsdTryNextDateTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil): Boolean;
xsdTryNextDecimalnull152 function xsdTryNextDecimal(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended): Boolean;
xsdTryNextDoublenull153 function xsdTryNextDouble(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double): Boolean;
xsdTryNextFloatnull154 function xsdTryNextFloat(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single): Boolean;
xsdTryNextBytenull155 function xsdTryNextByte(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint): Boolean;
xsdTryNextShortnull156 function xsdTryNextShort(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint): Boolean;
xsdTryNextIntnull157 function xsdTryNextInt(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint): Boolean;
xsdTryNextLongnull158 function xsdTryNextLong(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64): Boolean;
xsdTryNextUnsignedBytenull159 function xsdTryNextUnsignedByte(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte): Boolean;
xsdTryNextUnsignedShortnull160 function xsdTryNextUnsignedShort(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word): Boolean;
xsdTryNextUnsignedIntnull161 function xsdTryNextUnsignedInt(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword): Boolean;
xsdTryNextUnsignedLongnull162 function xsdTryNextUnsignedLong(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord): Boolean;
xsdTryNextEnumnull163 function xsdTryNextEnum(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer): Boolean;
164
xsdNextnull165 function xsdNext(var node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlNodePtr;
xsdNextCharsnull166 function xsdNextChars(var node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlCharPtr;
167 procedure xsdNextBase64(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; const Value: TStream);
168 procedure xsdNextString(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString);
169 procedure xsdNextBoolean(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean);
170 procedure xsdNextDate(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil);
171 procedure xsdNextDate(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil);
172 procedure xsdNextTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil);
173 procedure xsdNextTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil);
174 procedure xsdNextDateTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil);
175 procedure xsdNextDateTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil);
176 procedure xsdNextDecimal(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended);
177 procedure xsdNextDouble(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double);
178 procedure xsdNextFloat(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single);
179 procedure xsdNextByte(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint);
180 procedure xsdNextShort(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint);
181 procedure xsdNextInt(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint);
182 procedure xsdNextLong(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64);
183 procedure xsdNextUnsignedByte(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte);
184 procedure xsdNextUnsignedShort(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word);
185 procedure xsdNextUnsignedInt(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword);
186 procedure xsdNextUnsignedLong(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord);
187 procedure xsdNextEnum(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer);
188
189 { Property query functions }
xsdTestPropNsnull190 function xsdTestPropNs(attr: xmlAttrPtr; nameSpace: xmlCharPtr): Boolean;
xsdTestPropnull191 function xsdTestProp(attr: xmlAttrPtr; name, nameSpace: xmlCharPtr): Boolean;
192
xsdTryGetPropnull193 function xsdTryGetProp(node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlAttrPtr;
xsdTryGetPropCharsnull194 function xsdTryGetPropChars(node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlCharPtr;
xsdTryGetPropStringnull195 function xsdTryGetPropString(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString): Boolean;
xsdTryGetPropBooleannull196 function xsdTryGetPropBoolean(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean): Boolean;
xsdTryGetPropDatenull197 function xsdTryGetPropDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil): Boolean;
xsdTryGetPropDatenull198 function xsdTryGetPropDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil): Boolean;
xsdTryGetPropTimenull199 function xsdTryGetPropTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil): Boolean;
xsdTryGetPropTimenull200 function xsdTryGetPropTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil): Boolean;
xsdTryGetPropDateTimenull201 function xsdTryGetPropDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil): Boolean;
xsdTryGetPropDateTimenull202 function xsdTryGetPropDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil): Boolean;
xsdTryGetPropDecimalnull203 function xsdTryGetPropDecimal(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended): Boolean;
xsdTryGetPropDoublenull204 function xsdTryGetPropDouble(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double): Boolean;
xsdTryGetPropFloatnull205 function xsdTryGetPropFloat(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single): Boolean;
xsdTryGetPropBytenull206 function xsdTryGetPropByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint): Boolean;
xsdTryGetPropShortnull207 function xsdTryGetPropShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint): Boolean;
xsdTryGetPropIntnull208 function xsdTryGetPropInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint): Boolean;
xsdTryGetPropLongnull209 function xsdTryGetPropLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64): Boolean;
xsdTryGetPropUnsignedBytenull210 function xsdTryGetPropUnsignedByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte): Boolean;
xsdTryGetPropUnsignedShortnull211 function xsdTryGetPropUnsignedShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word): Boolean;
xsdTryGetPropUnsignedIntnull212 function xsdTryGetPropUnsignedInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword): Boolean;
xsdTryGetPropUnsignedLongnull213 function xsdTryGetPropUnsignedLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord): Boolean;
xsdTryGetPropEnumnull214 function xsdTryGetPropEnum(node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer): Boolean;
215
xsdGetPropnull216 function xsdGetProp(node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlAttrPtr;
xsdGetPropCharsnull217 function xsdGetPropChars(node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlCharPtr;
218 procedure xsdGetPropString(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString);
219 procedure xsdGetPropBoolean(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean);
220 procedure xsdGetPropDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil);
221 procedure xsdGetPropDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil);
222 procedure xsdGetPropTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil);
223 procedure xsdGetPropTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil);
224 procedure xsdGetPropDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone = nil; BC: PBoolean = nil);
225 procedure xsdGetPropDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone = nil);
226 procedure xsdGetPropDecimal(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended);
227 procedure xsdGetPropDouble(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double);
228 procedure xsdGetPropFloat(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single);
229 procedure xsdGetPropByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint);
230 procedure xsdGetPropShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint);
231 procedure xsdGetPropInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint);
232 procedure xsdGetPropLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64);
233 procedure xsdGetPropUnsignedByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte);
234 procedure xsdGetPropUnsignedShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word);
235 procedure xsdGetPropUnsignedInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword);
236 procedure xsdGetPropUnsignedLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord);
237 procedure xsdGetPropEnum(node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer);
238
xsdRemoveBlanksnull239 function xsdRemoveBlanks(content: xmlCharPtr; out cleaned: AnsiString): boolean;
240
241 implementation
242
243 constructor XSDException.CreateNode(const Msg: String; name, nameSpace: xmlCharPtr);
244 var
245 S: String;
246 begin
247 S := PChar(name);
248 if Assigned(nameSpace) then
249 S := PChar(nameSpace)+':'+S;
250 inherited CreateFmt(Msg, [S]);
251 end;
252
xsdNewChildBase64null253 function xsdNewChildBase64(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: TStream): xmlNodePtr;
254 var
255 Tmp: AnsiString;
256 begin
257 Tmp := xsdFormatBase64(Value);
258 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
259 end;
260
xsdNewChildCDatanull261 function xsdNewChildCData(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: AnsiString): xmlNodePtr;
262 begin
263 Result := xmlNewNode(ns, name);
264 xmlAddChild(Result, xmlNewCDataBlock(parent^.doc, PChar(Value), Length(Value)));
265 xmlAddChild(parent, Result);
266 end;
267
xsdNewChildStringnull268 function xsdNewChildString(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: AnsiString): xmlNodePtr;
269 begin
270 Result := xmlNewChild(parent, ns, name, PChar(Value));
271 end;
272
xsdNewChildBooleannull273 function xsdNewChildBoolean(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean; UseWords: Boolean): xmlNodePtr;
274 var
275 Tmp: AnsiString;
276 begin
277 Tmp := xsdFormatBoolean(Value, UseWords);
278 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
279 end;
280
xsdNewChildTimenull281 function xsdNewChildTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone): xmlNodePtr;
282 var
283 Tmp: AnsiString;
284 begin
285 Tmp := xsdFormatTime(Hour, Minute, Second, Milliseconds, Timezone);
286 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
287 end;
288
xsdNewChildTimenull289 function xsdNewChildTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Time: TDateTime; Timezone: PXsdTimezone): xmlNodePtr;
290 var
291 Tmp: AnsiString;
292 begin
293 Tmp := xsdFormatTime(Time, Timezone);
294 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
295 end;
296
xsdNewChildDatenull297 function xsdNewChildDate(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day: Longword; BC: Boolean; Timezone: PXsdTimezone): xmlNodePtr;
298 var
299 Tmp: AnsiString;
300 begin
301 Tmp := xsdFormatDate(Year, Month, Day, BC, Timezone);
302 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
303 end;
304
xsdNewChildDatenull305 function xsdNewChildDate(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Date: TDateTime; Timezone: PXsdTimezone): xmlNodePtr;
306 var
307 Tmp: AnsiString;
308 begin
309 Tmp := xsdFormatDate(Date, Timezone);
310 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
311 end;
312
xsdNewChildDateTimenull313 function xsdNewChildDateTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; BC: Boolean; Timezone: PXsdTimezone): xmlNodePtr;
314 var
315 Tmp: AnsiString;
316 begin
317 Tmp := xsdFormatDateTime(Year, Month, Day, Hour, Minute, Second, Milliseconds, BC, Timezone);
318 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
319 end;
320
xsdNewChildDateTimenull321 function xsdNewChildDateTime(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; DateTime: TDateTime; Timezone: PXsdTimezone): xmlNodePtr;
322 var
323 Tmp: AnsiString;
324 begin
325 Tmp := xsdFormatDateTime(DateTime, Timezone);
326 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
327 end;
328
xsdNewChildDecimalnull329 function xsdNewChildDecimal(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Extended; Precision: Integer; Digits: Integer): xmlNodePtr;
330 var
331 Tmp: AnsiString;
332 begin
333 Tmp := xsdFormatDecimal(Value, Precision, Digits);
334 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
335 end;
336
xsdNewChildDoublenull337 function xsdNewChildDouble(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Double): xmlNodePtr;
338 var
339 Tmp: AnsiString;
340 begin
341 Tmp := xsdFormatDouble(Value);
342 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
343 end;
344
xsdNewChildFloatnull345 function xsdNewChildFloat(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Single): xmlNodePtr;
346 var
347 Tmp: AnsiString;
348 begin
349 Tmp := xsdFormatFloat(Value);
350 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
351 end;
352
xsdNewChildBytenull353 function xsdNewChildByte(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Shortint): xmlNodePtr;
354 var
355 Tmp: AnsiString;
356 begin
357 Tmp := xsdFormatByte(Value);
358 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
359 end;
360
xsdNewChildShortnull361 function xsdNewChildShort(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Smallint): xmlNodePtr;
362 var
363 Tmp: AnsiString;
364 begin
365 Tmp := xsdFormatShort(Value);
366 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
367 end;
368
xsdNewChildIntnull369 function xsdNewChildInt(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Longint): xmlNodePtr;
370 var
371 Tmp: AnsiString;
372 begin
373 Tmp := xsdFormatInt(Value);
374 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
375 end;
376
xsdNewChildLongnull377 function xsdNewChildLong(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Int64): xmlNodePtr;
378 var
379 Tmp: AnsiString;
380 begin
381 Tmp := xsdFormatLong(Value);
382 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
383 end;
384
xsdNewChildUnsignedBytenull385 function xsdNewChildUnsignedByte(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Byte): xmlNodePtr;
386 var
387 Tmp: AnsiString;
388 begin
389 Tmp := xsdFormatUnsignedByte(Value);
390 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
391 end;
392
xsdNewChildUnsignedShortnull393 function xsdNewChildUnsignedShort(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Word): xmlNodePtr;
394 var
395 Tmp: AnsiString;
396 begin
397 Tmp := xsdFormatUnsignedShort(Value);
398 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
399 end;
400
xsdNewChildUnsignedIntnull401 function xsdNewChildUnsignedInt(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Longword): xmlNodePtr;
402 var
403 Tmp: AnsiString;
404 begin
405 Tmp := xsdFormatUnsignedInt(Value);
406 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
407 end;
408
xsdNewChildUnsignedLongnull409 function xsdNewChildUnsignedLong(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: QWord): xmlNodePtr;
410 var
411 Tmp: AnsiString;
412 begin
413 Tmp := xsdFormatUnsignedLong(Value);
414 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
415 end;
416
xsdNewChildEnumnull417 function xsdNewChildEnum(parent: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; enum: array of AnsiString; Value: Integer): xmlNodePtr;
418 var
419 Tmp: AnsiString;
420 begin
421 Tmp := xsdFormatEnum(enum, Value);
422 Result := xmlNewChild(parent, ns, name, PChar(Tmp));
423 end;
424
xsdNewPropStringnull425 function xsdNewPropString(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: AnsiString): xmlAttrPtr;
426 begin
427 Result := xmlNewNsProp(node, ns, name, PChar(Value));
428 end;
429
xsdNewPropBooleannull430 function xsdNewPropBoolean(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Boolean; UseWords: Boolean): xmlAttrPtr;
431 var
432 Tmp: AnsiString;
433 begin
434 Tmp := xsdFormatBoolean(Value, UseWords);
435 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
436 end;
437
xsdNewPropTimenull438 function xsdNewPropTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone): xmlAttrPtr;
439 var
440 Tmp: AnsiString;
441 begin
442 Tmp := xsdFormatTime(Hour, Minute, Second, Milliseconds, Timezone);
443 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
444 end;
445
xsdNewPropTimenull446 function xsdNewPropTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Time: TDateTime; Timezone: PXsdTimezone): xmlAttrPtr;
447 var
448 Tmp: AnsiString;
449 begin
450 Tmp := xsdFormatTime(Time, Timezone);
451 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
452 end;
453
xsdNewPropDatenull454 function xsdNewPropDate(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day: Longword; BC: Boolean; Timezone: PXsdTimezone): xmlAttrPtr;
455 var
456 Tmp: AnsiString;
457 begin
458 Tmp := xsdFormatDate(Year, Month, Day, BC, Timezone);
459 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
460 end;
461
xsdNewPropDatenull462 function xsdNewPropDate(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Date: TDateTime; Timezone: PXsdTimezone): xmlAttrPtr;
463 var
464 Tmp: AnsiString;
465 begin
466 Tmp := xsdFormatDate(Date, Timezone);
467 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
468 end;
469
xsdNewPropDateTimenull470 function xsdNewPropDateTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; BC: Boolean; Timezone: PXsdTimezone): xmlAttrPtr;
471 var
472 Tmp: AnsiString;
473 begin
474 Tmp := xsdFormatDateTime(Year, Month, Day, Hour, Minute, Second, Milliseconds, BC, Timezone);
475 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
476 end;
477
xsdNewPropDateTimenull478 function xsdNewPropDateTime(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; DateTime: TDateTime; Timezone: PXsdTimezone): xmlAttrPtr;
479 var
480 Tmp: AnsiString;
481 begin
482 Tmp := xsdFormatDateTime(DateTime, Timezone);
483 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
484 end;
485
xsdNewPropDecimalnull486 function xsdNewPropDecimal(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Extended; Precision: Integer; Digits: Integer): xmlAttrPtr;
487 var
488 Tmp: AnsiString;
489 begin
490 Tmp := xsdFormatDecimal(Value, Precision, Digits);
491 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
492 end;
493
xsdNewPropDoublenull494 function xsdNewPropDouble(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Double): xmlAttrPtr;
495 var
496 Tmp: AnsiString;
497 begin
498 Tmp := xsdFormatDouble(Value);
499 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
500 end;
501
xsdNewPropFloatnull502 function xsdNewPropFloat(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Single): xmlAttrPtr;
503 var
504 Tmp: AnsiString;
505 begin
506 Tmp := xsdFormatFloat(Value);
507 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
508 end;
509
xsdNewPropBytenull510 function xsdNewPropByte(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Shortint): xmlAttrPtr;
511 var
512 Tmp: AnsiString;
513 begin
514 Tmp := xsdFormatByte(Value);
515 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
516 end;
517
xsdNewPropShortnull518 function xsdNewPropShort(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Smallint): xmlAttrPtr;
519 var
520 Tmp: AnsiString;
521 begin
522 Tmp := xsdFormatShort(Value);
523 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
524 end;
525
xsdNewPropIntnull526 function xsdNewPropInt(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Longint): xmlAttrPtr;
527 var
528 Tmp: AnsiString;
529 begin
530 Tmp := xsdFormatInt(Value);
531 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
532 end;
533
xsdNewPropLongnull534 function xsdNewPropLong(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Int64): xmlAttrPtr;
535 var
536 Tmp: AnsiString;
537 begin
538 Tmp := xsdFormatLong(Value);
539 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
540 end;
541
xsdNewPropUnsignedBytenull542 function xsdNewPropUnsignedByte(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Byte): xmlAttrPtr;
543 var
544 Tmp: AnsiString;
545 begin
546 Tmp := xsdFormatUnsignedByte(Value);
547 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
548 end;
549
xsdNewPropUnsignedShortnull550 function xsdNewPropUnsignedShort(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Word): xmlAttrPtr;
551 var
552 Tmp: AnsiString;
553 begin
554 Tmp := xsdFormatUnsignedShort(Value);
555 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
556 end;
557
xsdNewPropUnsignedIntnull558 function xsdNewPropUnsignedInt(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: Longword): xmlAttrPtr;
559 var
560 Tmp: AnsiString;
561 begin
562 Tmp := xsdFormatUnsignedInt(Value);
563 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
564 end;
565
xsdNewPropUnsignedLongnull566 function xsdNewPropUnsignedLong(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; Value: QWord): xmlAttrPtr;
567 var
568 Tmp: AnsiString;
569 begin
570 Tmp := xsdFormatUnsignedLong(Value);
571 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
572 end;
573
xsdNewPropEnumnull574 function xsdNewPropEnum(node: xmlNodePtr; ns: xmlNsPtr; name: xmlCharPtr; enum: array of AnsiString; Value: Integer): xmlAttrPtr;
575 var
576 Tmp: AnsiString;
577 begin
578 Tmp := xsdFormatEnum(enum, Value);
579 Result := xmlNewNsProp(node, ns, name, PChar(Tmp));
580 end;
581
xsdTestNodeNsnull582 function xsdTestNodeNs(node: xmlNodePtr; nameSpace: xmlCharPtr): Boolean;
583 begin
584 Result :=
585 (nameSpace = NS_IGNORE) or
586 ((nameSpace = NS_EXCLUDE) and (node^.ns = nil)) or
587 ((nameSpace <> NS_EXCLUDE) and (nameSpace <> NS_IGNORE) and (node^.ns <> nil) and (xmlStrEqual(nameSpace, node^.ns^.href) <> 0));
588 end;
589
xsdTestNodenull590 function xsdTestNode(node: xmlNodePtr; name, nameSpace: xmlCharPtr): Boolean;
591 begin
592 Result := (node <> nil) and (xmlStrEqual(name, node^.name) <> 0) and xsdTestNodeNs(node, nameSpace);
593 end;
594
xsdTryGetChildnull595 function xsdTryGetChild(node: xmlNodePtr; name, nameSpace: xmlCharPtr; Index: integer): xmlNodePtr;
596 begin
597 if Assigned(node) and (Index >= 0) then
598 begin
599 Result := node^.children;
600 while Assigned(Result) do
601 begin
602 if xsdTestNode(Result, name, nameSpace) then
603 begin
604 if Index = 0 then
605 Exit;
606 Dec(Index);
607 end;
608 Result := Result^.next;
609 end;
610 end else
611 Result := nil;
612 end;
613
xsdTryGetChildnull614 function xsdTryGetChild(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out child: xmlNodePtr; Index: Integer): Boolean;
615 begin
616 child := xsdTryGetChild(node, name, nameSpace, Index);
617 Result := Assigned(child);
618 end;
619
xsdTryGetChildCharsnull620 function xsdTryGetChildChars(node: xmlNodePtr; name, nameSpace: xmlCharPtr; Index: Integer): xmlCharPtr;
621 begin
622 Result := xmlNodeGetContent(xsdTryGetChild(node, name, nameSpace, Index));
623 end;
624
xsdTryGetChildBase64null625 function xsdTryGetChildBase64(node: xmlNodePtr; name, nameSpace: xmlCharPtr; const Value: TStream; Index: Integer): Boolean;
626 begin
627 Result := xsdTryParseBase64(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
628 end;
629
xsdTryGetChildStringnull630 function xsdTryGetChildString(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString; Index: Integer): Boolean;
631 begin
632 Result := xsdTryParseString(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
633 end;
634
xsdTryGetChildBooleannull635 function xsdTryGetChildBoolean(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean; Index: Integer): Boolean;
636 begin
637 Result := xsdTryParseBoolean(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
638 end;
639
xsdTryGetChildDatenull640 function xsdTryGetChildDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone; BC: PBoolean; Index: Integer): Boolean;
641 begin
642 Result := xsdTryParseDate(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Year, Month, Day, Timezone, BC);
643 end;
644
xsdTryGetChildDatenull645 function xsdTryGetChildDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone; Index: Integer): Boolean;
646 begin
647 Result := xsdTryParseDate(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value, Timezone);
648 end;
649
xsdTryGetChildTimenull650 function xsdTryGetChildTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone; Index: Integer): Boolean;
651 begin
652 Result := xsdTryParseTime(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Hour, Minute, Second, Milliseconds, Timezone);
653 end;
654
xsdTryGetChildTimenull655 function xsdTryGetChildTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone; Index: Integer): Boolean;
656 begin
657 Result := xsdTryParseTime(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value, Timezone);
658 end;
659
xsdTryGetChildDateTimenull660 function xsdTryGetChildDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone; BC: PBoolean; Index: Integer): Boolean;
661 begin
662 Result := xsdTryParseDateTime(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Year, Month, Day, Hour, Minute, Second, Milliseconds, Timezone, BC);
663 end;
664
xsdTryGetChildDateTimenull665 function xsdTryGetChildDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone; Index: Integer): Boolean;
666 begin
667 Result := xsdTryParseDateTime(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value, Timezone);
668 end;
669
xsdTryGetChildDecimalnull670 function xsdTryGetChildDecimal(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended; Index: Integer): Boolean;
671 begin
672 Result := xsdTryParseDecimal(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
673 end;
674
xsdTryGetChildDoublenull675 function xsdTryGetChildDouble(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double; Index: Integer): Boolean;
676 begin
677 Result := xsdTryParseDouble(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
678 end;
679
xsdTryGetChildFloatnull680 function xsdTryGetChildFloat(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single; Index: Integer): Boolean;
681 begin
682 Result := xsdTryParseFloat(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
683 end;
684
xsdTryGetChildBytenull685 function xsdTryGetChildByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint; Index: Integer): Boolean;
686 begin
687 Result := xsdTryParseByte(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
688 end;
689
xsdTryGetChildShortnull690 function xsdTryGetChildShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint; Index: Integer): Boolean;
691 begin
692 Result := xsdTryParseShort(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
693 end;
694
xsdTryGetChildIntnull695 function xsdTryGetChildInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint; Index: Integer): Boolean;
696 begin
697 Result := xsdTryParseInt(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
698 end;
699
xsdTryGetChildLongnull700 function xsdTryGetChildLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64; Index: Integer): Boolean;
701 begin
702 Result := xsdTryParseLong(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
703 end;
704
xsdTryGetChildUnsignedBytenull705 function xsdTryGetChildUnsignedByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte; Index: Integer): Boolean;
706 begin
707 Result := xsdTryParseUnsignedByte(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
708 end;
709
xsdTryGetChildUnsignedShortnull710 function xsdTryGetChildUnsignedShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word; Index: Integer): Boolean;
711 begin
712 Result := xsdTryParseUnsignedShort(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
713 end;
714
xsdTryGetChildUnsignedIntnull715 function xsdTryGetChildUnsignedInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword; Index: Integer): Boolean;
716 begin
717 Result := xsdTryParseUnsignedInt(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
718 end;
719
xsdTryGetChildUnsignedLongnull720 function xsdTryGetChildUnsignedLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord; Index: Integer): Boolean;
721 begin
722 Result := xsdTryParseUnsignedLong(xsdTryGetChildChars(node, name, nameSpace, Index), -1, Value);
723 end;
724
xsdTryGetChildEnumnull725 function xsdTryGetChildEnum(node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer; Index: Integer): Boolean;
726 begin
727 Result := xsdTryParseEnum(xsdTryGetChildChars(node, name, nameSpace, Index), -1, enum, Value);
728 end;
729
xsdGetChildnull730 function xsdGetChild(node: xmlNodePtr; name, nameSpace: xmlCharPtr; Index: Integer): xmlNodePtr;
731 begin
732 Result := xsdTryGetChild(node, name, nameSpace, Index);
733 if not Assigned(Result) then
734 raise XSDException.CreateNode(SChildNotFound, name, nameSpace);
735 end;
736
xsdGetChildCharsnull737 function xsdGetChildChars(node: xmlNodePtr; name, nameSpace: xmlCharPtr; Index: Integer): xmlCharPtr;
738 begin
739 Result := xmlNodeGetContent(xsdGetChild(node, name, nameSpace, Index));
740 end;
741
742 procedure xsdGetChildBase64(node: xmlNodePtr; name, nameSpace: xmlCharPtr; const Value: TStream; Index: Integer);
743 begin
744 xsdParseBase64(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
745 end;
746
747 procedure xsdGetChildString(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString; Index: Integer);
748 begin
749 xsdParseString(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
750 end;
751
752 procedure xsdGetChildBoolean(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean; Index: Integer);
753 begin
754 xsdParseBoolean(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
755 end;
756
757 procedure xsdGetChildDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone; BC: PBoolean; Index: Integer);
758 begin
759 xsdParseDate(xsdGetChildChars(node, name, nameSpace, Index), -1, Year, Month, Day, Timezone, BC);
760 end;
761
762 procedure xsdGetChildDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone; Index: Integer);
763 begin
764 xsdParseDate(xsdGetChildChars(node, name, nameSpace, Index), -1, Value, Timezone);
765 end;
766
767 procedure xsdGetChildTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone; Index: Integer);
768 begin
769 xsdParseTime(xsdGetChildChars(node, name, nameSpace, Index), -1, Hour, Minute, Second, Milliseconds, Timezone);
770 end;
771
772 procedure xsdGetChildTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone; Index: Integer);
773 begin
774 xsdParseTime(xsdGetChildChars(node, name, nameSpace, Index), -1, Value, Timezone);
775 end;
776
777 procedure xsdGetChildDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone; BC: PBoolean; Index: Integer);
778 begin
779 xsdParseDateTime(xsdGetChildChars(node, name, nameSpace, Index), -1, Year, Month, Day, Hour, Minute, Second, Milliseconds, Timezone, BC);
780 end;
781
782 procedure xsdGetChildDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone; Index: Integer);
783 begin
784 xsdParseDateTime(xsdGetChildChars(node, name, nameSpace, Index), -1, Value, Timezone);
785 end;
786
787 procedure xsdGetChildDecimal(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended; Index: Integer);
788 begin
789 xsdParseDecimal(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
790 end;
791
792 procedure xsdGetChildDouble(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double; Index: Integer);
793 begin
794 xsdParseDouble(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
795 end;
796
797 procedure xsdGetChildFloat(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single; Index: Integer);
798 begin
799 xsdParseFloat(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
800 end;
801
802 procedure xsdGetChildByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint; Index: Integer);
803 begin
804 xsdParseByte(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
805 end;
806
807 procedure xsdGetChildShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint; Index: Integer);
808 begin
809 xsdParseShort(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
810 end;
811
812 procedure xsdGetChildInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint; Index: Integer);
813 begin
814 xsdParseInt(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
815 end;
816
817 procedure xsdGetChildLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64; Index: Integer);
818 begin
819 xsdParseLong(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
820 end;
821
822 procedure xsdGetChildUnsignedByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte; Index: Integer);
823 begin
824 xsdParseUnsignedByte(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
825 end;
826
827 procedure xsdGetChildUnsignedShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word; Index: Integer);
828 begin
829 xsdParseUnsignedShort(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
830 end;
831
832 procedure xsdGetChildUnsignedInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword; Index: Integer);
833 begin
834 xsdParseUnsignedInt(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
835 end;
836
837 procedure xsdGetChildUnsignedLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord; Index: Integer);
838 begin
839 xsdParseUnsignedLong(xsdGetChildChars(node, name, nameSpace, Index), -1, Value);
840 end;
841
842 procedure xsdGetChildEnum(node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer; Index: Integer);
843 begin
844 xsdParseEnum(xsdGetChildChars(node, name, nameSpace, Index), -1, enum, Value);
845 end;
846
xsdTryNextnull847 function xsdTryNext(var node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlNodePtr;
848 begin
849 while Assigned(node) and (node^._type = XML_TEXT_NODE) do
850 node := node^.next;
851
852 if xsdTestNode(node, name, nameSpace) then
853 begin
854 Result := node;
855 node := node^.next;
856 end else
857 Result := nil;
858 end;
859
xsdTryNextnull860 function xsdTryNext(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out last: xmlNodePtr): Boolean;
861 begin
862 last := xsdTryNext(node, name, nameSpace);
863 Result := Assigned(last);
864 end;
865
xsdTryNextCharsnull866 function xsdTryNextChars(var node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlCharPtr;
867 begin
868 Result := xmlNodeGetContent(xsdTryNext(node, name, nameSpace));
869 end;
870
xsdTryNextBase64null871 function xsdTryNextBase64(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; const Value: TStream): Boolean;
872 begin
873 Result := xsdTryParseBase64(xsdTryNextChars(node, name, nameSpace), -1, Value);
874 end;
875
xsdTryNextStringnull876 function xsdTryNextString(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString): Boolean;
877 begin
878 Result := xsdTryParseString(xsdTryNextChars(node, name, nameSpace), -1, Value);
879 end;
880
xsdTryNextBooleannull881 function xsdTryNextBoolean(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean): Boolean;
882 begin
883 Result := xsdTryParseBoolean(xsdTryNextChars(node, name, nameSpace), -1, Value);
884 end;
885
xsdTryNextDatenull886 function xsdTryNextDate(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone; BC: PBoolean): Boolean;
887 begin
888 Result := xsdTryParseDate(xsdTryNextChars(node, name, nameSpace), -1, Year, Month, Day, Timezone, BC);
889 end;
890
xsdTryNextDatenull891 function xsdTryNextDate(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone): Boolean;
892 begin
893 Result := xsdTryParseDate(xsdTryNextChars(node, name, nameSpace), -1, Value, Timezone);
894 end;
895
xsdTryNextTimenull896 function xsdTryNextTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone): Boolean;
897 begin
898 Result := xsdTryParseTime(xsdTryNextChars(node, name, nameSpace), -1, Hour, Minute, Second, Milliseconds, Timezone);
899 end;
900
xsdTryNextTimenull901 function xsdTryNextTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone): Boolean;
902 begin
903 Result := xsdTryParseTime(xsdTryNextChars(node, name, nameSpace), -1, Value, Timezone);
904 end;
905
xsdTryNextDateTimenull906 function xsdTryNextDateTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone; BC: PBoolean): Boolean;
907 begin
908 Result := xsdTryParseDateTime(xsdTryNextChars(node, name, nameSpace), -1, Year, Month, Day, Hour, Minute, Second, Milliseconds, Timezone, BC);
909 end;
910
xsdTryNextDateTimenull911 function xsdTryNextDateTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone): Boolean;
912 begin
913 Result := xsdTryParseDateTime(xsdTryNextChars(node, name, nameSpace), -1, Value, Timezone);
914 end;
915
xsdTryNextDecimalnull916 function xsdTryNextDecimal(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended): Boolean;
917 begin
918 Result := xsdTryParseDecimal(xsdTryNextChars(node, name, nameSpace), -1, Value);
919 end;
920
xsdTryNextDoublenull921 function xsdTryNextDouble(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double): Boolean;
922 begin
923 Result := xsdTryParseDouble(xsdTryNextChars(node, name, nameSpace), -1, Value);
924 end;
925
xsdTryNextFloatnull926 function xsdTryNextFloat(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single): Boolean;
927 begin
928 Result := xsdTryParseFloat(xsdTryNextChars(node, name, nameSpace), -1, Value);
929 end;
930
xsdTryNextBytenull931 function xsdTryNextByte(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint): Boolean;
932 begin
933 Result := xsdTryParseByte(xsdTryNextChars(node, name, nameSpace), -1, Value);
934 end;
935
xsdTryNextShortnull936 function xsdTryNextShort(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint): Boolean;
937 begin
938 Result := xsdTryParseShort(xsdTryNextChars(node, name, nameSpace), -1, Value);
939 end;
940
xsdTryNextIntnull941 function xsdTryNextInt(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint): Boolean;
942 begin
943 Result := xsdTryParseInt(xsdTryNextChars(node, name, nameSpace), -1, Value);
944 end;
945
xsdTryNextLongnull946 function xsdTryNextLong(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64): Boolean;
947 begin
948 Result := xsdTryParseLong(xsdTryNextChars(node, name, nameSpace), -1, Value);
949 end;
950
xsdTryNextUnsignedBytenull951 function xsdTryNextUnsignedByte(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte): Boolean;
952 begin
953 Result := xsdTryParseUnsignedByte(xsdTryNextChars(node, name, nameSpace), -1, Value);
954 end;
955
xsdTryNextUnsignedShortnull956 function xsdTryNextUnsignedShort(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word): Boolean;
957 begin
958 Result := xsdTryParseUnsignedShort(xsdTryNextChars(node, name, nameSpace), -1, Value);
959 end;
960
xsdTryNextUnsignedIntnull961 function xsdTryNextUnsignedInt(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword): Boolean;
962 begin
963 Result := xsdTryParseUnsignedInt(xsdTryNextChars(node, name, nameSpace), -1, Value);
964 end;
965
xsdTryNextUnsignedLongnull966 function xsdTryNextUnsignedLong(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord): Boolean;
967 begin
968 Result := xsdTryParseUnsignedLong(xsdTryNextChars(node, name, nameSpace), -1, Value);
969 end;
970
xsdTryNextEnumnull971 function xsdTryNextEnum(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer): Boolean;
972 begin
973 Result := xsdTryParseEnum(xsdTryNextChars(node, name, nameSpace), -1, enum, Value);
974 end;
975
xsdNextnull976 function xsdNext(var node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlNodePtr;
977 begin
978 Result := xsdTryNext(node, name, nameSpace);
979 if not Assigned(Result) then
980 raise XSDException.CreateNode(SChildNotFound, name, nameSpace);
981 end;
982
xsdNextCharsnull983 function xsdNextChars(var node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlCharPtr;
984 begin
985 Result := xmlNodeGetContent(xsdNext(node, name, nameSpace));
986 end;
987
988 procedure xsdNextBase64(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; const Value: TStream);
989 begin
990 xsdParseBase64(xsdNextChars(node, name, nameSpace), -1, Value);
991 end;
992
993 procedure xsdNextString(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString);
994 begin
995 xsdParseString(xsdNextChars(node, name, nameSpace), -1, Value);
996 end;
997
998 procedure xsdNextBoolean(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean);
999 begin
1000 xsdParseBoolean(xsdNextChars(node, name, nameSpace), -1, Value);
1001 end;
1002
1003 procedure xsdNextDate(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone; BC: PBoolean);
1004 begin
1005 xsdParseDate(xsdNextChars(node, name, nameSpace), -1, Year, Month, Day, Timezone, BC);
1006 end;
1007
1008 procedure xsdNextDate(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone);
1009 begin
1010 xsdParseDate(xsdNextChars(node, name, nameSpace), -1, Value, Timezone);
1011 end;
1012
1013 procedure xsdNextTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone);
1014 begin
1015 xsdParseTime(xsdNextChars(node, name, nameSpace), -1, Hour, Minute, Second, Milliseconds, Timezone);
1016 end;
1017
1018 procedure xsdNextTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone);
1019 begin
1020 xsdParseTime(xsdNextChars(node, name, nameSpace), -1, Value, Timezone);
1021 end;
1022
1023 procedure xsdNextDateTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone; BC: PBoolean);
1024 begin
1025 xsdParseDateTime(xsdNextChars(node, name, nameSpace), -1, Year, Month, Day, Hour, Minute, Second, Milliseconds, Timezone, BC);
1026 end;
1027
1028 procedure xsdNextDateTime(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone);
1029 begin
1030 xsdParseDateTime(xsdNextChars(node, name, nameSpace), -1, Value, Timezone);
1031 end;
1032
1033 procedure xsdNextDecimal(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended);
1034 begin
1035 xsdParseDecimal(xsdNextChars(node, name, nameSpace), -1, Value);
1036 end;
1037
1038 procedure xsdNextDouble(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double);
1039 begin
1040 xsdParseDouble(xsdNextChars(node, name, nameSpace), -1, Value);
1041 end;
1042
1043 procedure xsdNextFloat(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single);
1044 begin
1045 xsdParseFloat(xsdNextChars(node, name, nameSpace), -1, Value);
1046 end;
1047
1048 procedure xsdNextByte(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint);
1049 begin
1050 xsdParseByte(xsdNextChars(node, name, nameSpace), -1, Value);
1051 end;
1052
1053 procedure xsdNextShort(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint);
1054 begin
1055 xsdParseShort(xsdNextChars(node, name, nameSpace), -1, Value);
1056 end;
1057
1058 procedure xsdNextInt(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint);
1059 begin
1060 xsdParseInt(xsdNextChars(node, name, nameSpace), -1, Value);
1061 end;
1062
1063 procedure xsdNextLong(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64);
1064 begin
1065 xsdParseLong(xsdNextChars(node, name, nameSpace), -1, Value);
1066 end;
1067
1068 procedure xsdNextUnsignedByte(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte);
1069 begin
1070 xsdParseUnsignedByte(xsdNextChars(node, name, nameSpace), -1, Value);
1071 end;
1072
1073 procedure xsdNextUnsignedShort(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word);
1074 begin
1075 xsdParseUnsignedShort(xsdNextChars(node, name, nameSpace), -1, Value);
1076 end;
1077
1078 procedure xsdNextUnsignedInt(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword);
1079 begin
1080 xsdParseUnsignedInt(xsdNextChars(node, name, nameSpace), -1, Value);
1081 end;
1082
1083 procedure xsdNextUnsignedLong(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord);
1084 begin
1085 xsdParseUnsignedLong(xsdNextChars(node, name, nameSpace), -1, Value);
1086 end;
1087
1088 procedure xsdNextEnum(var node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer);
1089 begin
1090 xsdParseEnum(xsdNextChars(node, name, nameSpace), -1, enum, Value);
1091 end;
1092
xsdTestPropNsnull1093 function xsdTestPropNs(attr: xmlAttrPtr; nameSpace: xmlCharPtr): Boolean;
1094 begin
1095 Result :=
1096 (nameSpace = NS_IGNORE) or
1097 ((nameSpace = NS_EXCLUDE) and (attr^.ns = nil)) or
1098 ((nameSpace <> NS_EXCLUDE) and (nameSpace <> NS_IGNORE) and (attr^.ns <> nil) and (xmlStrEqual(nameSpace, attr^.ns^.href) <> 0))
1099 end;
1100
xsdTestPropnull1101 function xsdTestProp(attr: xmlAttrPtr; name, nameSpace: xmlCharPtr): Boolean;
1102 begin
1103 Result := (attr <> nil) and (xmlStrEqual(name, attr^.name) <> 0) and xsdTestPropNs(attr, nameSpace);
1104 end;
1105
xsdTryGetPropnull1106 function xsdTryGetProp(node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlAttrPtr;
1107 begin
1108 if Assigned(node) then
1109 begin
1110 Result := node^.properties;
1111 while Assigned(Result) do
1112 begin
1113 if xsdTestProp(Result, name, nameSpace) then
1114 Exit;
1115 Result := Result^.next;
1116 end;
1117 end else
1118 Result := nil;
1119 end;
1120
xsdTryGetPropCharsnull1121 function xsdTryGetPropChars(node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlCharPtr;
1122 var
1123 Prop: xmlAttrPtr;
1124 begin
1125 Prop := xsdTryGetProp(node, name, nameSpace);
1126 if Assigned(Prop) then
1127 Result := xmlNodeGetContent(Prop^.children)
1128 else
1129 Result := nil;
1130 end;
1131
xsdTryGetPropStringnull1132 function xsdTryGetPropString(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString): Boolean;
1133 begin
1134 Result := xsdTryParseString(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1135 end;
1136
xsdTryGetPropBooleannull1137 function xsdTryGetPropBoolean(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean): Boolean;
1138 begin
1139 Result := xsdTryParseBoolean(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1140 end;
1141
xsdTryGetPropDatenull1142 function xsdTryGetPropDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone; BC: PBoolean): Boolean;
1143 begin
1144 Result := xsdTryParseDate(xsdTryGetPropChars(node, name, nameSpace), -1, Year, Month, Day, Timezone, BC);
1145 end;
1146
xsdTryGetPropDatenull1147 function xsdTryGetPropDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone): Boolean;
1148 begin
1149 Result := xsdTryParseDate(xsdTryGetPropChars(node, name, nameSpace), -1, Value, Timezone);
1150 end;
1151
xsdTryGetPropTimenull1152 function xsdTryGetPropTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone): Boolean;
1153 begin
1154 Result := xsdTryParseTime(xsdTryGetPropChars(node, name, nameSpace), -1, Hour, Minute, Second, Milliseconds, Timezone);
1155 end;
1156
xsdTryGetPropTimenull1157 function xsdTryGetPropTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone): Boolean;
1158 begin
1159 Result := xsdTryParseTime(xsdTryGetPropChars(node, name, nameSpace), -1, Value, Timezone);
1160 end;
1161
xsdTryGetPropDateTimenull1162 function xsdTryGetPropDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone; BC: PBoolean): Boolean;
1163 begin
1164 Result := xsdTryParseDateTime(xsdTryGetPropChars(node, name, nameSpace), -1, Year, Month, Day, Hour, Minute, Second, Milliseconds, Timezone, BC);
1165 end;
1166
xsdTryGetPropDateTimenull1167 function xsdTryGetPropDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone): Boolean;
1168 begin
1169 Result := xsdTryParseDateTime(xsdTryGetPropChars(node, name, nameSpace), -1, Value, Timezone);
1170 end;
1171
xsdTryGetPropDecimalnull1172 function xsdTryGetPropDecimal(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended): Boolean;
1173 begin
1174 Result := xsdTryParseDecimal(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1175 end;
1176
xsdTryGetPropDoublenull1177 function xsdTryGetPropDouble(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double): Boolean;
1178 begin
1179 Result := xsdTryParseDouble(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1180 end;
1181
xsdTryGetPropFloatnull1182 function xsdTryGetPropFloat(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single): Boolean;
1183 begin
1184 Result := xsdTryParseFloat(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1185 end;
1186
xsdTryGetPropBytenull1187 function xsdTryGetPropByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint): Boolean;
1188 begin
1189 Result := xsdTryParseByte(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1190 end;
1191
xsdTryGetPropShortnull1192 function xsdTryGetPropShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint): Boolean;
1193 begin
1194 Result := xsdTryParseShort(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1195 end;
1196
xsdTryGetPropIntnull1197 function xsdTryGetPropInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint): Boolean;
1198 begin
1199 Result := xsdTryParseInt(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1200 end;
1201
xsdTryGetPropLongnull1202 function xsdTryGetPropLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64): Boolean;
1203 begin
1204 Result := xsdTryParseLong(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1205 end;
1206
xsdTryGetPropUnsignedBytenull1207 function xsdTryGetPropUnsignedByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte): Boolean;
1208 begin
1209 Result := xsdTryParseUnsignedByte(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1210 end;
1211
xsdTryGetPropUnsignedShortnull1212 function xsdTryGetPropUnsignedShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word): Boolean;
1213 begin
1214 Result := xsdTryParseUnsignedShort(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1215 end;
1216
xsdTryGetPropUnsignedIntnull1217 function xsdTryGetPropUnsignedInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword): Boolean;
1218 begin
1219 Result := xsdTryParseUnsignedInt(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1220 end;
1221
xsdTryGetPropUnsignedLongnull1222 function xsdTryGetPropUnsignedLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord): Boolean;
1223 begin
1224 Result := xsdTryParseUnsignedLong(xsdTryGetPropChars(node, name, nameSpace), -1, Value);
1225 end;
1226
xsdTryGetPropEnumnull1227 function xsdTryGetPropEnum(node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer): Boolean;
1228 begin
1229 Result := xsdTryParseEnum(xsdTryGetPropChars(node, name, nameSpace), -1, enum, Value);
1230 end;
1231
xsdGetPropnull1232 function xsdGetProp(node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlAttrPtr;
1233 begin
1234 Result := xsdTryGetProp(node, name, nameSpace);
1235 if not Assigned(Result) then
1236 raise XSDException.CreateNode(SPropNotFound, name, nameSpace);
1237 end;
1238
xsdGetPropCharsnull1239 function xsdGetPropChars(node: xmlNodePtr; name, nameSpace: xmlCharPtr): xmlCharPtr;
1240 begin
1241 Result := xmlNodeGetContent(xsdGetProp(node, name, nameSpace)^.children);
1242 end;
1243
1244 procedure xsdGetPropString(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: AnsiString);
1245 begin
1246 xsdParseString(xsdGetPropChars(node, name, nameSpace), -1, Value);
1247 end;
1248
1249 procedure xsdGetPropBoolean(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Boolean);
1250 begin
1251 xsdParseBoolean(xsdGetPropChars(node, name, nameSpace), -1, Value);
1252 end;
1253
1254 procedure xsdGetPropDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day: Longword; Timezone: PXsdTimezone; BC: PBoolean);
1255 begin
1256 xsdParseDate(xsdGetPropChars(node, name, nameSpace), -1, Year, Month, Day, Timezone, BC);
1257 end;
1258
1259 procedure xsdGetPropDate(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone);
1260 begin
1261 xsdParseDate(xsdGetPropChars(node, name, nameSpace), -1, Value, Timezone);
1262 end;
1263
1264 procedure xsdGetPropTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone);
1265 begin
1266 xsdParseTime(xsdGetPropChars(node, name, nameSpace), -1, Hour, Minute, Second, Milliseconds, Timezone);
1267 end;
1268
1269 procedure xsdGetPropTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone);
1270 begin
1271 xsdParseTime(xsdGetPropChars(node, name, nameSpace), -1, Value, Timezone);
1272 end;
1273
1274 procedure xsdGetPropDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Year, Month, Day, Hour, Minute, Second, Milliseconds: Longword; Timezone: PXsdTimezone; BC: PBoolean);
1275 begin
1276 xsdParseDateTime(xsdGetPropChars(node, name, nameSpace), -1, Year, Month, Day, Hour, Minute, Second, Milliseconds, Timezone, BC);
1277 end;
1278
1279 procedure xsdGetPropDateTime(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: TDateTime; Timezone: PXsdTimezone);
1280 begin
1281 xsdParseDateTime(xsdGetPropChars(node, name, nameSpace), -1, Value, Timezone);
1282 end;
1283
1284 procedure xsdGetPropDecimal(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Extended);
1285 begin
1286 xsdParseDecimal(xsdGetPropChars(node, name, nameSpace), -1, Value);
1287 end;
1288
1289 procedure xsdGetPropDouble(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Double);
1290 begin
1291 xsdParseDouble(xsdGetPropChars(node, name, nameSpace), -1, Value);
1292 end;
1293
1294 procedure xsdGetPropFloat(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Single);
1295 begin
1296 xsdParseFloat(xsdGetPropChars(node, name, nameSpace), -1, Value);
1297 end;
1298
1299 procedure xsdGetPropByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Shortint);
1300 begin
1301 xsdParseByte(xsdGetPropChars(node, name, nameSpace), -1, Value);
1302 end;
1303
1304 procedure xsdGetPropShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Smallint);
1305 begin
1306 xsdParseShort(xsdGetPropChars(node, name, nameSpace), -1, Value);
1307 end;
1308
1309 procedure xsdGetPropInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longint);
1310 begin
1311 xsdParseInt(xsdGetPropChars(node, name, nameSpace), -1, Value);
1312 end;
1313
1314 procedure xsdGetPropLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Int64);
1315 begin
1316 xsdParseLong(xsdGetPropChars(node, name, nameSpace), -1, Value);
1317 end;
1318
1319 procedure xsdGetPropUnsignedByte(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Byte);
1320 begin
1321 xsdParseUnsignedByte(xsdGetPropChars(node, name, nameSpace), -1, Value);
1322 end;
1323
1324 procedure xsdGetPropUnsignedShort(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Word);
1325 begin
1326 xsdParseUnsignedShort(xsdGetPropChars(node, name, nameSpace), -1, Value);
1327 end;
1328
1329 procedure xsdGetPropUnsignedInt(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: Longword);
1330 begin
1331 xsdParseUnsignedInt(xsdGetPropChars(node, name, nameSpace), -1, Value);
1332 end;
1333
1334 procedure xsdGetPropUnsignedLong(node: xmlNodePtr; name, nameSpace: xmlCharPtr; out Value: QWord);
1335 begin
1336 xsdParseUnsignedLong(xsdGetPropChars(node, name, nameSpace), -1, Value);
1337 end;
1338
1339 procedure xsdGetPropEnum(node: xmlNodePtr; name, nameSpace: xmlCharPtr; enum: array of AnsiString; out Value: Integer);
1340 begin
1341 xsdParseEnum(xsdGetPropChars(node, name, nameSpace), -1, enum, Value);
1342 end;
1343
xsdRemoveBlanksnull1344 function xsdRemoveBlanks(content: xmlCharPtr; out cleaned: AnsiString): boolean;
1345 var
1346 Space: Boolean;
1347 len: Integer;
1348 begin
1349 cleaned := '';
1350
1351 if Assigned(content) then
1352 begin
1353 Space := True;
1354
1355 while content^ <> #0 do
1356 begin
1357 if xmlIsBlank(cuint(content^)) then
1358 begin
1359 if not Space then
1360 cleaned := cleaned + ' ';
1361 Space := True;
1362 end else begin
1363 cleaned := cleaned + content^;
1364 Space := False;
1365 end;
1366
1367 Inc(content);
1368 end;
1369 end;
1370
1371 len := Length(cleaned);
1372 if len > 0 then
1373 begin
1374 if cleaned[len] = ' ' then
1375 SetLength(cleaned, len-1);
1376 Result := True;
1377 end else
1378 Result := False;
1379 end;
1380
1381 end.
1382