アドビ
製品

トップ

  • Adobe Creative Cloud
  • Creative Cloudグループ版
  • Creative Suite 6
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst

教育向け

  • 学生・教職員個人向け
  • 小・中・高等学校機関
  • 高等教育機関

Adobe Creative Cloud

  • Adobe Creative Cloudとは?

デザインと写真処理

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom
  • Elementsファミリー

ビデオ

  • Adobe Premiere Pro
  • After Effects

Web開発&HTML5

  • Edgeツール&サービス [新規ウィンドウで開く]
  • Dreamweaver
  • ゲーム [新規ウィンドウで開く]
  • モバイルアプリ

Adobe Marketing Cloud

  • Adobe Marketing Cloudとは?
  • 分析
  • Webエクスペリエンスマネジメント
  • 広告管理
  • テストとターゲティング
  • ソーシャルマーケティング

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Target

  • Test&Target
  • Recommendations

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Meida Manager

  • AdLens

ドキュメントサービス

  • Acrobat
  • FormsCentral [新規ウィンドウで開く]
  • SendNow [新規ウィンドウで開く]
  • Acrobat.com [新規ウィンドウで開く]

パブリッシング

  • Digital Publishing Suite

  • すべての製品を見る
ビジネスソリューション

Digital Media

  • Creative Cloudグループ版
  • ユーザー事例
  • Digital Media事例

ビジネスニーズ別

  • 分析
  • デジタルパブリッシング
  • ドキュメント管理
  • 広告管理
  • ソーシャルマーケティング
  • テストとターゲティング
  • ビデオ編集と公開
  • Web開発 [新規ウィンドウで開く]
  • Webエクスペリエンスマネジメント
  • すべてのビジネスニーズを見る

Digital Marketing

  • Adobe Marketing Cloud
  •  
  • Digital Marekting事例

業種別

  • 放送業界
  • 教育機関
  • 金融機関
  • 行政機関
  • 出版
  • 小売
  • 全業種を見る
サポートとラーニング

サポート

  • サポートホーム
  • サポートプログラム
  • 製品ヘルプ
  • ダウンロードとインストールヘルプ
  • Adobe Creative Cloud メンバーシップサポート
  • サポートお問い合わせ

ラーニング

  • ラーニングとチュートリアル
  • マーケター向けトレーニングサービス [新規ウィンドウで開く]
  • Photoshopマガジン
  • デザインマガジン
  • Focus In(ビデオ制作者向け)
  • Adobe Developer Connection
  • アトリエ(初心者向け写真編集)
  • Adobe Marketing Center
  • Adobe Marketing Cloud Japan Blog [新規ウィンドウで開く]
  • 認定制度
ダウンロード
  • 体験版
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • すべてのダウンロードを見る
会社情報
  • 採用情報
  • 投資家の皆様へ(英語)
  • プレスルーム
  • プライバシー
  • 企業の社会的責任(CSR)
  • ショーケース
  • お問い合わせ
  • その他の会社情報
ご購入
  • 個人・プロフェッショナル向け製品
  • 学生・教職員向け製品
  • 小中規模ビジネス向け製品
  • ライセンスについて
  • キャンペーン情報
  • Adobe Marketing Cloudお問合せ [新規ウィンドウで開く]
  • 販売パートナー
検索
 
情報 サインイン
サインインの目的 お客様のアカウントや体験版ダウンロード、製品の拡張機能、コミュニティエリアへのアクセスなどを管理するため
ようこそ、さん
My Adobe
注文状況
ユーザー情報
マイアカウント
製品およびサービスの登録状況
サインアウト
カート
プライバシー My Adobe
アドビ
製品 セクション 購入   検索  
ソリューション会社情報
サポートラーニング
サインイン サインアウト プライバシー My Adobe
先行予約の提供開始予定日Date. 商品が発送されるまで、クレジットカードには課金されません。提供開始の予定日は変更される場合があります。 先行予約の提供開始予定日Date. ダウンロードの準備が整うまで、クレジットカードには課金されません。提供開始の予定日は変更される場合があります。
個数:
(消費税を含む )
ご購入には学生・教職員個人版の購入資格の確認が必要です。
小計 (税込)
キャンペーン ( 税込)
送料( 税込)
消費税
Calculated at checkout
合計 ( 税込)
カートの中身を見る
Adobe Developer Connection [ADC] / ADEP /

Using the Execute Script Service in LiveCycle Workbench ES2 to build XML data

著者 Deke Smith

Deke Smith
  • twintechs.com

Content

  • Using the Execute Script Service in a Process
  • Creating XML Using the Execute Script Service
  • Where to go from here

Created

4 April 2011

ページ ツール

Facebookでシェア
Twitterでツイート
LinkedInでシェア
ブックマーク
印刷

この記事に設定されたタグ

LiveCycleXML

必要条件

ユーザーレベル

中級

必要な製品

  • LiveCycle Designer ES4 (Download trial)
  • LiveCycle Workbench ES (Download trial)

There is a lot of XML involved with Adobe LiveCycle Process Management workflows, for instance: XML information may be built in a process and sent to a Flex application in Adobe LiveCycle Workspace ES2, used for systems settings, or passing information to and from forms. There are many instances where a LiveCycle developer needs to manage XML, and many times this requires that the XML be managed via a LiveCycle process.

When dealing with simple XML settings, one may use the "Set Value" service, which is a default LiveCycle service. This service sets the value of one or more data items in the process data model. For very simple conditional logic "if this, then that" scenarios, this service can suit the purpose.

However, in more complex situations, the Set Value service isn't as effective. In these situations, one needs to rely on a more robust set of programming commands, such as those provided by a programming language like Java. Using Java to build complex XML can be much easier and more clear than building an XML document from simple text within the Set Value service. In addition, it is easier to include conditional programming in Java than within a Set Value service.

Using the Execute Script Service in a Process

Within the set of the standard LiveCycle services available in LiveCycle Workbench ES2, is the "Execute Script" service. This service lets you execute scripts in processes and provides the "executeScript" operation to do so.

Create an Application and a Process with the "Execute Script" Service Defined as an Activity

Overall application and process creation is out-of-scope for this tutorial, but for the sake of this instruction, we have created an application named "DemoApplication02". Assuming that an application has already been created, we need to create a process in this application to call the executeScript service. To add a process to the application that includes the "Execute Script" service:

  1. Right click on your application and select "New". In "New" slide-out menu, select "Process". Name your process accordingly, add a description if necessary, and select the icon you wish to represent this process. For the purposes of this tutorial, we have created a process and named it the "executeScriptDemoProcess".
  2. Define your start points, or simple opt to add your start points later.
  3. The process is now created and should automatically open in the "Process Design" window. In this window, click on the Activity Picker icon at the top of the Process Design window and drag the new activity onto the swim lane. At this point, the "Define Activity Window" should appear (see Figure 1 below).
the Define Activity Window should appear.
Figure 1. the Define Activity Window should appear.
  1. The executeScript service can be found under the "Foundation" set of services. The Services name lists the object as "Execute Script – 1.0" with the Operation name "executeScript". Click to select this item.
  2. This process should now be created, and by default the "Process Properties" window should appear in the pane on the left.

Add a Script to the Process with the "Execute Script" Service

Once the process has been created with the "Execute Script" Service activity defined, one can then add a script to this process. To add a script to this process:

  1. Navigate to the "Process Properties" palette. Within this palette, expand the "Input" section and click on the "…" icon.
  2. In the text box that appears write your script. When the script has been written press OK (see Figure 2).
When the script has been written press OK.
Figure 2. When the script has been written press OK.

Creating XML Using the Execute Script Service

Once a process has been created with the Execute Script service included, one can then use this script to create XML. One would write the scripts described below in the text box described in the Add a Script to the Process with the "Execute Script" Service section above.

About the Execute Script Service's Technology

In order to know what the abilities and limitations of the Execute Script service are, one must know the technological underpinnings of the service. LiveCycle uses the Apache Xerces Document Object Model (DOM) parser to create and store XML variables within processes. Xerces is a Java implementation of W3C's Document Object Model specification; defined here. The DOM specification is a standard way of manipulating XML that has been around since 1998. The Java implementation of Xerces, Xerces-J, supports DOM Level 2 version 1.0.

The Java classes used to store XML variables are:

  • org.apache.xerces.dom.NodeImpl and
  • org.apache.xerces.dom.DocumentImpl.

DocumentImpl is a subclass of NodeImpl, so it can be supposed that any XML process variable is a NodeImpl derivation. You can find the documentation for NodeImpl here.

A Sample XML Creation Using the Execute Script Service

Here is the example of creating XML, within an Execute Script service. The process has a variable, node, that is of type XML. The end result of this activity will be an XML document. What that document does, or how it applies to the overall process is out-of-scope for this tutorial; ultimately it comes down to what the XML is required to do in the overall application. As was mentioned in the introduction, XML can be used for many purposes in LiveCycle forms and processes, this is simply an explanation of how to code the Execute Script activity to output a simple XML document.

A simple Java script to output XML would looks something like this:

import org.apache.xerces.dom.DocumentImpl; import org.w3c.dom.Document; import org.w3c.dom.Element; Document document = new DocumentImpl(); Element topLevelResources = document.createElement("resources"); Element resource = document.createElement("resource"); resource.setAttribute("id", "first item id"); resource.setAttribute("value", "first item value"); topLevelResources.appendChild(resource); document.appendChild(topLevelResources); patExecContext.setProcessDataValue("/process_data/node", document);

Note: that the aforementioned DOM objects must be imported into the script.

The result of this simple script is a new XML document with a variable node that is set to:

<resources> <resource id="first item id" value="first item value"/> </resources>

Using an Iterative loop to Add Nodes to the XML

Nodes can be added to an existing XML variable within the process, too. The variable, node, contains the XML object we just created.

Document document = patExecContext.getProcessDataValue("/process_data/node"); NodeList childNodes = document.getChildNodes(); int numChildren = childNodes.getLength(); for (int i = 0; i < numChildren; i++) { Node currentChild = childNodes.item(i); if (currentChild.getNodeType() == Node.ELEMENT_NODE) { // found the top level node Element newResource = document.createElement("resource"); newResource.setAttribute("id", "second item id"); newResource.setAttribute("value", "second item value"); currentChild.appendChild(newResource); break; } } patExecContext.setProcessDataValue("/process_data/node", document);

The variable node in the XML is now set to:

<resources> <resource id="first item id" value="first item value"/> <resource id="second item id" value="second item value"/> </resources>

Where to go from here

To learn more about the Set Value service mentioned in the introduction section of this document, refer to the following:

  • Adobe's official LiveCycle Help documentation that refers to services
  • the main Adobe Help entry for the Execute Script service

Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License+Adobe Commercial Rights

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

More Like This

  • Transforming JDBC service output using the Query for Multiple Rows as XML operation
  • Record-based processing using LiveCycle Output ES
  • Binding an XML Schema Document (XSD) to repeating subform elements using Adobe LiveCycle Designer

製品

  • Adobe Creative Cloud
  • Creative Cloudグループ版
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elementsファミリー
  • SiteCatalyst
  • 教育向け

ダウンロード

  • 体験版
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

サポート

  • ヘルプ&サポート
  • 注文と返品
  • ダウンロードに関するヘルプ
  • ユーザー登録に関するヘルプ

ラーニング

  • トレーニング
  • Adobe TV
  • デザインマガジン
  • Photoshopマガジン
  • Focus In(ビデオ制作者向け)
  • Adobe Developer Connection [ADC]
  • 初心者向け写真編集
  • Adobe Marketing Cloud Japan Blog

ご購入

  • 個人・プロフェッショナル向け製品
  • 学生・教職員向け製品
  • 小中規模ビジネス向け製品
  • ライセンスについて
  • キャンペーン情報
  • 販売パートナー

会社情報

  • プレスルーム
  • パートナープログラム
  • 企業の社会的責任(CSR)
  • 採用情報
  • 投資家の皆様へ(英語)
  • イベント
  • 法的事項
  • セキュリティ
  • お問い合わせ
地域を選択してください 日本(変更)
地域を選択してください 閉じる

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Software Ireland Ltd. All rights reserved.

利用条件 | プライバシー | Cookie

Reviewed by TRUSTe: site privacy statement