improve documentation for [dynamicxml] service (#9798)

This commit is contained in:
chris48s
2023-12-13 19:54:21 +00:00
committed by GitHub
parent 57ba623fd6
commit cee41f5818

View File

@@ -10,6 +10,20 @@ import {
} from '../index.js'
import { createRoute } from './dynamic-helpers.js'
const description = `
The Dynamic XML Badge allows you to extract an arbitrary value from any
XML Document using an XPath selector and show it on a badge.
Useful resources for constructing XPath selectors:
- [XPather](http://xpather.com/)
- [XPath Cheat Sheet](https://devhints.io/xpath/)
Note: For XML documents that use a default namespace prefix, you will need to use the
[local-name](https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/local-name)
function to construct your query.
For example \`/*[local-name()='myelement']\` rather than \`/myelement\`.
`
// This service extends BaseService because it uses a different XML parser
// than BaseXmlService which can be used with xpath.
//
@@ -24,10 +38,7 @@ export default class DynamicXml extends BaseService {
'/badge/dynamic/xml': {
get: {
summary: 'Dynamic XML Badge',
description: `<p>
The Dynamic XML Badge allows you to extract an arbitrary value from any
XML Document using an XPath selector and show it on a badge.
</p>`,
description,
parameters: queryParams(
{
name: 'url',
@@ -38,7 +49,7 @@ export default class DynamicXml extends BaseService {
{
name: 'query',
description:
'A <a href="http://xpather.com/">XPath</a> expression that will be used to query the document',
'An XPath expression that will be used to query the document',
required: true,
example: '//slideshow/slide[1]/title',
},