XML files for In Force collection
XML files are available for all versions in the In Force collection, including current, repealed and all historical versions.
Download pages for the XML for each title use the following URL structure:
-
for the current version,
https://legislation.nsw.gov.au/#/view/type/year/no/xml
.-
For example,
https://legislation.nsw.gov.au/#/view/act/2015/26/xml
.
-
For example,
-
for any historical version,
https://legislation.nsw.gov.au/#/view/type/year/no/historicalYYYY-MM-DD/xml
.-
For example,
https://legislation.nsw.gov.au/#/view/act/2015/26/historical2016-02-01/xml
.
-
For example,
There are also manual icon links on the Status Information page and full fragment for each version. Pages and links can also be accessed through scripting. See also XML download collection query options below, for how to access XML sets according to particular update criteria.
If there are graphics associated with an XML file, the download page will also contain links to those graphics. Graphics are only available in GIF format.
Standard queries are available using this syntax:
/#/export/day
returns all versions updated in any way
since the beginning of the current calendar day
/#/export/week
returns all versions updated in any way
in the last week (7 days)
Custom fields are also available that can be used individually
or in combination by using AND or OR.
Syntax:
/#/export/custom/"field"[operator]value
For example,
/#/export/custom/"Last Updated">20160601000000
Fields with more than one word must be used in quotes (eg "Last
Updated").
Fields with only one word do not need quotes (but can also be
used with quotes).
- =
- For phrases & numbers,
=
means search for values the same as the given value
For dates/times,=
means search for this exact day/time - >
- For phrases,
>
means search for values alphabetically after the given value
For numbers,>
means search for values numerically greater than the given value
For dates/times,>
means search for after this date/time - <
- For phrases,
<
means search for values alphabetically before the given value
For numbers,>
means search for values numerically less than the given value
For dates/times,<
means search for before this date/time - <>
- For phrases & numbers,
<>
means search for values that are not the same as the given value
For dates/times,<>
means search for days/times outside the given value - >=
- Will search for values matching either
=
or>
- <=
- Will search for values matching either
=
or<
- Last Modified
- All versions since the given date that have been modified in any way (with or without a publication.date or first.valid.date change)
FormatYYYYMMDDhhmmss
For example20180712143000
(for 12 July 2018, 2.30 pm)
Use a trailing 000000 (in place of the time) for the beginning of the day.
You can also use a trailing?
, to mean at any time for that day;20180712?
- Last Updated
- All versions since given date that have been modified with a change that includes a publication.date or first.valid.date change
FormatYYYYMMDDhhmmss
For example20180712143000
(for 12 July 2018, 2.30 pm)
Use 000000 for the beginning of the day. - FirstValidDate
- The first.valid.date metadata for a version.
FormatYYYY-MM-DD
For example:FirstValidDate=2018-07-01
- LastValidDate
- The last.valid.date metadata for a version.
FormatYYYY-MM-DD
For example:LastValidDate=2018-06-30
- Type
- Available types are:
act
epi
subordleg
- Year
- The year the legislative instrument was assented to or made
Examples
For Crimes Act 1900 No 40, the year is1900
For Statutory and Other Offices Remuneration Act 1975 (1976 No 4), the year is1976
For Oaths Regulation 2011, the year is2011
(or the year if it was made, if that is different from the year in the citation – the year in the ID for the instrument is the year made) - No
- The number of the legislative instrument
Examples:
For Crimes Act 1900 No 40, the number is40
For Environmental Planning and Assessment Regulation 2000 (557), the number is557
- Title
- The title of the legislative instrument
Example
For Crimes Act 1900 No 40, the title is"Crimes Act 1900"
Remember to wrap phrases of multiple words in double-quotes - Repealed
- The repealed status of the legislative instrument
N
for no
Y
for yes
Note – if a repealed instrument has historical versions, those historical versions are not considered repealed for the purposes of this field. - Historical Document
- Returns Historical (non-current) versions
0
for no
YYYY-MM-DD
for historical versions with a specific first.valid.date
Note – if the last version of an instrument is repealed, it is not considered a historical document for the purposes of this field.
Use"Historical Document"<>0
to yield only historical documents.
Please note that unlike the Advanced Search that has you
write into a form, export custom queries are written to the
url, and as such need to be URI-encoded.
For example, to query for "Historical Document"=2008?
you would need to visit /#/export/custom/"Historical%20Document"=2008%3F
Results are returned in HTML format.
For results in JSON format, omit
/#
.For example,
https://legislation.nsw.gov.au/#/export/day
⇒ https://legislation.nsw.gov.au/export/day
The XML data reflects the updated legislation on In Force which is progressively updated on most days.
The XML files use the ExchangeXml.dtd (version 3).
Attention is drawn to the Creative Commons Attribution 4.0 International License conditions in that DTD, and also the information about copyright for NSW legislation generally.
To minimise possible effects on users of the legislation website, any processes to automatically look for and pick up updated XML data should be timed to run outside normal business hours in NSW.
For any questions about the XML files, see Contact Us.