@@ -166,7 +166,8 @@ export async function fetchDescribeRecord(url, cswVersion) {
166
166
function fetchRecordsXML ( cswVersion , elementSetName , startPosition , maxRecords , constraint ) {
167
167
//return `<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows" outputSchema="http://www.opengis.net/cat/csw/2.0.2" outputFormat="application/xml" version="2.0.2" resultType="results" service="CSW" maxRecords="10" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd"><csw:Query typeNames="csw:Record"><csw:ElementSetName>summary</csw:ElementSetName><csw:Constraint version="1.1.0"><ogc:Filter><ogc:PropertyIsLike wildCard="*" singleChar="_" escapeChar="\\"><ogc:PropertyName>csw:AnyText</ogc:PropertyName><ogc:Literal>*None*</ogc:Literal></ogc:PropertyIsLike></ogc:Filter></csw:Constraint></csw:Query></csw:GetRecords>`
168
168
return `<?xml version="1.0" encoding="UTF-8"?>
169
- <csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" service="CSW" version="${ cswVersion } " resultType="results" startPosition="${ startPosition } " maxRecords="${ maxRecords } " xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
169
+ <csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" service="CSW" version="${ cswVersion } " resultType="results" startPosition="${ startPosition } " maxRecords="${ maxRecords } " outputSchema="http://www.opengis.net/cat/csw/2.0.2" outputFormat="application/xml"
170
+ xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
170
171
<csw:Query typeNames="csw:Record">
171
172
<csw:ElementSetName>${ elementSetName } </csw:ElementSetName>
172
173
</csw:Query>
@@ -177,20 +178,21 @@ export async function fetchGetRecords(url, cswVersion, elementSetName, serviceSe
177
178
try {
178
179
const params = [ ]
179
180
const preparedUrl = prepareUrl ( url , params ) ;
181
+ const requestXML = fetchRecordsXML ( cswVersion , elementSetName , 1 , 10 , '' ) ;
180
182
181
183
const response = await fetch ( preparedUrl . href , {
182
184
method : 'POST' ,
183
185
headers : {
184
186
'User-Agent' : 'JS CSW Client/0.1' ,
185
187
'Content-Type' : 'text/xml' ,
186
188
} ,
187
- body : fetchRecordsXML ( cswVersion , elementSetName , 1 , 10 , '' )
189
+ body : requestXML
188
190
} ) ;
189
191
if ( ! response . ok ) {
190
192
throw new Error ( `HTTP error! status: ${ response . status } ` ) ;
191
193
}
192
194
const text = await response . text ( ) ;
193
- console . log ( text ) ;
195
+ // console.log(text);
194
196
const cswRecords = await parseXml ( text ) ;
195
197
let xmlRecordName ;
196
198
switch ( elementSetName ) {
0 commit comments