Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 12-Jul-2008 00:49
User is offline View Users Profile Print this message


anant mitra

Posts: 50
Joined: 27-Jul-2007

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.
Report this to a Moderator Report this to a Moderator
 14-Jul-2008 10:12
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

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
Report this to a Moderator Report this to a Moderator
 14-Jul-2008 11:07
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

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
Report this to a Moderator Report this to a Moderator
 14-Jul-2008 13:48
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

To trim whitespace off the beginning/end.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 14-Jul-2008 13:55
User is offline View Users Profile Print this message


Tony Goodman

Posts: 97
Joined: 6-May-2008

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
Report this to a Moderator Report this to a Moderator
 14-Jul-2008 19:17
User is offline View Users Profile Print this message


anant mitra

Posts: 50
Joined: 27-Jul-2007

I tried using this approach but, I still get the same result.



Better aproach is to use: newModuleObject = (null first mod)?(create mod)create last sibling first mod);
Report this to a Moderator Report this to a Moderator
 14-Jul-2008 19:19
User is offline View Users Profile Print this message


anant mitra

Posts: 50
Joined: 27-Jul-2007

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

Originally posted by: Tony Goodman

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.
Report this to a Moderator Report this to a Moderator
 14-Jul-2008 22:03
User is offline View Users Profile Print this message


anant mitra

Posts: 50
Joined: 27-Jul-2007

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?
Report this to a Moderator Report this to a Moderator
 15-Jul-2008 11:05
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

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.

xml_v_draft.dxl
xml_v_draft.dxl  (7 KB)



-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive
Report this to a Moderator Report this to a Moderator
 15-Jul-2008 18:13
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

Paul, thanks for the script.

Would you mind posting a text xml file that is compatible with your script.

Thanks
Report this to a Moderator Report this to a Moderator
 16-Jul-2008 08:50
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.