On Thu, 17 Oct 2002 [EMAIL PROTECTED] wrote:
>
>
> Hi,
> I have got an XML document in memory and I would like to extract data out of
the
> XML file into data-structures of my own. I need to extract whole of the XML
file
> into data structure and not part of the XML file. Can anyone
> 1)Provide me with a sample program/code to do the same. It does not seem that
> any of the samples accompaing the code does this, specially using DOM.
---DOM does take the entire XML file and put it into a data structure in
---memory. What about the DOM does not suit your needs?
I want to extract the data out of the XML file and do two things. Firstly I have
to put it into data-structure defined by me so that I can pass the data to other
modules. But I get your point that instead of making my own data-structures I
could use part of the DOM in memory. But I still need to know how to access the
DOM tree.
Seconldy I have to store all the data in the database. Hence I was looking for
some code which would give me a clue of getting the data and storing it into the
database. In simple words I was looking for code with the help of which I can
traverse the DOM tree and extract the data.
> 2)Suggest which would be a better approach SAX or DOM? Note that I donot want
to
> manipulate the data. I just want to extract the data and put it into data
> structures. I guess SAX would be faster.
---SAX will probably be faster if you don't need the overhead of a complete
---DOM in memory. What kind of data are you trying to extract from the XML
---file?
Below is a part of XML document I am dealing with. The data is either a string
upto 256 characters or integers.
<InitialFilterCriteria index="0">
<Priority index="0">0</Priority>
<TriggerPoint index="0">
<ConditionTypeCNF index="0">0</ConditionTypeCNF>
<SPI index="0">
<ConditionNegated index="0">0</ConditionNegated>
<Group index="0">0</Group>
<Group index="0">0</Group>
<Method index="0">INVITE</Method>
</SPI>
<SPI index="0">
<ConditionNegated index="0">0</ConditionNegated>
<Group index="0">0</Group>
<Group index="0">0</Group>
<Method index="0">INVITE</Method>
</SPI>
</TriggerPoint>
<ApplicationServer index="0">
<ServerName index="0">sip:[EMAIL PROTECTED]</ServerName>
<DefaultHandling index="0">0</DefaultHandling>
<ServiceInfo index="0">This could be a string 256 character long
...</ServiceInfo>
</ApplicationServer>
</InitialFilterCriteria>
Gareth
--
Gareth Reakes, Head of Product Development
DecisionSoft Ltd. http://www.decisionsoft.com
Office: +44 (0) 1865 203192
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
att1.eml
Description: Binary data
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
