You are viewing limited content. For full access, please sign in.

Question

Question

Need Help Parsing XML File

asked on August 26, 2015 Show version history

I have a workflow that is using an HTTP request that receives back an XML file. Within this XML file there is the following snippet of code:

<link rel="edit" title="FieldResponses" href="FieldResponses(767729)" />
            <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FormsSent" type="application/atom+xml;type=entry" title="FormsSent" href="FieldResponses(767729)/FormsSent" />
            <category term="APIModel.FieldResponses" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
            <content type="application/xml">
              <m:properties>
                <d:id m:type="Edm.Int32">767729</d:id>
                <d:AppNo m:type="Edm.Int32">19973</d:AppNo>
                <d:TraitID m:type="Edm.Int32">1117</d:TraitID>
                <d:Value>Signature=Amanda Test|ClientTimestamp=Wed Jun 17 2015 15:41:57 GMT-0600 (Mountain Daylight Time)|ServerTimestamp=6/17/2015 4:41:57 PM|UtcTimestamp=2015-06-17 21:41:57Z|ClientIP=209.141.120.194|AuthenticatedAs=User - wadeheat - wadeheat@d91.k12.id.us</d:Value>
                <d:ExtendedValue></d:ExtendedValue>
                <d:EmpNo m:type="Edm.Int32" m:null="true" />
              </m:properties>
            </content>
          </entry>
        </feed>
      </m:inline>
    </link>

There are a lot of similar sections like this in the file. We are needing to specifically look for the <d:TraitID...> 1117</d:TraitID> value. Once we find that, I need to know the value of the <d:Value> tag directly after that..

How would I do this using the Read XML activity in Workflow?

1 0

Answer

SELECTED ANSWER
replied on August 26, 2015

Try this

 

//d:TraitID[text()='1117']/../d:Value

1 0
replied on August 26, 2015

I tried that, but I receive an "Invalid XPath Expression" error. How did you get to the screenshot

0 0
replied on August 26, 2015

Click on advanced properties (the gear in the upper right of the activity)

0 0
replied on August 27, 2015

That worked! Thank you so much!

1 0
replied on October 4, 2019 Show version history

how to read an xml file with the following format in workflow through read xml?

 

https://answers.laserfiche.com/questions/165225/how-to-read-an-xml-file-with-the-following-format-in-workflow-through-read-xml

 

Thanks!

0 1

Replies

replied on January 28, 2016

This helped me as well. Thanks

1 0
replied on August 26, 2015

Hi Blake,

This is a bit hard to answer because you have an incomplete (and invalid)  xml snippet. I think you want something like

//properties[contains(TraitID, "1117")]/Value

which says pick the element properties, who contains a TraitID 1117, and then get it's value Element. You'll probably need to account for the namespaces too (see the advanced properties of ReadXML).

0 0
replied on August 26, 2015

Ed, I apologize. I didn't realize I cut off part of the XML. Attached a copy of the actual XML file I am working with. Thank you for your help.

new4.txt (121.96 KB)
1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.