Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve documentation for [dynamicxml] service #9798

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions services/dynamic/dynamic-xml.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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\`.
Comment on lines +21 to +24
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Washingtonwei - a question for you here: If this had been in the documentation on the website, do you think this would have been enough to allow you to work out #9784 without raising an issue?

If not, can you suggest any improvements that don't relate to a specific XML document?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is perfect! Thank you!

`

// This service extends BaseService because it uses a different XML parser
// than BaseXmlService which can be used with xpath.
//
Expand All @@ -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',
Expand All @@ -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',
},
Expand Down
Loading