How to return particular data from XML

Can anyone help with getting only text tag value from an XML file?

newFile.xml (1.7 KB)

3 Likes

Hi @Arun_Pondhe

You can explore this compents I think it might be helpful to you.

cheers :smiley:

Happy learning :smiley:

6 Likes

@pattyricarte do you have any example??

Kindly have a view on this thread

Cheers @Arun_Pondhe

2 Likes

Hi @Arun_Pondhe,

You can use this pattern to extract the text from the text tag.

(?<=<text.*>)\S.+(?=</text>)

I’m attaching the workflow for your reference. ExtractTextTagValue.xaml (6.4 KB)

Please marked it as solution if it helped you.

1 Like

What is Note in if else condition is it tag name

2 Likes

Yah instead of that you can replace with your tag name
Cheers @Arun_Pondhe

1 Like

item.Name.LocalName is not getting in my scenario

3 Likes

Did we change the type argument in the for each loop activity that is change the type to xelement type by selecting browse types in the property panel
And try once
Cheers @Arun_Pondhe

1 Like

@Arun_Pondhe
ensure your XML is valid. I had a look on your provided sample and it is invalid in its structure and syntax.
I would suggest to correct it first, before setting up the retrieval part.

1 Like

How to convert that XML into correct format is any way there

1 Like

@Arun_Pondhe
manually correction is needed. Online/Toolbased validation of the corrected XML is recommended as well.

1 Like

can you help me to make xml in proper format

Yes I can have a look on it later on my afternoon as I will travel.
In the meanwhile please specify in detail what do you want to rtrieve from the XML. Thanks

page1.xml|
attachment
(18.0 KB)

I want to retrieve only inside the information between text tag

@Arun_Pondhe
the last attached page1.xml was ok as <pdf2xml element was even closed on the end

PFA demo sample
Arun_Pondhe.xaml (9.5 KB)

running standalone and showcasing following:

  • text element retrieval
  • text value retrieval
  • attribute value retrieval
  • transforming retrieved text values to a list of string

grafik

Please ensure following:
adopt the xaml to your correct XML FilePath
grafik

the XML/Linq references are imported
grafik

Let us know your open questions and flag the solution post. Others can so benefit from.

1 Like