yaml

YAML compared to XML

I read that after years yaml will be used instead of xml. Please compare the relative advantages and disadvantages of each specification. ...

Cucumber & test data management for non-Ruby apps

I'm testing an app that's basically a message-handling application - a message comes in, it's content is analysed, then it's sent somewhere else for processing. The app isn't built in Ruby. As you might imagine, the main testing approah consists of generating a whole bunch of different types of (quite complex) messages, loading them in...

Data-driven tests in Cucumber

I've got to test a message-routing application, whose functionality is broadly as follows: - message gets sent to app - app examines message - message gets forwarded somewhere, based on the content of the message The vast majority of test cases are near-identical; generate a particular type of message, load it into the system, wait a fe...

Perl YAML::Syck encoded string, howto properly decode in Java using JYaml?

Using beanstalkd and putting a job in tube/queue that contains a hash that is YAML::Syck encoded (with $YAML::Syck::ImplicitTyping = 1). I need some syntax help on the Java end, as to how to decode handle that string pulled from the beanstalkd job. The Perl hash ends up being encoded as a YAML string that looks like this: --- NameFir...

Safely loading a hash in Ruby

I want to load a data structure into a Ruby script which maps a string to a triple which contains some combination of regular expressions, scripts and atoms. The file that it loads from needs to be human writeable. Currently I'm writing the file to contain a Ruby hash, loading that as a string and calling eval. Ie. Data file { "key1" ...

How do I get the ruby YAML implementation to not read beyond the YAML EOF(...)

In the YAML specification it says ... is the EOF If I do: YAML.load_documents("--- abc\n--- 42\n...\nerror") { |d| puts d } I should get abc 42 But I get abc 42 error Unfortenely there is not much documentation about the YAML parses. Do I have to tell the parses to honor the EOF, or does the parser not comply to the specs? ...

YAML data sequence problem

Hello, I need to have correct order of values inside Ruby array after parsing YAML file. I have this simple example showing my issue: x = "columns:\n col_1 : ~\n col_2 : ~\n col_3 : ~\n col4 : ~" s = YAML::load(x) console output gives : x = "columns:\n col_1 : ~\n col_2 : ~\n col_3 : ~\n col4 : ~" => "columns:\n col_1...

YAML Schema: Allowing different types

I'm trying to write a schema for a YAML file using Kwalify. I have a structure that can be a string, sequence, or mapping. Basically foo: bar foo: - bar - baz foo: - name: bar count: 1 foo: - name: bar count: 1 - baz are all valid. Under the foo key, you can have a string array of strings or maps with the key...

Using YAML tags to denote types.

I don't quite understand how to use application specific YAML tags, and maybe its because my desired use of them is purely wrong. I am using YAML for a configuration file and was hoping to use tags to provide my configuration loader with a hint as to what datatype it should parse the data into - application specific datatypes. I'm also...

YAML Encoding of Malformed String, Model Serialization Issues

I've isolated a problem with Ruby on Rails where a model with a serialized column is not properly loading data that has been saved to it. What goes in is a Hash, and what comes out is a YAML string that can't be parsed due to formatting issues. I'd expect that a serializer can properly store and retrieve anything you give it, so somethi...

Consume REST YAML web service in ASP.NET

I'm using PandaStream, which sends a REST notification as YAML to our ASP.NET app. The web service I have chokes and returns 500 because it attempts to parse the content as XML. How can I stop this parsing? How do I get the content as just a big string so I can parse it myself? [WebMethod] //HOWTO? suppress XML parsing public void Updat...

Ruby YAML problem when deserializing a nested object structure

Hello guys, I have 3 classes that have the following relationship: Battlefield have an array of teams. BattleTeam have an array of members, and a reference to the Battlefield. Jaguar is a member of a BattleTeam and has a reference to it. If I serialize/deserialize Jaguar and up to BattleTeam, there is no problem. The problem happens...

Is there already a YAML library/parser for MATLAB?

I want to use YAML to communicate some data across multiple languages. (Think of it as "language-independent serialization".) One of these languages is MATLAB, but I can't seem to find a YAML library for that language. I've checked for "matlab yaml" and "matlab yaml parse" on Google and there don't seem to be any relevant results. A ...

Why do so many apps/frameworks keep their configuration files in an un-executed format?

Many frameworks keep their configuration files in a language different from the rest of the program. Eg, Appengine keeps the configuration in yaml format. to compare, DJango settings.py is a python module. There are many disadvantages I can see with this. If its in same language as rest of the program, I can Do interesting things in th...

Generated Doctrine models respect case, but generated Yaml does not

Just getting started with Doctrine ORM for PHP (v1.1.5) and ran into something unexpected. I am generating models from the db (MySQL 4) using: Doctrine::generateModelsFromDb($pathToModels); Then generating YAML from the models using: Doctrine::generateYamlFromModels($pathToSchema . '/schema.yml', $pathToModels); In the generated m...

Read a YAML file using a C script

Hi, I would like to read a thin YAML file using a simple C program. I beleve the best way for this is to use the follow library: Pyyaml.org. After reading the wiki page, I have try to use some examples here: http://pyyaml.org/browser/libyaml/branches/stable/tests/ But for a noob like me, it is not very simple to understand. If for exa...

How to express int arry[6] in YAML

Hi , I have a type int arr[6], and the value is {1,2,3,4,5,6}. How should I express this data using YAML? ...

What is the difference between YAML and JSON ; when prefer one than another

Hi, When we prefer to use YAML over JSON and vice versa considering following things : Performance(the encode/decode time) memory consumption. expression clarity library availability , easy of use (prefer C) I was planning to use one of these two in our embedded system to store configure files. Thanks. Related: Should I use YAML ...

PHP Doctrine - YAML syntax help. Default value for many to many relationship?

Hi, I have the following YAML schema for organising users in Doctrine: Person: tableName: people columns: id: type: integer primary: true autoincrement: true firstname: type: string notnull: true lastname: type: string notnull: true User: inheritance: extends: Person t...

Best way to parse a YAML file.

What is the best way to parse a YAML file in Python? ...