Dashboards & Visualizations

Making xml valid

khailz
Explorer

Hi guys, i am having an issue with the xml script in the last line but i cant seem to figure out how to make it valid as i have.

Have tried double quotes but does not work.

data-options='{
"app": "simple_xml_examples",
"preview": true,
"search": ""sourcetype = a NOT (is OR you OR the OR chinese)' title="*" | eval words=split(title," ") | stats count words""}

Tags (1)
0 Karma
1 Solution

jplumsdaine22
Influencer

To post special characters into Splunk answers insert a new line and then indent 4 spaces

like this
<xml for ever>

View solution in original post

0 Karma

jplumsdaine22
Influencer

To post special characters into Splunk answers insert a new line and then indent 4 spaces

like this
<xml for ever>
0 Karma

jplumsdaine22
Influencer

The xml should look like so (row should be inside search)

<search id="tagcloud_search1">
     <query>index=_internal source=sourcetype = a NOT (is OR you OR the OR chinese)' title="*" | eval words=split(title," ") | stats count words""}</query>
 <row>
     <panel>
         <html>
             <h2>Pipeline</h2>
             <div id="tagcloud1"
                  class="splunk-view"
                  data-require="app/social/components/tagcloud/tagcloud"
                  data-options='{
                     "minFontSize": 14,
                     "maxFontSize": 55,
                     "managerid": "tagcloud_search1",
                     "valueField": "count",
                     "labelField": "words"
                  }'>
             </div>
         </html>
     </panel>
    </row>
  </search>
0 Karma

khailz
Explorer

Sorry took so long to reply. I did encounter another error after trying "Premature end of data in tag form line 1"

im not entire sure what it means.

0 Karma

jplumsdaine22
Influencer

If you pasted in the xml I posted exactly you will not have encountered an error. Premature end probably means you have an un nested element. Do you have something like this?

<search>
</search>
<row>
</row>

That will throw the premature error. Instead your xml should look like this:

<search>
    <row>
    </row>
</search>
0 Karma

khailz
Explorer

yes yes. i did modify the xml. ive copied exactly. it prompted this error now "should not combine visualizations and panels."

0 Karma

khailz
Explorer

Thx. after toying with it again. I noticed where i did wrong. Having the code within the same row.

0 Karma

khailz
Explorer

Hi below is the code snippet.

XML

 <search id="tagcloud_search1">
        <query>index=_internal source=sourcetype = a NOT (is OR you OR the OR chinese)' title="*" | eval words=split(title," ") | stats count words""}</query>
    </search>
    <row>
        <panel>
            <html>
                <h2>Pipeline</h2>
                <div id="tagcloud1"
                     class="splunk-view"
                     data-require="app/social/components/tagcloud/tagcloud"
                     data-options='{
                        "minFontSize": 14,
                        "maxFontSize": 55,
                        "managerid": "tagcloud_search1",
                        "valueField": "count",
                        "labelField": "words"
                     }'>
                </div>
            </html>
        </panel>

*autodiscovery.js*

    require.config({
        paths: {
            "app": "../app"
        }
    });
    require(['splunkjs/mvc/simplexml/ready!'], function(){
        require(['splunkjs/ready!'], function(){
            // The splunkjs/ready loader script will automatically instantiate all elements
            // declared in the dashboard's HTML.
        });
    });
0 Karma

khailz
Explorer

thanks for the reply. but i do not get it. I would have to add it before for a

</xml>

close ?

0 Karma

jplumsdaine22
Influencer

Sorry I thought you were wondering how to add xml to your post. 🙂 Your question is not very clear. You say you are having trouble with an xml script. Which script? Is this a dashboard view? How do you know its invalid? What you have posted is not xml -it looks more like JSON. Can you provide some more context over what you are trying to achieve and what error you are getting

0 Karma

khailz
Explorer

Thanks for your response.

Actually what i am trying to do is modify one of the word cloud scripts from the splunk examples (tag cloud with tokens) . I been trying to modify or change the query line to pick up my customized query. But it always prompts back for invalid xml.

0 Karma

jplumsdaine22
Influencer

Can you post the full xml ?

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...