Strip off the base64 content from an XML and saving the rest in streaming fashion using XML Reader Class.

Hi,
I'm presently working in a scenario, where i need to read an XML (having base64 encoded images) using XmlReader class in a streaming fashion (considering the performance) .
1) I have to strip offs the base64 encoded contents from the xml (front & back image node).
2) Than saving the remaining XML (without base64 content) . 
Sample XML:-
<?xml version="1.0" encoding="utf-8"?>
<tran>
  <tranheader>
 <feild1></feild1>
  </tranheader>
  <item>
<fields></fields>
    <image>
      <frontimage>base64_content</frontimage>
      <rearimage>base64_content</rearimage>
    </image>
  </item>
  <item>
    <fields></fields>
    <image>
      <frontimage>base64_content</frontimage>
      <rearimage>base64_content</rearimage>
    </image>
  </item>
  <trantrailer>
    <feild1></feild1>
  </trantrailer>
</tran>
Please guide.
Thanks & Regards

E.g. a simplified skeleton:
namespace ConsoleCS
using System;
using System.IO;
using System.Xml;
using System.Xml.Linq;
class Program
static void Main(string[] args)
XDocument xdocument = XDocument.Parse(@"
<Items>
<Item>Test with a child element <more/> stuff</Item>
<Item>Test with a CDATA section <![CDATA[<456>]]> def</Item>
<Item>Test with a char entity: &#65;</Item>
<SkipItem>Item to skip.</SkipItem>
<!-- Fourteen chars in this element.-->
<Item>1234567890ABCD</Item>
</Items>");
StringReader stringReader = new StringReader(xdocument.ToString());
XmlReader xmlReader = XmlReader.Create(stringReader);
xmlReader.MoveToContent();
while (xmlReader.Read())
switch (xmlReader.NodeType)
case XmlNodeType.Element:
if (xmlReader.Name == "SkipItem")
Console.WriteLine("Skipping..");
else
Console.WriteLine("Pushing to output ({0}).", xmlReader.Name);
break;
Console.WriteLine("Done.");
Console.ReadLine();

Similar Messages

  • In PC I have changed the default app location from default to other and copied the previous content to new location and changed the Default location in preference. Now in iTunes, my previous apps are not visible. Is there any solution to this?

    In PC I have changed the default app location from (c:/users/username/My Music/iTunes) to other (d:iTunes)  and copied the previous content to new location and changed the Default location in Edit preference. Now in iTunes, my previous apps are not visible. Is there any solution to this?

    wjosten - thanks very much for the detailed instructions. I'll try this as soon as I get my replacement and it looks like you'll probably end up getting the green tick

  • Search for a tag in xml and modify the content

    Hi,
    I am quite new to using xml db and i want to know how to search a xml, modify a tag value inside xml and replace the content in xml.
    Please help me to find a solution for this.
    Regards,
    Sprightee

    Hi,
    First important thing : give your database version (SELECT * FROM v$version).
    Please also provide some sample data :
    - a typical XML document you're working with (or abridged version)
    - explain what change(s) you want to do, or give expected output
    - if you're using a table to store the XML (which is preferred), give the DDL

  • Everything is updated!!  iPhone, iPad, iTunes and MacBook Pro...  All I am trying to do is drag content from my iTunes Library to the devices.  iTunes gets stuck EVERY single time!  What usually triggers the Non-Sense is when I am adding a 2nd file!

    Everything is updated!!  iPhone, iPad, iTunes and MacBook Pro...  All I am trying to do is drag content from my iTunes Library to the devices.  iTunes gets stuck EVERY single time!  What usually triggers the Non-Sense is when I am adding a 2nd file!
    Why does iTunes SUCK??
    1) Many items greyed out in the menu bar, for well over 2 years, maybe more!
    2) I Can't drag more than one piece of content from your iTunes library to any device (iPhone, iPad)
    If you do it gets stuck for HOURS and HOURS in "Preparing To Update" and the little activity circle never completes, ever!!
    I used to be able to drag over 1000 tunes, movies, etc. go have breakfast come back and it would all be on my device!!
    Can't do it anymore, one song at a time, maybe an album at a time, or one movie, and that is it!!
    If you do a 2nd item the other items stop loading and never continue!!
    This is so BAD, I don't understand how they don't have this fixed yet!!
    Please tell me I am not the only one!!
    ...and If I am tell me how to fix it!
    Very appreciated,
    Joe

    Everything is updated!!  iPhone, iPad, iTunes and MacBook Pro...  All I am trying to do is drag content from my iTunes Library to the devices.  iTunes gets stuck EVERY single time!  What usually triggers the Non-Sense is when I am adding a 2nd file!
    Why does iTunes SUCK??
    1) Many items greyed out in the menu bar, for well over 2 years, maybe more!
    2) I Can't drag more than one piece of content from your iTunes library to any device (iPhone, iPad)
    If you do it gets stuck for HOURS and HOURS in "Preparing To Update" and the little activity circle never completes, ever!!
    I used to be able to drag over 1000 tunes, movies, etc. go have breakfast come back and it would all be on my device!!
    Can't do it anymore, one song at a time, maybe an album at a time, or one movie, and that is it!!
    If you do a 2nd item the other items stop loading and never continue!!
    This is so BAD, I don't understand how they don't have this fixed yet!!
    Please tell me I am not the only one!!
    ...and If I am tell me how to fix it!
    Very appreciated,
    Joe

  • How do you transfer the content from an iPhone to a PC? I have to use a PC for a while and don't know how to put my stuff on to there from my phone

    How do you transfer the content from an iPhone to a PC? I have to use a PC for a while and don't know how to put my stuff on to there from my phone

    If you're talking about music and movies an i-device was not designed for unique storage of media. It is not a backup device and media transfer was planned with you maintaining a master copy of your media on a computer which is itself properly backed up against loss. Syncing music and movies is one way, computer to device, updating the device content to the content on the computer, not updating or restoring content on a computer. The exception is iTunes Store purchases which can be transferred from a device to a computer.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer - http://support.apple.com/kb/HT1848 - only purchases from iTunes Store
    For transferring other items from an i-device to a computer you will have to use third party commercial software.  See this document by turingtest2: Recovering your iTunes library from your iPod or iOS device - https://discussions.apple.com/docs/DOC-3991

  • I have had ATV2 for a month now and it was working great up until about 3 days ago. I used it to play music one night off home sharing from my itunes, and then the next day, it wouldnt recognize home sharing and let me use airplay/mirroring. Any thoughts?

    So when i turn on my ATV2 now, and go to computers, it doesnt recognize my computer anymore. I didnt touch anything from the previous day after it last worked, so im not sure why it suddenly stopped working. I've tried turning off/on homesharing, siging in with a different account but still using my appleid..i've reset the ATV2 to it factory settings and then reinstalled the recent update but nothing seems to be working. Whenever i turn on homesharing on my macbook pro, it akknowledges that its on, but then the little logo for homesharing goes away as soon as i click done. Not sure if that is normal or not.   Im assuming this is a prb with itunes because my photostream works off ATV2, receiving pics from my comp,but i cant seem to stream movies etc. The airplay icon is also no longer on my mac screen. I have no idea whats going on. Any ideas?
    thanks

    So when i turn on my ATV2 now, and go to computers, it doesnt recognize my computer anymore. I didnt touch anything from the previous day after it last worked, so im not sure why it suddenly stopped working. I've tried turning off/on homesharing, siging in with a different account but still using my appleid..i've reset the ATV2 to it factory settings and then reinstalled the recent update but nothing seems to be working. Whenever i turn on homesharing on my macbook pro, it akknowledges that its on, but then the little logo for homesharing goes away as soon as i click done. Not sure if that is normal or not.   Im assuming this is a prb with itunes because my photostream works off ATV2, receiving pics from my comp,but i cant seem to stream movies etc. The airplay icon is also no longer on my mac screen. I have no idea whats going on. Any ideas?
    thanks

  • Iphone 4s coming friday, what is the best way to get the notes content from iphone 4 to 4s without doing a restore? i want the new phone to be totally new but not sure how to get notes content across.

    What is the best way to get the notes content from iphone 4 to 4s without doing a restore? i want the new phone to be totally new but not sure how to get notes content across. If I do a restore as I have when previously from one iphone to another it has shown (in settings, usage) the cumulative usage from previous phones so all the hours of calls on all previous iphones will be displayed even though its brand new. Anyone know how I can get my notes (from standard iphone notes app) to my new iphone 4s without restoring from previous iphone 4. Thanks for any help offered.

    First, if you haven't updated to iTunes 10.5, please update now as you will need it for the iPhone 4S and iOS 5.
    Once you're done installing iTunes 10.5, open it. Connect your iPhone to iTunes using the USB cable. Once your iPhone pops up right click on it. For example: an iPhone will appear and it will say "Ryan's iPhone."
    Right click on it and select "Backup" from the dropdown menu. It will start backing up. This should backup your notes.
    Please tell me if you have any problems with backing up.
    Once you backup and get your iPhone 4S, you must follow these steps. If you don't follow these steps, you will not be able to get your notes on your new iPhone 4S.
    Open up iTunes again then right click on your device (iPhone 4S). Once you do you will see a dropdown menu. It will say "Restore from Backup..." Select this and it'll ask for a backup, select it from the dropdown menu. For example "Ryan's iPhone - October 12, 2011." Pick that and it will restore to your backup. Do this when you get your iPhone 4S so you will not lose anything. Even though you're restoring, you're getting back, since you're getting the previous settings, notes, contacts, mail and other settings from your old iPhone. You'll still have Siri though! So, restore when you first get it. Also frequently backup your device, as it will be worth it. You can restore from a backup if something goes wrong or save your data for a future update.
    Once you do that, you should have your notes on your new iPhone 4S and iOS 5.
    Please tell me if you need any help.
    I hoped I answered your questions and solved your problem!

  • ABAP Program to delete the WDSO contents from active data table & Manage Re

    Hi,
    We have requirement where we have to delete the request id from manage screen and data from Active table of WDSO.
    I have gone through this weblink where we have to hardcode the DSO name in the table (Deletion of WDSO (Write-optimized DataStore object) Load requests and active table data without deleting it from targetSAPNetworkWeblogs%2528SAPNetworkWeblogs%2529)
    Apart from that is there any suggestions or input where i can have selection screen for DSO and execute that will help us to delete the Request IDs and content of active table from WDSO.
    Suggestions or input programs really appreciated.
    Kindly do the needful.
    Regrads,
    Prem
    Edited by: pannalde on Nov 22, 2011 8:24 AM

    Hi,
    http://help.sap.com/saphelp_nw04/helpdata/en/2d/677b3c513d3311e10000000a114084/content.htm
    With program RSSM_DELETE_WO_DSO_REQUESTS it is possible to delete old requests in the Write-Optimized DSO, exactly like we are used to do with PSA requests via a Process Chain.
    This program is available as of SAP NetWeaver BW 7.01 SP07. See note 1437407 for details.
    You can automate the deletion of old WO requests by using the ABAP program step in the Process Chain.
    Regards,
    rvc

  • Hi my 4s is only 5 days old and I have the OTTER Box from day 1 and it has turned off by itself and will has not turned back on some help let me know what to do I'm dieing over here

    Hi my 4s is only 5 days old and I have the OTTER Box from day 1 and it has turned off by itself and will has not turned back on some help let me know what to do I'm dieing over here

    If it is only 5 days old, take it back to where you bought it
    and get it replaced.

  • HT4527 How can move the apps and playlists on my iPad to my Mac? Whenever I attempt to sync, I get a message stating that all apps and music on my iPad will be replaced by content from my Mac and there are no content. Thanks.

    How can move the apps and playlists on my iPad to my Mac? Whenever I attempt to sync, I get a message stating that all apps and music on my iPad will be replaced by content from my Mac and there are no content. Thanks.

    the apps will not be deleted if the itunes is authorised for the apple id from which you downloaded the apps.
    for the songs if you have downloaded it from a store other than itunes an app "TuneAid" will help you. download the full version then you can copy all the songs on the ipad to ur itunes library

  • I HAVE COMPLETED SEVERAL IMOVIES AND FINALIZED JUST FINE.  NOW I GET THE FOLLOWING MESSAGE FROM MY LATEST PROJECT.  "The project could not be prepared for publishing because an error occurred.  (File already open with write permission)"!  What is going on

    I HAVE COMPLETED SEVERAL IMOVIES AND FINALIZED JUST FINE.  NOW I GET THE FOLLOWING MESSAGE FROM MY LATEST PROJECT.  "The project could not be prepared for publishing because an error occurred.  (File already open with write permission)"!  What is going on?

    Hi
    Error -49 opWrErr  File already open with write permission
    Trash the preference files while application is NOT Running.
    Easiest way to find out if this is the problem is by:
    • Create a new User-Account
    • Log out of Your old one and into this
    • Re-try iMovie
    If it now works OK - then 99.9% the problem is iMovie pref. file that needs to be trashed.
    from Karsten Schlüter
    Some users notice on exporting larger projects from within iMovie that this operation is aborted with an 'error -49'
    This issue occurs only on MacOs machines using 10.7x
    try switching-off the Local Mobile Backup
    in Terminal copy/paste
    sudo tmutil disablelocal
    Re-launch Mac
    Yours Bengt W

  • I can only access the itunes store from my pc and not my ipod touch.  It says incorrect password, but I know it is correct.  I have changed my password more than 3 times in the past few months to resolve this issue but to no avail.  Someone please help!

    I have had the same account for over 4 years.  I have had my ipod touch for 2 years and have always been able to access the itunes store and download content from my pc and my ipod touch.  A few months ago, I started to receive the message that I've entered the wrong password but I know that it is correct.  I can download all I want from my pc without any problems at all.  How do I get my device to accept my itunes password so that I can get back to downloading content directly to my device?

    I'm having the same issue.  Just hooked up a Mac Mini and running the internet just fine over wifi, but Facetime isn't working.  I'm going to try resetting my router in the morning.

  • How to edit bitmap which is imported in flash using xml and save the edited bitmap back to xml in flash.

    hi all
    It would be appreciated if any one let me know how to edit
    bitmap which is imported in flash using xml and save the edited
    bitmap back to xml in flash.
    Is it posible to save the bitmap data in flash?
    thanks in advance

    Yes you can... but like I said before you need to upload the
    data from the changes you make to a server.
    In terms of the solution... its unlikely that you'll find one
    specifically for your needs. You will have to learn whatever you
    don't know how already and maybe adapt some existing examples to
    your needs.
    To change the visual state of a movie clip... you just do all
    the regular things that you want to do to it using flash... scale,
    rotation, drawing API , textfields etc in actionscript. If you
    don't know how to how to do that stuff, then you need to learn that
    first. That's basic actionscript.
    You can capture the visual state of a movieclip using the
    BitmapData class. That includes a loaded jpeg. You can also
    manipulate bimatp data using the same class. You should read up on
    that if you don't know how to use it or check out the examples
    below for uploading info.
    For uploading to the server:
    Here's an as2 solution that took 15 secs to find using
    google:
    http://www.quasimondo.com/archives/000645.php
    If you're using as3, google search for "jpeg encoder as3" and
    look through that info. There are also historical answers in the
    forums here related to this type of thing that might help as
    well.

  • Generating XML from SQL queries and saving to an xml file?

    Hi there,
    I was wondering if somebody could help with regards to the following:
    Generating XML from SQL queries and saving to a xml file?
    We want to have a procedure(PL/SQL) that accepts an order number as an input parameter(the procedure
    is accessed by our software on the client machine).
    Using this order number we do a couple of SQL queries.
    My first question: What would be our best option to convert the result of the
    queries to xml?
    Second Question: Once the XML has been generated, how do we save that XML to a file?
    (The XML file is going to be saved on the file system of the server that
    the database is running on.)
    Now our procedure will also have a output parameter which returns the filename to us. eg. Order1001.xml
    Our software on the client machine will then ftp this XML file(based on the output parameter[filename]) to
    the client hard drive.
    Any information would be greatly appreciated.
    Thanking you,
    Francois

    If you are using 9iR2 you do not need to do any of this..
    You can create an XML as an XMLType using the new SQL/XML operators. You can insert this XML into the XML DB repository using DBMS_XDB.createResource. You can then access the document from the resource. You can also return the XMLType containing the XML directly from the PL/SQL Procedure.

  • Generating XML from SQL queries and saving to a xml file?

    Hi there,
    I was wondering if somebody could help with regards to the following:
    Generating XML from SQL queries and saving to a xml file?
    We want to have a stored procedure(PL/SQL) that accepts an order number as an input parameter(the procedure
    is accessed by our software on the client machine).
    Using this order number we do a couple of SQL queries.
    My first question: What would be our best option to convert the result of the
    queries to xml?
    Second Question: Once the XML has been generated, how do we save that XML to a file?
    (The XML file is going to be saved on the file system of the server that
    the database is running on.)
    Now our procedure will also have a output parameter which returns the filename to us. eg. Order1001.xml
    Our software on the client machine will then ftp this XML file(based on the output parameter[filename]) to
    the client hard drive.
    Any information would be greatly appreciated.
    Thanking you,
    Francois

    Hi
    Here is an example of some code that i am using on Oracle 817.
    The create_file procedure is the one that creates the file.
    The orher procedures are utility procedures that can be used with any XML file.
    PROCEDURE create_file_with_root(po_xmldoc OUT xmldom.DOMDocument,
    pi_root_tag IN VARCHAR2,
                                            po_root_element OUT xmldom.domelement,
                                            po_root_node OUT xmldom.domnode,
                                            pi_doctype_url IN VARCHAR2) IS
    xmldoc xmldom.DOMDocument;
    root xmldom.domnode;
    root_node xmldom.domnode;
    root_element xmldom.domelement;
    record_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    BEGIN
    xmldoc := xmldom.newDOMDocument;
    xmldom.setVersion(xmldoc, '1.0');
    xmldom.setDoctype(xmldoc, pi_root_tag, pi_doctype_url,'');
    -- Create the root --
    root := xmldom.makeNode(xmldoc);
    -- Create the root element in the file --
    create_element_and_append(xmldoc, pi_root_tag, root, root_element, root_node);
    po_xmldoc := xmldoc;
    po_root_node := root_node;
    po_root_element := root_element;
    END create_file_with_root;
    PROCEDURE create_element_and_append(pi_xmldoc IN OUT xmldom.DOMDocument,
    pi_element_name IN VARCHAR2,
                                            pi_parent_node IN xmldom.domnode,
                                            po_new_element OUT xmldom.domelement,
                                            po_new_node OUT xmldom.domnode) IS
    element xmldom.domelement;
    child_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    BEGIN
    element := xmldom.createElement(pi_xmldoc, pi_element_name);
    child_node := xmldom.makeNode(element);
    -- Append the new node to the parent --
    newelenode := xmldom.appendchild(pi_parent_node, child_node);
    po_new_node := child_node;
    po_new_element := element;
    END create_element_and_append;
    FUNCTION create_text_element(pio_xmldoc IN OUT xmldom.DOMDocument, pi_element_name IN VARCHAR2,
    pi_element_data IN VARCHAR2, pi_parent_node IN xmldom.domnode) RETURN xmldom.domnode IS
    parent_node xmldom.domnode;                                   
    child_node xmldom.domnode;
    child_element xmldom.domelement;
    newelenode xmldom.DOMNode;
    textele xmldom.DOMText;
    compnode xmldom.DOMNode;
    BEGIN
    create_element_and_append(pio_xmldoc, pi_element_name, pi_parent_node, child_element, child_node);
    parent_node := child_node;
    -- Create a text node --
    textele := xmldom.createTextNode(pio_xmldoc, pi_element_data);
    child_node := xmldom.makeNode(textele);
    -- Link the text node to the new node --
    compnode := xmldom.appendChild(parent_node, child_node);
    RETURN newelenode;
    END create_text_element;
    PROCEDURE create_file IS
    xmldoc xmldom.DOMDocument;
    root_node xmldom.domnode;
    xml_doctype xmldom.DOMDocumentType;
    root_element xmldom.domelement;
    record_element xmldom.domelement;
    record_node xmldom.domnode;
    parent_node xmldom.domnode;
    child_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    textele xmldom.DOMText;
    compnode xmldom.DOMNode;
    BEGIN
    xmldoc := xmldom.newDOMDocument;
    xmldom.setVersion(xmldoc, '1.0');
    create_file_with_root(xmldoc, 'root', root_element, root_node, 'test.dtd');
    xmldom.setAttribute(root_element, 'interface_type', 'EXCHANGE_RATES');
    -- Create the record element in the file --
    create_element_and_append(xmldoc, 'record', root_node, record_element, record_node);
    parent_node := create_text_element(xmldoc, 'title', 'Mr', record_node);
    parent_node := create_text_element(xmldoc, 'name', 'Joe', record_node);
    parent_node := create_text_element(xmldoc,'surname', 'Blogs', record_node);
    -- Create the record element in the file --
    create_element_and_append(xmldoc, 'record', root_node, record_element, record_node);
    parent_node := create_text_element(xmldoc, 'title', 'Mrs', record_node);
    parent_node := create_text_element(xmldoc, 'name', 'A', record_node);
    parent_node := create_text_element(xmldoc, 'surname', 'B', record_node);
    -- write the newly created dom document into the buffer assuming it is less than 32K
    xmldom.writeTofile(xmldoc, 'c:\laiki\willow_data\test.xml');
    EXCEPTION
    WHEN xmldom.INDEX_SIZE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Index Size error');
    WHEN xmldom.DOMSTRING_SIZE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'String Size error');
    WHEN xmldom.HIERARCHY_REQUEST_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Hierarchy request error');
    WHEN xmldom.WRONG_DOCUMENT_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Wrong doc error');
    WHEN xmldom.INVALID_CHARACTER_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Invalid Char error');
    WHEN xmldom.NO_DATA_ALLOWED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Nod data allowed error');
    WHEN xmldom.NO_MODIFICATION_ALLOWED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'No mod allowed error');
    WHEN xmldom.NOT_FOUND_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Not found error');
    WHEN xmldom.NOT_SUPPORTED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Not supported error');
    WHEN xmldom.INUSE_ATTRIBUTE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'In use attr error');
    WHEN OTHERS THEN
    dbms_output.put_line('exception occured' || SQLCODE || SUBSTR(SQLERRM, 1, 100));
    END create_file;

Maybe you are looking for

  • Pages Version 4.1 won't open on ipad 2.1-HELP???

    I am a pastor and have just completed my sermon for our FIRST CHURCH SERVICE SUNDAY...I have e-mailed the document from my MacBook Pro with Pages 4.1 to my ipad which latest version is 2.0.1 Freaking out right now, I see no way out, can anyone help m

  • Report layout changes with  the values in it

    I he a standard report, but i want certain report rows to show up in red when a value of the row is null. I know you have to use different templates, but how or where do i need to put the condition to change report row templates? Thanks

  • JRE 1.4.2_03 - 1.4.2_07 upgrade

    We have been running _03 for quite a while now and a simlpe upgrade to _07 has caused our apps not to launch. Jar files will be d/l'd but web start just stalls and no java console appears. Java console logging tells me it cant find my class. any idea

  • MY IPAD IS DISABLED. I DON'T HAVE PASSCODE

    How can I start the I Pad without loosing the contents?

  • Best practice?-store images outside the WAR file?

    I have an EAR project with several thousand images that are constantly changing. I do not want to store the images in the WAR project since it will take an extremely long time to redeploy with every image change. What is the best practice for storing