Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,
In a XML file i want read a tag and search for word. Below is the XML format of the powerpoint(pptx) slide. In which i want search text in a slide which comes under the tag
<a:t xmlns:a="#unknown">TEXT IN A POWERPOINT SLIDE

So, is there any way to only searching for <a:t xmlns:a="#unknown"> tag? Using XPATH will not work on this XML format.
Could any body help me on this?

HTML
- <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
- <p:csld>
- <p:sptree>
- <p:nvgrpsppr>
  <p:cnvpr id="1" name="" /> 
  <p:cnvgrpsppr /> 
  <p:nvpr /> 
  </p:nvgrpsppr>
- <p:grpsppr>
- <a:xfrm>
  <a:off x="0" y="0" /> 
  <a:ext cx="0" cy="0" /> 
  <a:choff x="0" y="0" /> 
  <a:chext cx="0" cy="0" /> 
  </a:xfrm>
  </p:grpsppr>
- <p:sp>
- <p:nvsppr>
  <p:cnvpr id="2" name="Title 1" /> 
- <p:cnvsppr>
  <a:splocks nogrp="1" /> 
  </p:cnvsppr>
- <p:nvpr>
  <p:ph type="ctrTitle" /> 
  </p:nvpr>
  </p:nvsppr>
  <p:sppr /> 
- <p:txbody>
  <a:bodypr /> 
  <a:lststyle /> 
- <a:p>
- <a:r>
  <a:rpr lang="en-GB" dirty="0" smtclean="0" /> 
  <a:t>Text entered for test</a:t> 
  </a:r>
  <a:endpararpr lang="en-GB" dirty="0" /> 
  </a:p>
  </p:txbody>
  </p:sp>
- <p:sp>
- <p:nvsppr>
  <p:cnvpr id="3" name="Subtitle 2" /> 
- <p:cnvsppr>
  <a:splocks nogrp="1" /> 
  </p:cnvsppr>
- <p:nvpr>
  <p:ph type="subTitle" idx="1" /> 
  </p:nvpr>
  </p:nvsppr>
  <p:sppr /> 
- <p:txbody>
  <a:bodypr /> 
  <a:lststyle /> 
- <a:p>
- <a:r>
  <a:rpr lang="en-GB" dirty="0" smtclean="0" /> 
  <a:t>TEXT ENTERED FOR TEST</a:t> 
  </a:r>
  <a:endpararpr lang="en-GB" dirty="0" /> 
  </a:p>
  </p:txbody>
  </p:sp>
  </p:sptree>
  </p:csld>
- <p:clrmapovr>
  <a:masterclrmapping /> 
  </p:clrmapovr>
  </p:sld>
Posted
Updated 4-Oct-11 3:31am
v2
Comments
Mehdi Gholam 4-Oct-11 11:11am    
Why don't you just plain search?
Member 8132974 4-Oct-11 23:52pm    
Plain search may return some unwanted result
Sergey Alexandrovich Kryukov 4-Oct-11 11:55am    
Why XPATH does not work? What makes you thinking so?
--SA
Member 8132974 4-Oct-11 23:56pm    
Will it work? I am not sure. Because schema will be different for different xml files... How to trace in to the tag a:t because Textbody may appear anywhere in the xml according to the slide design. Or am I wrong in understanding XPATH??
Sh.Murugan 5-Oct-11 3:05am    
Hi,

Please clearly tell me that, you need to find a tag(element) or a particular tag values in that xml file? so that i can give some good solutions.

1 solution

Let's breakdown the search process, then create the search function in C#
1.) What are we looking for?
2.) Where in the file do we THINK it might be? (top, bottom, left, right, upside down?)...etc
3.) search that location
4.) IF your desired substring isn't found then search the whole file, IF it is in fact FOUND, then get the text from inside of our XML tags.
I don't have the code for this but that might or might not help you out.
Anyways, here's some links you might try:
http://stackoverflow.com/questions/3092530/linq-how-to-search-data-from-large-xml-file[^]
Large XML Files Processing and Indexing[^]

Oh, and...
Try breaking the XML file into 2 parts, and search both subfiles at the same time and that might help on search time.

this link will help you split the xml file into smaller sub files.
Split large XML files into small files[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900