Memory, speed and MSXML
-
Hello, i have a question about the MSXML library. I fail to find how exactly they read the XML Document when its already loaded into memory. If i look for XML nodes do they read the whole document from top to bottom until find it or its something with hash tables. My problem is that i have to remove some elements for existent XML document and add it in another. I was wondering which is better(according to speed) to keep the XML Nodes in std::vectors and remove the needed items and put them in the new XML Document and this only with 2 read/write operations on the XML Document or i should get the first part of the items do whatever i have to do with them and then take the next part and so on. This will cause for at least 8 times reading the existent XML Document and getting XML NodeLists out of it. The problem here is that the first XML Document can be really big. I think its better to read the information only once and do what i have to do with it and then write it in the new XML Document. At least i think its gonna be faster but i am not sure exactly how MSXML does the operations on the XML Document. Thank you for your help. :)
-
Hello, i have a question about the MSXML library. I fail to find how exactly they read the XML Document when its already loaded into memory. If i look for XML nodes do they read the whole document from top to bottom until find it or its something with hash tables. My problem is that i have to remove some elements for existent XML document and add it in another. I was wondering which is better(according to speed) to keep the XML Nodes in std::vectors and remove the needed items and put them in the new XML Document and this only with 2 read/write operations on the XML Document or i should get the first part of the items do whatever i have to do with them and then take the next part and so on. This will cause for at least 8 times reading the existent XML Document and getting XML NodeLists out of it. The problem here is that the first XML Document can be really big. I think its better to read the information only once and do what i have to do with it and then write it in the new XML Document. At least i think its gonna be faster but i am not sure exactly how MSXML does the operations on the XML Document. Thank you for your help. :)
Argonia wrote:
I fail to find how exactly they read the XML Document when its already loaded into memory.
Did you look at the selectSingleNode() method?
Argonia wrote:
My problem is that i have to remove some elements for existent XML document and add it in another.
So why not let MSXML do this for you? For a given node (see IXMLDOMNode), use the
removeChild()
method.Argonia wrote:
...but i am not sure exactly how MSXML does the operations on the XML Document.
While there are certainly better and more exhaustive examples available, I show how to briefly use MSXML here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
Argonia wrote:
I fail to find how exactly they read the XML Document when its already loaded into memory.
Did you look at the selectSingleNode() method?
Argonia wrote:
My problem is that i have to remove some elements for existent XML document and add it in another.
So why not let MSXML do this for you? For a given node (see IXMLDOMNode), use the
removeChild()
method.Argonia wrote:
...but i am not sure exactly how MSXML does the operations on the XML Document.
While there are certainly better and more exhaustive examples available, I show how to briefly use MSXML here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
DavidCrow wrote:
Did you look at the selectSingleNode() method?
My question is what is in this function.
DavidCrow wrote:
So why not let MSXML do this for you? For a given node (see IXMLDOMNode), use the
removeChild()
method.I can't change the given XML Document. I have to get some of the nodes of the first and add them to the second Document .
-
DavidCrow wrote:
Did you look at the selectSingleNode() method?
My question is what is in this function.
DavidCrow wrote:
So why not let MSXML do this for you? For a given node (see IXMLDOMNode), use the
removeChild()
method.I can't change the given XML Document. I have to get some of the nodes of the first and add them to the second Document .
Argonia wrote:
My question is what is in this function.
Unless I had access to the source code, I wouldn't have a clue (nor would I care). If I were to surmise a guess, the class has some private member variable (e.g., file pointer or handle) that keeps track of when a file has been read or not.
Argonia wrote:
I can't change the given XML Document. I have to get some of the nodes of the first and add them to the second Document .
You can either remove unwanted nodes from the first and write the balance to the second, or copy wanted nodes from the first to the second. The net result would be the same.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous