From 02b2317f89c4ca5d8038659e8bd9b5afb0144ef8 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 8 Jul 2012 09:30:51 +0000 Subject: [PATCH] * added helpers for xml processing --- source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy index 41b3feb1..7d0dbaf3 100644 --- a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy +++ b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy @@ -63,10 +63,12 @@ import static net.sourceforge.filebot.web.WebRequest.* URL.metaClass.getText = { readAll(getReader(delegate.openConnection())) } URL.metaClass.getHtml = { new XmlParser(new org.cyberneko.html.parsers.SAXParser()).parseText(delegate.getText()) } +URL.metaClass.getXml = { new XmlParser().parseText(delegate.getText()) } URL.metaClass.fetch = { fetch(delegate) } ByteBuffer.metaClass.getText = { csn = "utf-8" -> Charset.forName(csn).decode(delegate.duplicate()).toString() } ByteBuffer.metaClass.getHtml = { csn = "utf-8" -> new XmlParser(new org.cyberneko.html.parsers.SAXParser()).parseText(delegate.getText(csn)) } String.metaClass.getHtml = { new XmlParser(new org.cyberneko.html.parsers.SAXParser()).parseText(delegate) } +String.metaClass.getXml = { new XmlParser().parseText(delegate) } URL.metaClass.get = { delegate.getText() } URL.metaClass.post = { Map parameters -> post(delegate.openConnection(), parameters) }