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

field starts with @ #17

Open
fkarakas opened this issue Oct 25, 2023 · 2 comments
Open

field starts with @ #17

fkarakas opened this issue Oct 25, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@fkarakas
Copy link

fkarakas commented Oct 25, 2023

Hello,
Evaluating your lib, i noticed that when the field name contains un @ it seems not to work properly
(json-ld file)

nodes := jsonquery.QuerySelectorAll(doc, xpath.MustCompile("//*[@type='TVEpisode']"))

Regards

@zhengchun
Copy link
Contributor

you are means JSON like this {"@type": "123"}, right? not test yet.

@fkarakas
Copy link
Author

yes json like

{
  "@context": "http://schema.org",
  "@type": "DataFeed",
  "dateModified": "2023-10-25T12:05:01Z",
  "dataFeedElement": [
    {
      "@context": [
        "http://schema.org",
        {
          "@language": "fr"
        }
      ],
      "@type": "TVEpisode",
      "@id": "https://tv.com",
      "url": "https://tv.com/video1",
      "name": "video 1",
      "image": {
        "@context": "http://schema.org",
        "@type": "ImageObject",
        "contentUrl": "https://tv.com/video1",
        "additionalProperty": [
          {
            "@type": "PropertyValue",
            "name": "contentAttributes",
            "value": [
              "iconic",
              "poster",
              "smallFormat",
              "largeFormat"
            ]
          }
        ]
      },
      "episodeNumber": 10000,
      "partOfSeason": {
        "@type": "TVSeason",
        "@id": "https://tv.com/season1",
        "url": "https://tv.com/season1",
        "seasonNumber": 1
      },
      "partOfSeries": {
        "@type": "TVSeries",
        "@id": "https://tv.com/series1",
        "url": "https://tv.com/series1",
        "name": "Quotidien"
      },
      "potentialAction": [
        {
          "@type": "WatchAction",
          "target": {
            "@type": "EntryPoint",
            "urlTemplate": "https://tv.com/series1",
            "inLanguage": "fr",
            "actionPlatform": [
              "http://schema.org/AndroidPlatform",
              "http://schema.org/DesktopWebPlatform",
              "http://schema.org/IOSPlatform",
              "http://schema.org/MobileWebPlatform"
            ]
          },
          "actionAccessibilityRequirement": {
            "@type": "ActionAccessSpecification",
            "category": "free",
            "availabilityStarts": "2017-01-16T18:40:00Z",
            "availabilityEnds": "2029-12-31T20:00:00Z",
            "eligibleRegion": [
              {
                "@type": "Country",
                "name": "US"
              }
            ]
          }
        },
        {
          "@type": "WatchAction",
          "target": {
            "@type": "EntryPoint",
            "urlTemplate": "https://tv.com/video1",
            "inLanguage": "fr",
            "actionPlatform": [
              "http://schema.org/AndroidTVPlatform"
            ]
          },
          "actionAccessibilityRequirement": {
            "@type": "ActionAccessSpecification",
            "category": "free",
            "availabilityStarts": "2017-01-16T18:40:00Z",
            "availabilityEnds": "2029-12-31T20:00:00Z",
            "eligibleRegion": [
              {
                "@type": "Country",
                "name": "FR"
              }
            ]
          }
        }
      ]
    }
  ]
}

The following query returns 1 result

nodes := jsonquery.QuerySelectorAll(doc, xpath.MustCompile("//*[name='video 1']"))

But this other query returns no result

nodes := jsonquery.QuerySelectorAll(doc, xpath.MustCompile("//*[@type='TVEpisode']"))

@zhengchun zhengchun added the enhancement New feature or request label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants