Robotics [RDA] - Creating an XML document by scraping a website
I am trying to scrape a website which has a list of address cards. After the scraping is done, I need to send the data over to PEGA where I can parse it and display on UI. I would like to have the data transfer format as XML. So, I have tried 2 options
Append all those string using some delimiters and later call a C# script component to parse that and build XML
Use XML Builder [something like XMLDocumentComponent] to do the same.
This would eliminate custom coding in favor of standards but I could not figure how to build the XML.
I have tried using a Schema Provider on the XML component so that a proper structure will be defined before I start using it
Then, using Create.Type method, I tried creating a child node for each address (from ListLoop component)
Finally, I have tried reading the OuterXML but got nothing
Even though point 1 worked for now, I would really want that custom code to be eliminated if point 2 works. Please suggest...
As pointed out by sasnt, you need to send the writer object that that automation block. Else, choose a different overloaded method which accepts a string (filename) and generate XML into that file [which you can read back later]. This is the way I have tried. Attached is the sample.
But for production purposes, you probably need to derive temp location and the best way obviously is to figure out the stream input method.
Could you suggest how to create the Stream (System.IO.MemoryStream) object so that I can pass it to WriteXML method? Creating Objects for .net classes in Automation designer - Is it possible?
**EDIT: After implementing the above in a script block, I now think that not everything should be fitted into an automation designer. A (reusable) custom developed DLL with a static utility method seems to be a good fit for this. (unless there is a single automation block which can achieve the same) -- thoughts please