Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7DECF200BE4 for ; Wed, 21 Dec 2016 20:59:02 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7C945160B26; Wed, 21 Dec 2016 19:59:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C3BD4160B18 for ; Wed, 21 Dec 2016 20:59:01 +0100 (CET) Received: (qmail 63780 invoked by uid 500); 21 Dec 2016 19:59:00 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 63770 invoked by uid 99); 21 Dec 2016 19:59:00 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Dec 2016 19:59:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 1B86A18C4B4 for ; Wed, 21 Dec 2016 19:59:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id qOZOziOmIRyl for ; Wed, 21 Dec 2016 19:58:59 +0000 (UTC) Received: from mail-qt0-f182.google.com (mail-qt0-f182.google.com [209.85.216.182]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id C90245F4EE for ; Wed, 21 Dec 2016 19:58:53 +0000 (UTC) Received: by mail-qt0-f182.google.com with SMTP id p16so213621568qta.0 for ; Wed, 21 Dec 2016 11:58:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=zkD4DNQateCrAmZ2Iuljbt72udnshrYoyIsPkLZITnA=; b=YvZzBxdpB1tcM3RXGpGvfR4hAm6FWXF1Gi8H4VnD0YkE0St5fNM3oiw9QhwJLmKQX+ y0IVcQd26v1rZbkHveRmZrZgErcVY+gA6M4zC4Xflg4In/x6xqQ2lwaz1e/bAnXeDF74 XwQ2o4Ai2WeCaNb4FVDqdu0eHdSX2981gpddnD97b8C0ywGl6z26ipTPJahn5sauPfIF XHNKX0574CSHnjp+P3uhfwvitm36+buc2CdVwcKHx0z8PSrC9TODdpHoAKZEifTvsUiv qFf7our8yP/pyVK1XKs3SExnXGll5IoHCkf5zlXZToJZXXpIdn0ng9RdymMzPFOAKPpL KPug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=zkD4DNQateCrAmZ2Iuljbt72udnshrYoyIsPkLZITnA=; b=TPG43TIXUZdKZ5Qijy2iRaZx+/TZxO8KGvAB18uXJy7yTPy4IL95997Euap4SoHBXD eKtOEcvp864sctdpKMPT1sGBiTysAYPRLCjsIm7Jj6YZtaYm2D5hM4NoaP4lH+3VNdh5 WXQRoqaK8k45PsnzLw/40Txhd0WwQiWGKUP+Rz1SIEHLfQ2eTqTwMu6tVrq7C6psE4rX aJJpgNqb2la7MouelU7VQpRqoQFHHWB2tvtiZ5TuYquug95DR6oN6C1OldDkjpGBZEXa WUZ4oA6CKMLwBOtHOAZmthstsKoFKVuPzmkYl6YMxzOK6wxgX3+FCN2RTO+hn1/GmJy/ A27A== X-Gm-Message-State: AIkVDXJZgj7DIhJQCU3ILdUOuSveZ99PJg7/ynUaw5NhS6V7+vqXk/msOKKMUhgqJ2dX4oOEjRx0lXktIE51PQ== X-Received: by 10.237.33.173 with SMTP id l42mr6242447qtc.271.1482350329667; Wed, 21 Dec 2016 11:58:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.55.26.70 with HTTP; Wed, 21 Dec 2016 11:58:49 -0800 (PST) From: Dimitar Vassilev Date: Wed, 21 Dec 2016 21:58:49 +0200 Message-ID: Subject: parsing YAML with snakeyaml To: users@groovy.apache.org Content-Type: multipart/alternative; boundary=001a113e46fed52ac405443094a3 archived-at: Wed, 21 Dec 2016 19:59:02 -0000 --001a113e46fed52ac405443094a3 Content-Type: text/plain; charset=UTF-8 Good evening/morning/day, Quick one how can I parse a YAML file with groovy and snakeyaml I have a nested hash YAML like: pkgcolls: pkgcol1: software:Foo version:baz pkgcol2: software:baz version:Foo In Ruby I can do something like in the irb/file require 'yaml' thing = YAML.load_file('some.yml') puts thing.inspect How can I do similar thing in groovy using import org.yaml.snakeyaml.DumperOptions import org.yaml.snakeyaml.Yaml and the yaml.load(object) function? I would like to loop through the YAML structure and figure out which kind of loop to use. I'm interested in dealing directly with the pkgcol(1-N) attributes directly if possible. Thanks --001a113e46fed52ac405443094a3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Good evening/morning/day,
Quick one how can I parse a = YAML file with groovy and snakeyaml

I have a neste= d hash YAML like:

pkgcolls:
=C2=A0 pkgco= l1:
=C2=A0 =C2=A0 =C2=A0software:Foo
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0version:baz
=C2=A0 pkgcol2:
=C2=A0 =C2= =A0 =C2=A0software:baz
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0version:= Foo

In Ruby I can do something like in the irb/fil= e
require 'yaml'
thing =3D YAML.load_file(= 'some.yml')
puts thing.inspect

=
How can I do similar thing in groovy using

import org.yaml.snakeyaml.DumperOptions
import org.yaml.snakey= aml.Yaml

and the yaml.load(object) function?=
I would like to loop through the YAML structure and figure out w= hich kind of loop to use.
I'm interested in dealing directly = with the pkgcol(1-N) attributes directly if possible.
Thanks
--001a113e46fed52ac405443094a3--