Discussion

XML Parsing

Is it possible to parse the normal XML file through the Whizard XSD/DTD whizard as shown below.Every time If I want to run through the whizard do I need to create a XSD file everytime in the server.Please provide me the solution. <?xml version="1.0"?> <catalog> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book> </catalog>

***Updated by moderator: Marissa to close post***
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

December 18, 2008 - 4:19pm

how can you parse something like this:

<?xml version="1.0"?>
<p:catalog xmlns:p="http://bookshop.com">
<p:book id="bk101">
<p:author>Gambardella, Matthew</p:author>
<p:title>XML Developer's Guide</p:title>
<p:genre>Computer</p:genre>
<p:price>44.95</p:price>
<p:publish_date>2000-10-01</p:publish_date>
<p:description>An in-depth look at creating applications with XML.</p:description>
</p:book>
</p:catalog>

Pega
July 30, 2008 - 9:33am

You can manually configure an XML parse rule. In your case, the element name key for the parse rule should be "catalog", and it will contain "Set Value" steps that have the following source paths:

1. book/@id
2. book/author
3. book/title
4. book/genre
5. book/price
6. book/publish_date
7. book/description

Assuming that a catalog can contain multiple books, you can populate a page list property by adding two steps before the "Set Value" steps, both with "book" as the source path value:

1. Find All Nodes (no target)
2. Append Page To Page List (target is a Page-List property reference)

You could also use the "id" attribute as a page group key:

1. Find All Nodes (no target)
2. Set Group Key (book/@id should be the source path, $NODE-VALUE the target)
3. Add Page To Page Group (target is a Page-Group property reference)

There's one really annoying config issue that I should mention: the target property references for the "Set Value" steps are relative to the page class of any embedded gage, page list, or page group property you are modifying. The SmartPrompt in the target column will not work correctly in this case, and you should not rely on it. The target field should -not- contain a full property reference that includes the embedded gage, page list, or page group reference.