![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: parsing any kind of XML file Topic Summary: Created On: 12-Aug-2008 20:55 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|||
Hi All,
I'd like to know how you'd write a DXL library/function that parses an XML file (regardless of the number of elements and levels of nesting). You should include this library so that when you parse an actual XML file, you just access the library using methods like getElement() that'll return the value of the tag you are parsing. For example, if your XML looks like below: <Root> <Test>......<^ST8;...</Test> <..>.....<..> <..>....<..> ...... ....... .... </Root> Then, the function should return the value of "Test" when you access it using getElement() or something like that. The problem here is you don't know the number of tags in the XML, the levels of nesting and the data type. The idea of doing this is to come up with a generic XML parser, that will parse any kind of XML file as input. Thanks. |
|||
![]() |
|||
![]() |
|||
You may look into the undocumented functions below:
string getElementText_(DOM_Element_) string getElementName_(DOM_Element_) string setStringAttribute_(DOM_Element_, string, string) string getStringAttribute_(DOM_Element_, string) bool hasChildElements_(DOM_Element_) bool hasAttribute_(DOM_Element_, string) DOM_Element_ getDocumentElement_(DOM_Document_) DOM_Document_ getDocumentBuffer_(DOM_Document_, Buffer&) DOM_Document_ parseXMLBuffer_(Buffer) DOM_Document_ parseXMLString_(string) Se code for an example |
|||
![]() |
|||
![]() |
|||
I tried running the example code after making some modifications to it. I got the following error:
-R-E- DXL: <Line:25> cannot open file (C:\Documents and Settings\avembar\My Documents\test2objs.xml) for reading (Too many open files) Backtrace: <Line:52> <Line:69> -I- DXL: execution halted I've attached the code and the XML file that's used as input. Could you please let me know what's wrong? Thank You. |
|||
![]() |
|||
![]() |
|||
Hi there Anant
Interesting stuff, but to comment intelligently it'll help if you could outline what you are trying to achieve, as there can be > 1 * 2_skin_a_cat(). i.e. what purpose are you fulfilling by parsing the XML file? |
|||
![]() |
|||
![]() |
|||
Your modification of the code has made the function to call it-self, i.e recursion. That's why you get
|
|||
![]() |
|||
![]() |
|||
A little library to handle XML files in DOORS (tested in v7.1)
Hope this can help or can be updated by others users.
|
|||
![]() |
Telelogic DOORS
» DXL Exchange
»
parsing any kind of XML file
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.