Puppet: Is there any way to parse XML in puppet template file - xml-parsing

I am now using json data to fill my puppet templates. I want know that is there any way to parse a xml inside puppet template.
Also there is an additional issue. I am using external facts to take data from the agent to the master. Basically what I am doing is taking my data as a string and parse it to a json inside my template. I want to parse my string into xml ( I will send data in correct format).
Regards,
Malintha

Puppet has no native XML support.
As for the eRuby templates - those appear to require external libraries to deserialize XML.

Related

Jenkins report publisher with json

Any idea about Jenkins extension for json result publisher? I'm using cypress to generate result which is generating result logs in .json format, I'm not sure about json report publisher nor got any concrete document. If someone knows it let me know.
I'm using Junit currently.
I believe that as of now there is no plugin that could help you to directly publish the JSON file content. But there is a workaround. once the JSON report is created, read the required data it using any suitable programming language like python or java and then display those data in the newly created html file. There is a plugin call html publisher plugin and with the help of that plugin, you will be able to display that html file.

how can use jsonkit to get data form website (created in wordpress) which enabled with json plugin

I want to create a ios project in which get data from website which is created in word press and json plugin enabled in word press. But i am getting html code as string when request with any url of website . It should be in json format so that i can parse it in relevant information.
So please help me how can perform done this task.

Parsing XSD using Xerces

I need to parse a generic XSD and create sample XMLs conforming to the XSD. I am using Xerces for Java.
Does Xerces provide support for parsing XSD or do i have to parse it as a regular XML ? If theres support in Xerces, how do i do it?
Also could someone point to way/technique by which i can create all possible XMLs conforming to an XSD.
if possible please share code link or code snippet.
Thanks.
I am not sure which programming language you want to use but assuming Java, you can use XSOM or JaxMe to parse XSD's. You can extract the schema information and then generate the xml's based on the parsed meta data. Or check if XIG: Xml Instance Generator meets your requirement.

XML file or database in this particular case (file updated frequently)

I have a list of URL and I should loop over them every minute or so and save the last successful access time into an XML file or database. Obviously, the URL and some short description will be saved in file as well.
I'm wondering whether XML files are reliable enough or I'm better with a database? If I must go with the database option, which one?
Please advise. Thanks.
You can use XML file for this purpose.
There are lot of options for XML like XML Data Binding, TXMLDocument, XML with ClientDatasets etc.
The simplest option is XML with ClientDataSet.
This is the procedure:
Drop a ClientDataSet on the the form.
Add FieldDefs you need to the ClientDataSet.
Right click on the ClientDataSet component and click Create Dataset.
Right click again and click Save To MyBase XML Table.
You XML is ready and from now onwards you can use ClientDataSet1.LoadFromFile() and ClientDataSet1.SaveToFile() functions to load and save data.
Then you can assign ClientDataSet DataSource to the DBGrid.
I would also use a XML (or JSON) file storage. A simple way to build wrapper classes for a XML file is the XML Schema Binding Generator Wizard in Delphi Professional, or the Data Binding Wizard (in Enterprise / Architect). You only need to provide an example XML or a W3C XSD file. The wizard will create DOM based classes and binding code.
Tutorials:
Delphi XML Binding Wizard Tutorial
Delphi Programming Tutorial #39 - XML Data Binding
I would not use XML. To modify an XML file you have to rewrite it, XML is not good at random read and writes, unless you can modify it only in memory and then write it when needed. Well, every minute is not a problem, unless the XML gets very large. An XML file is reliable as much as your application is in writing it. If you need more, you should consider a database. For local access something alike SQLite or Firebird embedded could be your choice.

XMl Data into String in blackberry

Read the contents of an local XML file in an application and get the whole contents of xml file into a string for blackberry application?
To create a string from a local file see this blackberry forum entry: Open txt file from mediacard
Assuming you want to use the data within the XML, I would recommend using a XML parser rather than string manipulation. The following links should get you going with XML parsers and explain some of the trade-offs:
Blackberry How To - Use the XML Parser
Parsing XML in J2ME
Add XML parsing to your J2ME applications
If, however, you have any say about the format used JSON might be a good alternative. JSON is easy for machines to parse (thus using fewer resources) and it's human readable.
I have found using a SAXParser and subclassing DefaultHandler has worked well. Allows to go element by element.

Resources