How to get information about a file from XML

Consider an XML file that contains data about the books with their titles and publishers. This file also contains the Base64-encoded image of some book and the reference to the annotation of another book.


<?xml version="1.0" encoding="iso-8859-1" ?> 
<Books>
	<Book>
		<Title>Beginning XML</Title>
		<Publisher>Wrox</Publisher>
		<Image>/9j/4QDmRXhpZgAASUkqAAgAAAAFABIBAwABAAAAAQAAADEBAgAcAAAASgAAADIBAgAUAAAA 
		 ZgAAABMCAwABAAAAAQAAAGmHBAABAAAAegAAAAAAAABBQ0QgU3lzdGVtcyBEaWdpdGFsIElt 
		 YWdpbmcAMjAxMDowMzoxMiAxMzowOToyOQAFAACQBwAEAAAAMDIyMJCSAgAEAAAAMjkyAAKg 
		 BAABAAAADAAAAAOgBAABAAAADQAAAAWgBAABAAAAvAAAAAAAAAACAAEAAgAEAAAAUjk4AAIA 
		 BwAEAAAAMDEwMAAAAAC8KRR8/8AAEQgADQAMAwEhAAIRAQMRAf/bAIQAAwICAgIBAwICAgMD 
		 AwMEBwQEBAQECQYGBQcKCQsLCgkKCgwNEQ4MDBAMCgoPFA8QERITExMLDhUWFRIWERITEgEE 
		 BQUGBQYNBwcNGxIPEhsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsb 
		 GxsbGxsbGxsb/8QAWgABAQEAAAAAAAAAAAAAAAAAAwYIEAABBAICAwADAAAAAAAAAAABAgME 
		 BQYRByEIEhMAFBUBAQAAAAAAAAAAAAAAAAAAAAARAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEA 
		 AhEDEQA/ANZeVHk+/wCP2bYHHWzDj1tlYGwvZljKabH8lpxqPJSw2pf0efQqZHfCUJHshpwA 
		 k7AvuRsXzu6zhmZjPNOb4rDEUNmFRY3X2Mdawte3C7IiOq9j0NBQSAlPWySQe44e47ybkGfy 
		 RkVVY2M66oXsdlRX7iSYaoD4AdY/X9/iAr59kICux30Px0cVYbS43VYxXuZNCg4/XsVUNmvy 
		 ifFQGGkBKAoJe2tQToe6ypWgkb0BoP/Z
		</Image>
	</Book>
	<Book>
		<Title>XML Step by Step</Title>
		<Publisher>MSPress</Publisher>
		<Annotation>\\srv\Annotations\annot1.txt</Annotation>
	</Book>
	<Book>
		<Title>Professional XML</Title>
		<Publisher>Wrox</Publisher>
	</Book>
	<Book>
		<Title>Developing XML solutions</Title>
		<Publisher>MSPress</Publisher>
	</Book>
</Books>

         

You may want to send the image and the annotation to a folder.

  1. Design a workflow with AutoCapture, XML Importer and Send to Folder components.
  2. On the Fields tab of the XML Importer configuration, add the search field FilePath with corresponding XPath query: *//Annotation.
  3. On the Files tab, add the following items:
    • FileName = Image.jpg, Content Type = Base64, File Content = *//Image
    • Content Type = File Path, File Content = ~XIM::%FilePath%~
  4. Configure other components in the workflow.
  5. Run the process.
  6. Send the XML file to the process by AutoCapture client.

The following two files will be sent to the desired folder:

  • Image.jpg — The image that was read from the XML file's node.
  • annot1.txt — The annotation file found by the specified path that was retrieved from the XML file's node.