XML READING HAS ME PULLING MY HAIR, I HAVE NO HAIR LEFT ANYMORE..........

Before you think about sending me to some website, I have researched everywhere... Literally EVERYWHERE. First here is a sample of the xml file I want to read...
<User_Library>
<Music_File>
<UniqueId>b7850389-6eed-4fef-a432-aa0204574103</UniqueId>
<Album>Unknown</Album>
<Artist/>
<Genre>Unknown</Genre>
<Title>(fdvm Remix)</Title>
<Year>Unknown</Year>
<File_Path>
E:\Entertainment\Music\8 tracks playlist\Meltdown\(FDVM Remix).mp3
</File_Path>
<Is_Favorite>false</Is_Favorite>
</Music_File>
<Music_File>
<UniqueId>009cd3ed-cf84-47ab-8df8-f9edc303ab8f</UniqueId>
<Album>Chill Step Top 50</Album>
<Artist>Capox</Artist>
<Genre>Unknown</Genre>
<Title>[old Track] River Flows In You</Title>
<Year>2014</Year>
<File_Path>
E:\Entertainment\Music\8 tracks playlist\chill step top 50\[old track] river flows in you (capox remix).mp3
</File_Path>
<Is_Favorite>false</Is_Favorite>
</Music_File>
</User_Library>
And here is the code I am using to read the xml file
public async Task LoadUserLibrary()
var file = await ApplicationData.Current.LocalFolder.GetFileAsync("_userLibrary.xml");
var doc = new XmlDocument();
doc.LoadXml(await FileIO.ReadTextAsync(file));
var nodeList = doc.SelectNodes("//Music_File");
foreach (var node in nodeList)
Guid uniqueId;
Guid.TryParse(node.SelectSingleNode("//UniqueId").InnerText, out uniqueId);
var album = node.SelectSingleNode("//Album").InnerText;
var artist = node.SelectSingleNode("//Artist").InnerText;
var genre = node.SelectSingleNode("//Genre").InnerText;
var title = node.SelectSingleNode("//Title").InnerText;
uint year;
uint.TryParse(node.SelectSingleNode("//Year").InnerText, out year);
var filePath = node.SelectSingleNode("//File_Path").InnerText;
bool isFavorite;
bool.TryParse(node.SelectSingleNode("//Is_Favorite").InnerText, out isFavorite);
var musicItem = new MusicDataItem(uniqueId, album, artist, genre, title, year, filePath)
IsFavorite = isFavorite
MusicDataSource.Music.Add(musicItem);
Now, my problem isn't that the code is not working or anything my problem is the it only returns the first nodes attributes times the number of nodes in the file. For example from the xml provided above it will only show say title i.e (fdvm
Remix) two times instead of showing (fdvm Remix) and [old Track] River Flows In You....
Help me stop pulling my hair.....
M.K.N

And this did the trick, Instead of relying on the node.SelectSingleNode("your node name") I have opted to use indexes (since the xml file will always have a constant number of childnodes in every Music_File node i.e 8) and it works like magic....
Guid.TryParse(node.FirstChild.InnerText, out uniqueId);
album = node.ChildNodes[1].InnerText;
artist = node.ChildNodes[2].InnerText;
genre = node.ChildNodes[3].InnerText;
title = node.ChildNodes[4].InnerText;
uint.TryParse(node.ChildNodes[5].InnerText, out year);
filePath = node.ChildNodes[6].InnerText;
bool.TryParse(node.LastChild.InnerText, out isFavorite);
var musicItem = new MusicDataItem(uniqueId, album, artist, genre, title, year, filePath)
IsFavorite = isFavorite
MusicDataSource.Music.Add(musicItem);
I had never thought of pausing on a line then checking the values in the variables, which is what you did.. Thanks again...
M.K.N

Similar Messages

  • I HAVE 29 DAYS LEFT FOR MY ACC BUT I CANT CREATE A VM BECAUSE IT SAYS IT HAS BEEN DISABLE ANY PROBLEM

    I HAVE 29 DAYS LEFT FOR MY ACC BUT I CANT CREATE A VM BECAUSE IT SAYS IT HAS BEEN DISABLE ANY PROBLEM PLEASE

    I HAVE 29 DAYS LEFT FOR MY ACC BUT I CANT CREATE A VM BECAUSE IT SAYS IT HAS BEEN DISABLE ANY PROBLEM PLEASE
    That's nice. Tomorrow you will have 28 days.
    What kind of ACC do you have? Nobody that reads posts is omnipotent or has ESP or can read your mind.
    Also if you want to converse in English then you need to learn English to the point that you can actually write constructive sentences and paragraphs in English including the proper use of Upper Case, Lower Case and punctuation to some degree.
    Otherwise write in your own language on a translator like google translate and paste the translation into your post.
    Also you would notice that this forum was supposed to be retired 8/22/2008 if you'd read the stickies in it before posting to it. Which I would suppose is why almost all questions in it go unanswered.
    La vida loca

  • Portal XML Component Error when pulling content from iFS

    Has anyone tried to use Portal's XML Component application to pull XML data out of iFS via URLs successfully? I'm using iFS 1.1.10 and 9iAS 1.0.2.2a. I've loaded an XML instance and XML style sheet in iFS (that parse fine in XMLSpy) and tried to display them using the Portal XML Component application. I've also tried to cut/paste the instance and style sheet in to the Component's GUI directly and received the same error. The component finds the files in iFS fine, but generates the following error:
    Start of root element expected. at oracle.xml.parser.v2.XMLError.flushErrors(XMLError.java) at oracle.xml.parser.v2.XMLError.error(XMLError.java) at oracle.xml.parser.v2.XMLError.error(XMLError.java) at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java) at oracle.webdb.xmlcomp.XMLTransDoc.Transform(XMLTransDoc.java:136)
    Oracle's sample data works fine too..
    Seems like a basic error, but I can't correct it.. THanks in advance for any help, Tim

    At the start of the xml file u have to mention the version number of the xmldoc.
    Some thing like the following
    <?xml version="1.0"?>
    and then ur content.
    Try following the same thing, with the smaller amount of data to test for the functionality of the component.
    (but keep in mind the size limitation bug has been fixed in the next release of Oracle 9iAS Portal only i.e., 9.0.2).
    And let us know, what problem u are facing.
    Thanks,
    Balakrishnan.

  • Getting question marks in html output when xml file has an mdash or rsquo

    I have a java servlet that gets an xml file out of ifs, applies
    a style sheet to it, and sends it to the browser as html.
    I have:
    DOMparser parser = new DOMParser();
    parser.parse(XmlUrl);
    The characters ampersand, greater than, less than, and
    apostrophe work fine.
    HOWEVER, When the xml file has an mdash(&#X2014) or a rsquo
    (&#x2019) in it, my html output in IE shows up with question
    marks where these characters are supposed to be.
    Does anyone know what I can do to fix this? I don't understand
    why it would work with some special characters and not others?

    UPDATE
    Compiling from command line I found out that the class definition for oracle.oats.scripting.modules.basic.api.IteratingVUserScript is missing. Do you know what .jar file contains this class?
    Thanks.
    Fede.

  • Screen Saver has started pulling from Wallpaper file AND I-Photo

    Suddenly for no apparent reason, Screen Saver has started pulling photos from I-Photo as well as my Wallpaper File.
    I do NOT want it to display from the I-Photo library.
    In the Source option, I have selected Wallpaper (the name of the file).    Also have it coming on in 20 minutes and randomly.  Display is Origami.
    Any suggestions?

    Hey BD!
    Thanks for response. Approaching Sleep Time There. I am kinda weird tonight.

  • My podcast has been pulled from the iTunes Store after 9 months!!

    Hello, my podcast ( http://giuliuscaesar.podbean.com/feed ) has been pulled after 9 month from the iTunes store.
    I made no changes and the bandwith and the feed are working ok. What happened? I was in the top 10 of the tech section in Italy for months, and i had all 5 stars reviews! I'm really worried, what can i do?
    If i try to resubmit it first said that my session expired and now it said that the url was already submitted. I need it back online sicne it's part of my business!

    As far as I can see (not speaking Italian) your podcast doesn't have any of the sort of content which would get it removed (unacceptable or illegal content, copyright breach, and so on) so its removal is probably a mistake.
    I'm sorry they've been unhelpful. Did you email them at [email protected] ? - they have shown a tendency to being fairly helpful recently, whereas if you tried iTunes Support I wouldn't expect you to get much sense out of them. If you didn't use that address, give it a try.
    Otherwise your only option is to submit it again: you'll need to give it a new title (you can change it back once it's been accepted) and you should change the feed title so the UTRL is different, though that may be difficult with Podbean: you would probably need to start a new account there.

  • XML Reader - why re-invent the wheel

    Does anyone want to post the code to a good XML Reader that they currently have in use?

    Here is some very simple code that reads all of the nodes in an XML doc. I apologize to the writer of this code, I can't remember where I got it and what his/her name is. If someone recognizes it, please pipe up. Oh yeah, and I can't remember what needed to be referenced so I included a bunch of stuff.
    anywho:
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import javax.xml.parsers.*;
    import java.util.*;
    import java.io.*;
    public class LoadXMLdoc {
      private Document document;
      public LoadXMLdoc() {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        try {
          DocumentBuilder builder = factory.newDocumentBuilder();
          document = builder.parse( new File(yourDocumentPathAsStringHere) );
          Element root = document.getDocumentElement();
          String rootElement = (root.getTagName());
          root.normalize();
          System.out.println(rootElement);
          NodeList children = root.getChildNodes();
          System.out.println("It has "+ children.getLength() + " child nodes\n");
          for (int i=0;i<children.getLength();i++) {
            System.out.println(children.item(i).getNodeName());
          System.out.println("I'm done");
            } catch (SAXParseException spe) {
               // Error generated by the parser
               System.out.println("\n** Parsing error"
                  + ", line " + spe.getLineNumber()
                  + ", uri " + spe.getSystemId());
               System.out.println("   " + spe.getMessage() );
               // Use the contained exception, if any
               Exception  x = spe;
               if (spe.getException() != null)
                   x = spe.getException();
               x.printStackTrace();
            } catch (SAXException sxe) {
               // Error generated during parsing)
               Exception  x = sxe;
               if (sxe.getException() != null)
                   x = sxe.getException();
               x.printStackTrace();
            } catch (ParserConfigurationException pce) {
                // Parser with specified options can't be built
                pce.printStackTrace();
            } catch (IOException ioe) {
               // I/O error
               ioe.printStackTrace();
    }Hope that helps you. It helped me.
    Good Luck.
    Ben

  • Note lookls like the OTA has been pulled

    Note lookls like the OTA has been pulled
    Thunderbolt Update page has reverted back to Froyo INfo
    here http://support.verizonwireless.com/pdf/system_update/thunderbolt.pdf

    Do we have an official word from Verizon?
    My wife's phone updated this morning at 7:30.
    My phone is running the same new version.
    My son's phone  Don't know still in bed,

  • Adobe Reader has encountered a problem and needs to close.

    When reading PDF attachments, I get the following:  Adobe Reader has encountered a problem and needs to close. I have tried to remove Adobe Reader via Control Panel, Add or Remove Programs but that won't work.  I get this:  This patch package could not be opened.  Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package. I don't know how to do what is being asked.  I have tried to download Adobe Reader again but get this when I do:  Note:  this application already installed.
    I have Adobe Reader X (10.0.1) with an update installed on 2/19/2011.  I have Windows XP SP3.
    Anyone who can help me get Adobe Reader working correctly again or uninstalling it so I can reinstall.
    Thanks for any help.

    Thanks for the input.  Did you remove Adobe Reader 10 first before you downloaded the older version?  If you removed it, how did you do that?  The add/remove programs in control panel won't let me remove it -- it says a patch package can't be opened.
    Date: Mon, 9 May 2011 00:12:41 -0600
    From: [email redacted by moderator]
    To: [email redacted by moderator]
    Subject: Adobe Reader Adobe Reader has encountered a problem and needs to close.
    hi
    i had also the same problem with that version.
    so i download older version and this solved the problem.
    >

  • Getting "adobe Reader has encountered a problem and needs to close

    On Windows XP service pack 3. Adobe Reader X
    Get "Adobe Reader has encountered a problem and needs to close." . I have uninstalled adibe and reinstalled it and problem came back within 2 weeks after working for a short time.

    Try the following:
    Uninstall Adobe Reader X
    Reboot your computer
    Delete directory C:\Program Files\Adobe\Reader 10.0
    Download the EXE or the MSI installer from ftp://ftp.adobe.com/pub/adobe/reader/win/10.x/10.1.0/ and execute e.g. either of the following files:
    AdbeRdr1010_en_US.exe
    AdbeRdr1010_en_US.msi
    Good luck!

  • I am having a problem opening pdf document.  I get error message: "Adobe Reader has stopped working"

    I am having a problem opening pdf document.  I get error message: "Adobe Reader has stopped working" then I get Windows is looking on line for a solution, but then my document closes. I tried uninstalling and reinstalling Adobe Reader XI, rebooted my computer but this did not help.  I get the same message. What to do?

    Can you open Reader by itself?  If so, check if disabling Protected Mode improves the situation [Edit | Preferences | Security (Enhanced)].

  • I have the latest version of Abode Reader. However, over the past month or so, my Reader has constan

    I have the latest version of Adobe Acrobat Reader. I operate on Windows 7 with Outlook as my e-mail filter. However, over the past month or so, my Reader has constantly become "not responding" whenever I open-up a pdf file that was attached to an e-mail. When trying to read the pdf file, it doesn't allow me to scroll through the document and then goes into "not responding" mode which forces me to exist and then re-open the file many times until I have been able to read the documents. This "not responding" shut down to the pdf file is constant and very annoying. What is going on and how can I fix it?
         THanks,

    Thank you for your kind and thoughtful input.
    My Adobe reader is the most current one that's out there per Adobe.
    Something like XII  or higher.
    As for my Outlook, it's MS Outlook 2003, and I believe it's Express Outlook.
    If I disable the Protected Mode, per your suggestion, maybe that will work.
    I'll try it.
    Thanks again, and if you have any other ideas, I would appreciate your
    thoughts.
    Thank you.
    Joel

  • Adobe reader has stopped working, any solutions?

    I am having an issue with Adobe reader X.
    I open the program and it works normally, nothing to repport.
    Each time I close the program I receive the error message "Adobe Reader has stopped working)
    I am on Win 7 (32bit) SP1
    any ideas/solutions for this situation?
    Thank you in advance

    I have been having this problem recently (Vista HP fully updated 32 bit) with Reader X. This was a clean install and no 3rd party reg cleaners etc have ever been used. I use Microsoft Security Essentials.
    This problem seems intermitent. Yesterday it happened nearly every time I closed a pdf. Today it hasn't done it once so far. When the problem first happened a week or so back I tried the solutions offered (turn off protected mode) and it did not work. I tried "repair Adobe install" and that too did nothing. Windows problem reports keep saying Adobe updates available... they are not.
    Apart from the message saying that it crashed on closing there is no outward sign of anything amiss. I did however open task manager while the error box was still displayed and it showed two Adobe processes as still running. When I used the error box option to "close program" these processes ended.
    I can't help but feel these problems coincided with a recent round of updates although that may of course, be just that, a coincidence.

  • Error: unexpected XML reader state. expected: END but found: START:

    I am getting following error while invoking method 'GetVersionInfo' (.net web service over dll) which takes one input parameter(string) and gives two output parameters(both short):
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: deserialization
    error: unexpected XML reader state. expected: END but found: START:
    {UPPLink}pnVersionMajor
    ORA-06512: at "SYS.UTL_DBWS", line 388
    ORA-06512: at "SYS.UTL_DBWS", line 385
    ORA-06512: at line 40
    Expected Request is as follows:
    POST /UPPLink/UPPLink.asmx HTTP/1.1
    Host: 172.16.1.38
    Content-Type: text/xml; charset=utf-8
    Content-Length: length
    SOAPAction: "UPPLink/GetVersionInfo"
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <GetVersionInfo xmlns="UPPLink">
    <ignore>string</ignore>
    </GetVersionInfo>
    </soap:Body>
    </soap:Envelope>
    EXpected Response is as follows:
    HTTP/1.1 200 OK
    Content-Type: text/xml; charset=utf-8
    Content-Length: length
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <GetVersionInfoResponse xmlns="UPPLink">
    <GetVersionInfoResult>
    <pnVersionMajor>short</pnVersionMajor>
    <pnVersionMinor>short</pnVersionMinor>
    </GetVersionInfoResult>
    </GetVersionInfoResponse>
    </soap:Body>
    </soap:Envelope>
    The PL/SQL code I am using is as follows:
    DECLARE
    service_ sys.utl_dbws.SERVICE;
    call_ sys.UTL_DBWS.call;
    service_qname sys.utl_dbws.QNAME;
    port_qname sys.utl_dbws.QNAME;
    operation_qname sys.utl_dbws.QNAME;
    string_type_qname sys.utl_dbws.QNAME;
    number_type_qname sys.utl_dbws.QNAME;
    retx ANYDATA;
    strEntry VARCHAR2(100);
    retx_string VARCHAR2(100);
    majorVersion NUMBER;
    minorVersion NUMBER;
    params sys.utl_dbws.ANYDATA_LIST;
    v_outputs sys.utl_dbws.anydata_list;
    BEGIN
    dbms_output.put_line('Starting Function');
    service_qname := sys.utl_dbws.to_qname(null, 'UPPLink');
    strEntry := 'vab';
    dbms_output.put_line('Creating Service');
    service_ := sys.utl_dbws.create_service(HTTPURITYPE('http://172.16.1.38/UPPLink/UPPLink.asmx?WSDL'), service_qname);
    dbms_output.put_line('Creating Operation');
    operation_qname := sys.utl_dbws.to_qname(null, 'GetVersionInfo');
    dbms_output.put_line('Calling Service');
    call_ := sys.utl_dbws.create_call(service_, null, operation_qname);
    sys.utl_dbws.set_property(call_, 'SOAPACTION_USE', 'true');
    sys.utl_dbws.set_property(call_, 'SOAPACTION_URI', 'UPPLink/GetVersionInfo');
    sys.utl_dbws.set_property(call_, 'OPERATION_STYLE', 'rpc');
    string_type_qname := sys.utl_dbws.to_qname('http://www.w3.org/2001/XMLSchema', 'string');
    number_type_qname := sys.utl_dbws.to_qname('http://www.w3.org/2001/XMLSchema', 'short');
    sys.utl_dbws.add_parameter(call_, 'ignore', string_type_qname, 'ParameterMode.IN');
    sys.utl_dbws.add_parameter(call_, 'pnVersionMinor', number_type_qname, 'ParameterMode.OUT');
    sys.utl_dbws.set_return_type(call_, number_type_qname);
    params(0) := ANYDATA.convertvarchar2(strEntry);
    dbms_output.put('Invoking with Input Parameter: ');
    dbms_output.put_line(ANYDATA.ACCESSVARCHAR2(params(0)));
    retx := sys.utl_dbws.invoke(call_, params);
    dbms_output.put_line('Invoke complete');
    majorVersion := retx.accessnumber;
    dbms_output.put_line('Major Version ' || majorVersion);
    v_outputs := SYS.utl_dbws.get_output_values(call_);
    minorVersion := ANYDATA.AccessNumber(v_outputs(1));
    dbms_output.put_line('Minor Version ' || minorVersion);
    sys.utl_dbws.release_service(service_);
    END;
    /

    Actually, the name needs to match what is specified in the WSDL file.

  • Adobe reader has stopped working error message after installing reader XI on windows 7

    Adobe reader has stopped working error message when loading reader after installing reader XI on windows 7.
    Does anybody know why ?

    Dear Pat,
    Thank you for your reply.
    It is Ver. 11.0.06 for Acrobat XI
    No, I can't open the Reader at all.  The error message box popped up immediately when I run the Reader

Maybe you are looking for