![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Objects inserted in reverse order in the module Topic Summary: Created On: 12-Jul-2008 00:49 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|||
Hello,
I'm reading an xml file, stripping out the tags and getting the values only, and inserting the data in a formal module, in same order as I read them. However, the order of the objects are getting inserted in the reverse order in the module. For example, I extract text1 and text2 in that order from the xml file and try to insert them in the module in that same order. However, text2 is getting inserted first and then text1 is getting inserted. Same is the issue with the contents that appear one level below each of these two objects. I'm attaching my script, my input xml file and a screen shot of the module after the objects are inserted. Could anyone please let me know what the problem is? Also, I used soundex function my code because I don't know how to strip the trailing spaces from a string. So, if you could suggest how to strip out trailing white spaces from strings, that'll be helpful as well. Thank You. |
|||
![]() |
|||
![]() |
|||
First posting here was nonsense. I hadn't read your code properly. But my second paragraph still applies...
Also, you might find it easier to use the built-in (but not very well documented) XML functions getElementName_, getElementText_, hasChildElements_ (and others), and the type DOM_Element_. Can't remember exactly where I found out about these, but it was somewhere in these forums... Paul. ------------------------- Paul dot Tiplady at TRW dot com TRW Automotive Edited: 14-Jul-2008 at 10:16 by Paul Tiplady |
|||
![]() |
|||
![]() |
|||
Hi Anant,
you are using newModuleObject = create mod to create the new object in module. This form will insert the object at the beginning of Module (as first object), so all existing objects will be after that ... the created objects will be in opposite order. Better aproach is to use: newModuleObject = (null first mod)?(create mod):(create last sibling first mod); Greetings Reik ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany Edited: 14-Jul-2008 at 11:07 by Reik Schroeder |
|||
![]() |
|||
![]() |
|||
To trim whitespace off the beginning/end.
------------------------- David Pechacek AAI Services Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
|||
![]() |
|||
![]() |
|||
If you are planning to export/imprt data in XML format then I recommend that you use MSXML and/or the undocumented DXL perms (mentioned by Paul) for this.
The reason for this is handling of special characters. Your parsing code will get increasingly complex and slow as you discover more and more characters that you must search for and replace. I know this because I fell into the same trap when I first tried. I use MSXML to export to XML and undocumented perms to import XML and it is very efficient. ------------------------- Tony Goodman Smart DXL limited www.smartdxl.com |
|||
![]() |
|||
![]() |
|||
I tried using this approach but, I still get the same result.
Better aproach is to use: newModuleObject = (null first mod)?(create mod) ![]() |
|||
![]() |
|||
![]() |
|||
Hi Tony,
Is there an example you can provide on how to use the DXL perms? I'm too far along with my script to make changes now. But if perms is efficient, I'd like to know how it is done. Thank You. Regards, Anant If you are planning to export/imprt data in XML format then I recommend that you use MSXML and/or the undocumented DXL perms (mentioned by Paul) for this. I use MSXML to export to XML and undocumented perms to import XML and it is very efficient. |
|||
![]() |
|||
![]() |
|||
Hello,
I'm also having an issue with parsing the xml file. I've attached both my xml files that I used as input and a word file containing the screen shots of the resultant module, to illustrate the problem visually. If you observe the text that appears after 'function:' under CRC16 module on page 2 of the word file to the corresponding location on page 1, you'll notice two issues. #1. The module name appears incorrectly in case of the latter. That is, instead of 'CRC16 Module', 'CRC Module' is displayed. #2. The function name 'CRC16_PerformNativeEndian' doesn't even appear in case of the screen shot on page 1. Instead, it contains the value of Anchor and Anchor contains the value of Source. Looks like values have shifted to the left by a degree of 1, if you know what I mean. Also, in both cases, the objects (and their sub-objects) are displayed in the reverse order of their appearance in the xml file. Could anyone help me how to fix these problems? |
|||
![]() |
|||
![]() |
|||
Anant,
Example attached. It's a work in progress, but it should give you an idea of how to go on. And it doesn't get objects in the wrong order... ![]() Paul.
------------------------- Paul dot Tiplady at TRW dot com TRW Automotive |
|||
![]() |
|||
![]() |
|||
Paul, thanks for the script.
Would you mind posting a text xml file that is compatible with your script. Thanks |
|||
![]() |
|||
![]() |
|||
Ron,
Sorry, the content of the XML files is proprietary, so I can't let them out for public viewing. ![]() Paul. ------------------------- Paul dot Tiplady at TRW dot com TRW Automotive |
|||
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.