tryingtolearn
Member
- Joined
- Mar 13, 2018
- Messages
- 12
- Programming Experience
- Beginner
I have two questions, I'd love any help offered. I’ve spent the entire weekend searching for a solution to this problem. We have an XML file that needs to be read. It’s small and only contains one node. However, it is malformed (and we know it). There is nothing we can do about this since it’s created from another process. I have to work with what we have.
That's it. As you can see, it doesn't contain a root. The tutorials I've seen online use a process called deserialization that require a main root. I've thought about prepending the XML file with "<root>" but I don't know how to do this on the fly. I can't touch the original file. I just need the userKey, flag, and the TEST MESSAGE inside of it. How can I extract this?
I have one other question that has to do with theory/best practices. As you can see, the file is small (one node). But it's in a folder that contains about 100 files just like the above. My goal is for my program to loop through each file and reads the one node in the file, and put it in a treeview. Do you think I should create an array of objects? Use a basic array? Heck, a SQL DB? Just looking for a push in the right direction.
Any help is greatly appreciated.
Rob
HTML:
<ServerRequest userKey="01223345671234123" flag="ACTIVE" >
<raw>
TEST MESSAGE
</raw>
</ServerRequest>
That's it. As you can see, it doesn't contain a root. The tutorials I've seen online use a process called deserialization that require a main root. I've thought about prepending the XML file with "<root>" but I don't know how to do this on the fly. I can't touch the original file. I just need the userKey, flag, and the TEST MESSAGE inside of it. How can I extract this?
I have one other question that has to do with theory/best practices. As you can see, the file is small (one node). But it's in a folder that contains about 100 files just like the above. My goal is for my program to loop through each file and reads the one node in the file, and put it in a treeview. Do you think I should create an array of objects? Use a basic array? Heck, a SQL DB? Just looking for a push in the right direction.
Any help is greatly appreciated.
Rob
Last edited: