XML files for In Force and Repealed collections
XML files are available for all versions in the In force and Repealed collections, including all historical versions of titles.
- You can download XML pages for each title using the following
URL structure:
- for the current in force or repealed version:
https://legislation.nsw.gov.au/view/html/status/current/id/xml
- for example, for in force titles:
https://legislation.nsw.gov.au/view/html/inforce/current/act-1995-094/xml
- for example, for repealed titles:
https://legislation.nsw.gov.au/view/html/repealed/current/act-2015-008/xml
- for example, for in force titles:
- for any historical version:
https://legislation.nsw.gov.au/view/html/status/YYYY-MM-DD/id/xml
- for example:
https://legislation.nsw.gov.au/view/html/inforce/2018-09-01/act-1995-094/xml
- for example:
- for the current in force or repealed version:
- To manually download XML for single titles, click the Download XML button on the pale blue task bar for the required In force or Repealed title (or historical version).
- To download bulk XML data, you can use scripting to access pages and links—see 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 (see below) that can be used individually or in combination by using AND or OR are also available.
Syntax:
/export/custom/"field"[operator]value
, for example,
/export/custom/"Type"=act
Fields with more than one word must be used inside double quotes (e.g. "Last Updated"). Fields with only one word do not require quotes (but quotes can be used).
For phrases & numbers, =
means search for
values the same as the given value.
For dates/times, =
means search for this exact
date/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 dates/times
outside the given value.
Will search for values matching either =
or
>
.
Will search for values matching either =
or
<
.
Searches for versions since the given date that have been modified in any way (with or without a publication.date or first.valid.date change).
Format: YYYYMMDDhhmmss
, for example,
LoadDate=20180712143000
(for 12 July 2018, 2.30
pm)
Use a trailing 000000
(in place of the time) for the
beginning of the day, for example, 20180712000000
(for
the beginning of the day on 12 July 2018). You can also use a
trailing ?
, to mean at any time for that day, for
example, 20180712?
.
Searches for all versions since the given date that have been modified with a change that includes a publication.date or first.valid.date change.
Format: YYYYMMDDhhmmss
, for example,
LastUpdated=20180712143000
(for 12 July 2018, 2.30
pm)
Use a trailing 000000
(in place of the time) for the
beginning of the day, for example, 20180712000000
(for
the beginning of the day on 12 July 2018).
Searches for the first.valid.date metadata for a version.
Format: YYYYMMDDhhmmss
, for example,
FirstValidDate=20180712143000
(for 12 July 2018, 2.30
pm)
Use a trailing 000000
(in place of the time) for the
beginning of the day, for example, 20180712000000
(for
the beginning of the day on 12 July 2018).
Searches for the end.valid.date metadata for a version.
Format: YYYYMMDDhhmmss
, for example,
EndValidDate=20180712143000
(for 12 July 2018, 2.30
pm)
Use a trailing 000000
(in place of the time) for the
beginning of the day, for example, 20180712000000
(for
the beginning of the day on 12 July 2018).
Available types on which to search:
act
epi
sl
Searches for the year the legislative instrument was assented to or made. (But note that the relevant year is the one in the instrument ID, which may not be the same as the year in the short title—see the last example below where the years are different.)
Examples:
For Crimes Act 1900 No 40, the year is 1900
For Oaths Regulation 2017 (2017-447), the year is
2017
For Statutory and Other Offices Remuneration Act 1975 (1976 No 4),
the year is 1976
(not 1975)
Searches for the number of the legislative instrument.
Examples:
For Crimes Act 1900 No 40, the number is 40
For Environmental Planning and Assessment Regulation 2000 (557),
the number is 557
Searches for the short title of the legislative instrument. (Remember to wrap phrases of multiple words in double-quotes—see the example.)
Example:
For Crimes Act 1900 No 40, the title is "Crimes Act
1900"
You can also use a trailing or preceding ?
(or
both) to search for titles more generally, for example, "City
of"?
Searches for the repealed status of the legislative
instrument.
N
for no
Y
for yes
Note: If a repealed instrument has historical versions (see the field below), those historical versions are not considered repealed for the purposes of this field.
Searches for the version of the document (if any) that was in force for the given point in time.
Format: PitValid=@PointInTime(YYYYMMDDhhmmss)
, for
example, PitValid=@PointInTime(20180712143000)
(for 12
July 2018, 2.30 pm)
Use a trailing 000000
(in place of the time) for the
beginning of the day, for example, 20180712000000
(for
the beginning of the day on 12 July 2018).
Note: If the last version of an instrument is repealed (see the field above) it is not considered an in force document for the purposes of this field.
Please note that unlike the website Advanced Search
functionality where you write into a form, export custom queries
are written to the URL, and therefore need to be URI-encoded. For
example, to query for "Type"=act AND "Year"=2008?
you
would need to visit
/export/custom/"Type"=act%20AND%20"Year"=2008%3F
.
Results are returned in HTML format. To return results in JSON
format, append ?format=json
to the end of any export
URL. For example,
https://legislation.nsw.gov.au/export/day
⇒
https://legislation.nsw.gov.au/export/day?format=json
- The XML data reflects the updated legislation on the In force and Repealed pages on this website, which is progressively updated on most business days.
- The XML files use the ExchangeXml.dtd (version 3).
- Please note the Creative Commons Attribution 4.0 International License conditions in that DTD, and also the information about copyright for NSW legislation generally.
- To minimise the possible impact on users of the legislation website, we request your cooperation in ensuring you run any automated scripted XML data processing outside normal business hours in NSW.
Last updated 18 August 2021 at 17:27