header
header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
January 09, 2009, 03:14:37 pm
Username: Password:
Login with username, password and session length

Forgot your password?
 
How to call 'Format XML' programmatically
Welcome, Guest. Please login or register.
January 09, 2009, 03:14:37 pm
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  How to call 'Format XML' programmatically
« previous next »
Pages: [1] Print
Author Topic: How to call 'Format XML' programmatically  (Read 361 times)
PeterT
Newbie
*
Posts: 12


« on: March 19, 2008, 12:39:26 am »

Hi again

Does anyone know how to call 'Format XML' (as in the function available from the right-click menu when in a Request) programmatically?

I had to populate some elements in a request using the XMLParser method defined in the user docs.  Usually I would use the much simpler methods on the XmlHolder class e.g.holder["//path"] = value but because I have a complex type that has 2 same named elements in them I couldn't get work out how to write to the second element.

e.g.<Accounts>
         <Account>
           <Value></Value>
        </Account>
        <Account>
           <Value></Value>
       </Account>
      </Accounts>

Anyway, I successfully managed to update the values but the new XML generated puts each tag or end tag on a new line and appears to add whitespace to some of the existing values.  When I 'Format XML' this is remedied but I need to be able to call 'Format XML' from within my script.

If anyone can let me in on how to do this that'd be great.

Cheers

Peter
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,666


« Reply #1 on: March 19, 2008, 12:45:58 am »

Hi Peter,


try

def xml = .. create XML string..
xml = com.eviware.soapui.support.xml.XmlUtils.prettyPrintXml( xml )

Hope this helps!

regards,

/Ole
eviware.com
Logged
PeterT
Newbie
*
Posts: 12


« Reply #2 on: March 19, 2008, 01:21:29 am »

Awesome, it worked! Thanks for your help again Ole  Smiley
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header