Copyright [2019] [Syntea software group a.s.]

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

# Version 40.1.5, release-date 2021-06-25
* fixed bug in nested type declarations.
* fixed few bugs in parsing of email address (it’s now up to rfc288).
* X-definition 2.0 is now deprecated.
* removed deprecated type methods: `ISODay`, `ISOMonth`, `ISOMonthDay`,
`ISOyearMonth`, `ISOYear`, `ISOdateTime`, `ISOdate`, `tokens`, `tokensi`,
`ISOduration`, `ISOlanguage`, `parseISODate`, `parseSequence`, `ListOf`.
* implemented new X-script types `URI` and `EmailAddr`.
* changed names of validation methods: `email` to `emailAddr` and `emailList`
to `emailAddrList`.

# Version 40.1.4, release-date 2021-05-13
* fixed bug: decimal point of amount in price is now always ‘.’ (independent on
`Locale` settings).
* fixed bug in XON to JSON conversion: datetime is not converted
as JSON string.
* fixed bug in GUI debugger: not reported errors in source X-definition
* fixed bug not thrown exception when occurs some errors in JSON/XON parser.

# Version 40.1.3, release-date 2021-05-08
* fixed bug in display of zone with zero hours and negative minutes in offset.
* fixed bug in the method `setParsedString` of objects `ParseResult`.
* fixed bug in construction mode when in the section `xd:mixed` is embedded
a section `xd:choice` (an error XDEF555 was incorrectly reported).
* fixed endless cycle in the X-position with reference to inner selection group.
* fixed bug in generation of X-components when the root model or the referred
* model has occurrence more then one and it has only a text child node.
* improved creation of XML from JSON.
* improved error reporting in JSON.
* ==================================================================
* NOTE this version implements some new features prepared for version 41.0.0:
* ==================================================================
* added the Java method `rule.validate(String)` to X-script of `BNFRule` objects.
Result of this method is a `boolean` value.
* added new Java method to `XDDocument`:
* `XDParseResult parseXDType(String typeName, String data)`
this method invokes a validation method from declared type in X-definition
and returns `XDParseResult` object.
* added new X-definition type of value: `GPSPosition`.
* Methods with this object:
* `latitude()` returns GPS latitude in degrees (-90.0 to 90.0).
* `longitude()` returns GPS longitude in degrees (-180.0 to 180.0).
* `altitude()` returns GPS altitude in meters.
* `name()` returns name of GPS position or null.
* `distanceTo(GPSPosition x)` returns distance to GPS position `x` in meters.
* Constructors (latitude, longitude, altitude are float numbers, name is a string):
* `new GPSPosition(latitude, longitude)`
* `new GPSPosition(latitude, longitude, altitude)`
* `new GPSPosition(latitude, longitude, altitude, name)`
* `new GPSPosition(latitude, longitude, name)`
* added new XML validation method `gps` (The Java implementation is in class
`org.xdef.sys.GPSPosition`). The required form is:
`(latitude, longitude[, altitude[, name]])`
where parameters `latitude`, `longitude`, `altitude` are numbers and `name`
is a string either containing only letters. Otherwise it must be quoted.
After the comma separator is one space. Examples:
* `(51.52, -0.09, 0.0, London)` or
* `(51.52, -0.09)` (altitude and name not specified).
* added new X-definition type of value `Price`
(the Java implementation is in class `org.xdef.sys.Price`).
* Constructor:
* `new Price(amount, code)`
where `amount` is a number and `code` is a ISO 4217 currency code.
* Methods with this object:
* `amount()` returns amount of currency as decimal number.
* `currencyCode()` returns ISO 4217 currency code.
* `fractionDigits()` returns recommended number of fraction digits or -1.
* `display()` returns string with printable form of currency (i.e. decimal
number with recommended number of decimal digits, space and
ISO 4217 currency code).
* added new XML validation method `price`. The required form is:
* `(decimal_number code)`; e.g. `(12.25 USD)`.

# Version 40.1.2, release-date 2021-02-15
* corrected the bug in the X-script method `s.contains(s)`.
* corrected the bug in the construction node of JSON.
* corrected the bug in JSON parser: duplicated name in object not reported.
* corrected the bug in JSON parser: after decimal point and before decimal point
must be a digit.
* to `org.xdef.XDDocument` it is implemented the new method
`Object jcreate(String name, ReportWriter reporter)`.
This method allows to construct JSON data acccording to JSON model with given
name. The method returns constructed JSON object.
* to `org.xdef.proc.XXNode` it is implemented the new method
`public void setJSONContext(Object data)`.
This method sets the context with JSON data used in the construction mode.
* to the BNF grammar are implemented new inline functions `$skipToNextLine`,
`$UTFChar`, and it is implemented the possibility to specify case insensitive
terminal symbols (when the terminal symbol specification follows percentage
* if in the date and datetime validation method is specified any of constraining
facets `%minInclusive`, `%maxInclusive`, `%minExclusive` or `%maxExclusive`,
then it is now skipped the test of date validity (which can be set
by properties or by methods `setMinDate` or `setMaxDate`).
* the method `setBufIndex(int)` in the class org.xdef.sys.StringParser was
renamed to `setIndex(int)`.
* implemented new version of transformation of XML to JSON and of JSON to XML.

# Version 40.1.1, release-date 2020-09-17
* corrected bugs in BNF syntax of X-definitions
* implemented the new method `chkCompatibility(String version)` to XDPool.
This allows to check the version of `XDPool` object with the actual
X-definition software.
* in the class `org.xdef.KDOMUtils` is implemented new static method
`public static void removeRedundantXmlnsAttrs(Element el)`. This method
removes unused `xmlns` attributes and moves repeatable used xmlns attributes
to the element el.
This method is now invoked in the construction mode of X-definition on the
constructed element.

# Version 40.1.0, release-date 2020-07-26
* corrected bug Illegal type in `ObjectReader` when the code contains an item
with `uniqueSetKey`.
* in the X-script is implemented the new type `uniqueSetKey`. This type of
object enables to save the actual value of the key of an `uniqueSet`. To do it
you can invoke the new implemented method `getActualKey()` from `uniqueSet`
object. With the new method `resetKey` form `uniqueSetKey` the actulal key
of given `uniqueSet` object is set to the saved value. E.g.:
<NodeValue xd:script=
‘var uniqueSetKey k; init k=nodeSet.getActualKey(); finally k.resetKey();’>

* implemented the new X-script method `bindSet(uniqueSet u1[,uniqueSet u2…])`.
This method can be specified only in the `init` section of the X-script
of model of Element. At the end of processing of the element where it was
invoked it sets to all specified `uniqueSet` parameters the value of the
actual key which was at init time (it happens after `finally` event).

# Version 40.0.2, release-date 2020-06-19
– improved generation of X-definition from XML data in
– the utility org.xdef.util.GUIEditor now supports also JSON data.
of date time values. Eg.: Mon May 11 23:39:07 CEST 2020.
– corrected bug in v org.xdef.XDFactory when for the compilation of
X-definition is specified a org.xdef.sys.ReportWriter of other type
then org.xdef.ArrayReporter.
– corrected bug in parsing of datetime by mask with variants when
the simpler variant precedes the more complex one.
– in X-script implemented new validation method SHA1(…).
– in X-script implemented new validation method printableDate(…) for the
printable format.
– implemented new X-script type of variable uniqueSetKey which holds the key
of an item in uniqueSet table.
– in X-script is implemented new method getActualKey() on uniqueSet objects. The
result of this method is object uniqueSetKey which holds the actual item
in the uniqueSet table (i.e. after invoking methods ID(), SET(), IDREF(),
– in X-script is implemented new method resetKey() of uniqueSetKey objects.
This method sets the actual value of key to the value which is saved
in an uniqueSetKey object.

# Version 40.0.1, release-date 2020-05-03
* improved JSON error reporting.
* corrected bug when a JSON string value contains some of escape characters.

# Version 40.0.0, release-date 2020-04-24
* new implementation of processing of JSON data.
* xd:def may now contain attribute xd:importLocal (the list of X-definition names from where are imported local declarations).
* xd:root may refer also to named xd:choice.
* corrected bug in error reporting (in some special cases was incorrect xpath).
* corrected bug in invoking methods from referred types.
* to the class org.xdef.XDFactory are implemented methods writeXDPool and readXDPool.
* in X-script is implemented method getCreateContextElement() which in the construction mode returns the actual element from context, otherwise it returns null.
* the default scope of accessibility of items from the xd:declaration declared as child of xd:def is now local (in previous versions it was global).
* to xd:def element is no possible to write the attribute “importLocal”. The value of this attribute is the comma separated list of names of X-definitions from which are imported items from local xd:declarations (the “noname” X-definition is specified by the character “#”).
* NOTE that the implementation of JSON is preliminary, it may be changed in future versions.

# Version 32.5.6, release-date 2020-02-14
* implemented possibility of processing of JSON data in X-definition. This version is preliminary to the version 40.0.0 (the documentation of JSON usage will come with the version 40.0.0).

# Version 32.5.5, release-date 2019-11-26
* implemented new X-script method String getEnv(String name) which reads an environment variable.
* it is now possible to use environment variables likewise as properties. The property item has priority. If there are specified both, the environmental variable and the property item, then it is used the property value instead of value of the environmental variable. The names of properties and environment variables are changed, the dots (“.”) in a names are replaced by underlines (“_”), e.g. “xdef.debug” is now “xdef_debug” (see XDConstants). However, since the names with dots are deprecated, they are still accepted.

# Version 32.5.3, release-date 2019-10-21
* Improved the utility org.xdef.GUIEditor. Added parameter the “-g” which
enables to create X-definition from given XML data.

# Version 32.5.1, release-date 2019-09-24
– Corrected org.xdef.sys.SDatetime methods implemented from javax.xml.datatype.XMLGregorianCalendar.
– implemented the access to XML data or X-definition data with  an URL-like form where the protocol name is “classpath”.
String urlName = “classpath://org.xdefimpl.compile.XdefOfXdefBase.xdef”;
This form may be used to parse XML source data:
Document dom = KXmlUtils.parseXml(urlName);
or to X-definition in compilation of XDPool:
XDPool xp = XDFactory.compileXD(null, urlName);
or in the attribute “xd:include” in header of X-definition:
<xd:def xmlns:xd =”″
xd:include = “classpath://org.xdefimpl.compile.XdefOfXdefBase.xdef,
>  …

# Version 32.5.0, release-date 2019-07-11
– Prepared the EXPERIMENTAL version for processing JSON data (it does not influence the processing of XML data). The X-component has the new method toJson which returns a JCON object. It is also now available the new class org.xdef.json.JsonUtil which enables to work with JSON objects (conversion JSON to XML, XML to JSON,
parse source JSON data, compare JSON objects). In the X-definition is now possible to specify a JSON model written to an element js:json as a text child. The namespace assigned to the prefix “js” can be either: (see XDConstants.JSON_NS_URI) used for X-definition version of JSON to XML coversion
or (see XDConstants.JSON_NS_URI_W3C) used for W3C version of conversion to XML In the class XDDocument are now implemented the methods “jparse” (parsing of an JSON objects with X-definition).
<xd:def xmlns:xd=”″
xd:name=”Test” xd:root=”js:json”>
“Name”: “jstring(1, 50); onFalse outln(‘Incorrect name’)”,
“Salary”: “int(1000, 1000000)”,
“Vehicle”: “optional enum(‘Skoda’,’Ford’,’WW’,’Other’);”
JSON data:
{ “Name”: “John Smith”, “Salary”: 3500, “Vehicle”: “Ford” }
Program in Java:
File json; // file with JSON data
File xdef; // file with X-definition
XDPool xp = XDFactory.compileXD(null, xdef); // compile X-definition
XDDocument xd = xp.createXDDocument(“test”);
// parse json source and return parsed JSON object
Object result = xd.jparse(json, “js:json”, null);
// result will be the instance of java.util.Map

# Version 32.4.0, release-date 2019-04-02
– when X-component is generated from an element model where are no attributes and it has just a text child node, there are also generated getter/setter methods which have the “$” set before the name of element (e.g. get$name()).
The namespace URI for the X-definition version 3.2 is changed
– old: “”
– new: “”
The old value is also accepted (because of compatibility reason).

# Version 32.3.2, release-date 2019-03-24
– fixed error in generation of X-components from models where there are more nested models with the same name.

# Version 32.3.1, release-date 2019-03-21
– fixed error in generation of X-components from models with namespace URI.
Previous build info:
# Version 32.3.0, release-date 2019-03-12
– to the X-script added method XDValue replaceItem(int index, XDValue value). This method is member of the Container objects,
– fixed errors in conversion of X-definition to XML schema (in declared types).

– Corrected X-component bug when the prefix of the attribute namespace differs frm the prefix in the model. The method toXml() returns not then correct result.
– Now is available the technology of X-lexicon (see the document xdef-32_Lexicon.pdf).

– Corrected bug in the construction mode. Te initialization of variables in the X-script section “var” in the model of element was not invoked correctly.
– Corrected setting of stop addresses in the GUI of debugger.

– The previous vesrions were distributed by the site in this version were renamed the packages “cz.synte.xdef” to “org.xdef”.

– Corrected backward compatibility of the validation type declaration in the X-definition version 2.0 (the keyword “parse:”).
– Corrected the bug if the missing element in the model is followed by optional elements which are also missing.
– Corrected the bug in construction mode. It was not invoked the initialization section in the section “var” in the X-script of  an element model.

– Corrected backward compatibility of the validation type declaration in the X-definition version 2.0 (the keyword “parse:”)
– Corrected bug if the missing elementin the model is followd by optional elements which are also missing.
– To the interface XMData is added method getRefTypeName(). It returns the name of a deklared type or null there is no a reference to a declard type.
– From the interface XMData deleted the method getEnumerationValues().
– The declaration of a macro can be noe written in the xd:declaration element.
– Corrected bug in the method XDFactory.compileXD(…)
– New lines in generated files (ie. X-components and registered report tables) are now generated according to the system platform (ie. CR LF in Windows, LF in Unix  etc).
– Corrected error in the class XDGenCollection.
– Repaired NullpointerException in uniqueSet (when an item is null).
– In the X-script are implemented new methodsabove objects of type uniqueSet: toContainer() from the key set is returned the object Container size() from the key set is returned the number of items.
– The interface cz.syntea.xdef.xml.KXmlConstants is now deprecated and the items are moved to cz.syntea.xdef.XDConstants.

– Added x-script validation method “xdType”. It checks if the text value  is a specification of predefined validation method. The result is saved to the parsed result.

– The type “uniqueSet” is extended. It is now possible to declare a value connected with a key (see BNF rule “UniqueSetVar”): UniqueSetDeclaration ::= “uniqueSet” S Identifier S? UniqueSetDeclarationBody
UniqueSetDeclarationBody ::=
(“{” UniqueSetItem (S?”;” UniqueSetItem)* (S?”;”S?)? S? “}”) | Method
/* The method must be a parser. */
UniqueSetItem ::= S? (UniqueSetVar | UniqueSetKey)
UniqueSetKey ::= S? Identifier (S?”:”S? ((“?” | “optional”) S? )? Method )?
/* The method must be a parser. */
UniqueSetVar ::= S? “var” S TypeIdentifier S Identifier
(S? “,” S? TypeIdentifier S Identifier)*
<xd:declaration> uniqueSet u {a: string(); var Parser x} </xd:declaration>

<def Name=’u.a.ID();’ Type=’xdType(); onTrue u.x=getParsedValue();’ />

<Param Name=’u.a.CHKID();’ Value=’u.x; ‘/>

– added the utility cz.syntea.xdef.util.GUIEditor. It enables to edit  and to debug projects with X-definitions.

– The attributes are processed in order of order as declared in X-definition.

– to the class cz.syntea.xdef.sys.BFFGrammar was added the method trace(PrintStream out) if the parameter is not null, the trace information is printed. If it is null no trace information is generated.

– to the X-skript was added the method “getTextContent()”, which returns the concatenated string with the text nodes of the current element and all   the descendants.

– Java source files are now in UTF-8 code.
– The internal implementaton of the XML parseru and XML builder was replaced by SAX parser and builder from javax package. Therefore were removed following classes from the package cz.syntea.xdef.xml:
– The class GenDTD2XDEF was moved from the package cz.syntea.xdef.xml to the package cz.syntea.xdef.util
– The class cz.syntea.xdef.sys.StreamParser was ablolished. The functionality of the class cz.syntea.xdef.sys.StringParser was extended with the possibility to parse a stream.
– It was added the property “xdef.locationsdetails” (values “true” or “false”, see XDConstants XDPROPERTY_LOCATIONDETAILS). If the value is “true” then the the error reports is added the information about the positions of atributes in the parsed XML document. However, the process is then a bit  slower and requires in some cases more memory. The default value is “false”.
– tothe class  cz.syntea.xdef.XDPool is added the method isLocationsdetails() which returns the actual value of the switch.
– The method “pushParsedObject” in the BGF grammar was renamed to “push”.  If it is used without parameter, then it is pushed to the internal stack the text parsed in the actual rule until the place where it was specified. If a parameter is specified then its value is pushed to the internal stack.
– The method “PushParsedString” was abolished (it is now possible to use  the  “push” method without parameter.
– The method “popParsedObject” in the BGF grammar was renamed to “pop”.
– corrected errror in the X-component which uses anX-definitiojn with option”moreAttributes”
– added property “xdef.ignoreunresovedentities” with value “true” or “false”, default value is “false” – see cz.syntea.xdef.sys.XDConstants:
– if value is “true” then the unresolved refenrences in DTD are ignored
– following methods in XDPool are removed from the implementation:
setResolveIncludes(boolean x)
setDisplayMode(byte mode)
setMinYear(int x);
setMaxYear(int x);
setSpecialDates(SDatetime[] x);
because they violated reentrantibility of the object XDPool, perameters is now possible to set only via properties.
– repaired incorrect reporting of some errors if X-definition runs under servlet
– repaired error of the Script method getCounter() in the “match” section
– corrected missing support of some unusual character set names
– repaired in some cases the incorrect error report XDEF235 (Ambiguous X-definition)

– on the Script of X-definition is implemented the new type of value “Locale”
this value is possible to create with following constructors:
new Locale(language) or
new Locale(language, country) or
new Locale(language, country, variant), where language is lowercase two-letter ISO-639 code, country is uppercase two-letter ISO-3166 code, variant is Java library vendor and browser specific code

– in the Script of X-definition are now implemented new methods:
format(mask, v1, …) creates string from arguments v1, …according to given mask
format(local, mask, v1, …) creates string from arguments v1, …according to given mask and according to specific geographical, political or cultural region from the parameter local (type Locale)
printf(mask, v1,…) prints string from arguments v1, … to standard output according to given mask
printf(local, mask, v1,…) prints string from arguments v1, … to standard output according to given mask and according to specific geographical, political or cultural region from the parameter local (type Locale)
printf(out, mask, v1,…) prints string from arguments v1, … to the output stream out according to given mask
printf(out, local, mask, v1,…) prints string from arguments v1, … to the output stream out according to given mask and according to specific geographical, political or cultural region from the parameter local (type Locale)
out.printf(mask, v1,…) prints string from arguments v1, … to the output stream out according to given mask
out.printf(local, mask, v1,…)  prints string from arguments v1, … to the output stream out according to given mask and according to specific geographical, political or cultural region from the parameter local (type Locale)

– corrected NullPoinerException in some cases in the Script methodcheck(x) on a Parser, when this method was invoked with a parameter x
– corrected error when a type refers to a validation method which is specified in the declaration section which is specified after the section where is reference
– repaired bug in the construction mode in some cases when the result was created from a value of the type Container
– refactored packages:
cz.syntea.common.msg -> cz.syntea.xdef.msg
cz.syntea.common.sys -> cz.syntea.xdef.sys
cz.syntea.common.xml -> cz.syntea.xdef.xml
– repaired bug in the Script command “external method” if the result type is specified as “cz.syntea.xdef.xx” (where xx is the type of value) or if the type is declared as XDContainer
– repaired bug in cz.syntea.common.sys.SManager when there are specified the external property files with a language version of reports
– with the methods “setProperty” or “setProperties” in the class cz,syntea.xdef.XDDocument is now possible to set the specified language of reports and to set the defalut language of reports
– repaired StringIndexOutOfBoundsException when the file name of X-definition is an empty string
– repaired bug in the Script method “error” with the parameter type of “Report”
– on the standard output streams (System.err, System.out) is now at the end of process invoked the method flush()
– repaired bug in the Script methods “setParameter” and “settType” on the type Report (and corrected documentation of it)
– declaration of external methods is now recorded to by the command external method deklarace metody; or external method { deklarace metody; … }
– repaired bug in some case of specified quantifier occurs 2..2
– the following classes were moved from the package cz.syntea.xdef to cz.syntea.xdef.proc: XXNode, XXDocument, XXEelement, XXData
– repaired NullPointerException in some cases when a rule of the BNF grammar does not exist
– the default X-definition verison is switched from 2.0 to 3.1