Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi;

 

I need to convert data stored in flat binary file (legacy database) to XML tags. The data are typically arrays of integers, float, logical ... and so forth.

 

I have read few XML books but none seems to touch the issue of presenting Array data in XML tags. I need to maintain awarness of the array name, indexes and values for each index.

 

Any one got an idea on how to do this or knows a site where I can check it out?

 

Thansk

Posted

I'm not shure on this ... but I think you should read some XSLT books... If you build your own XSLT to do that it must work...

 

But... Good luck...

Software bugs are impossible to detect by anybody except the end user.
Posted

Thanks for the reply.

 

If you happen to know the title of a good book, please post the name. There is a book for Riley (not sure what the title is ... something XSLT something) which I will probably end up buying.

 

This array issue is a pain. I can create a bunch of tags but I can't believe there is no standard or guidance ... at least I have not seen one.

Posted

From what I understand of XML, the reason you might not find a standard is because XML is what you make of it. I am thinking about your array issue and wondering, could you do something like this:

 

<root>

<Array Name="myStrings" Type="String">

<Value Position="0" sValue="Foo"/>

<Value Position="1" sValue="Bar"/>

</Array>

<Array Name="myArray" Type="Integer">

<Value Position="0" iValue="37"/>

<Value Position="1" iValue="65"/>

</Array>

</root>

 

Is that something like what you are looking for?

Or are you looking for the actual code to do this?

Posted

cyclonebri,

 

Thanks for the reply:

 

 

<root>

<Array Name="myStrings" Type="String">

<Value Position="0" sValue="Foo"/>

<Value Position="1" sValue="Bar"/>

</Array>

<Array Name="myArray" Type="Integer">

<Value Position="0" iValue="37"/>

<Value Position="1" iValue="65"/>

</Array>

</root>

 

Is that something like what you are looking for?

Or are you looking for the actual code to do this?

 

Can you extrpolate this to 2D array, a 2 by 3 like this?

MyArray(1,1) = 14

MyArray(1,2) = 25

MyArray(1,3) = 35

MyArray(2,1) = 13

MyArray(2,2) = 46

MyArray(2,3) = 44

 

I would appreciate a tip on how to transform it to a table.

Posted

<root>

<Array Name="myStrings" Type="String">

<Value Position1="1" Position2="1" sValue="Fourteen"/>

<Value Position1="1" Position2="2" sValue="Twenty-Five"/>

</Array>

<Array Name="myArray" Type="Integer">

<Value Position1="1" Position2="1" iValue="14"/>

<Value Position1="1" Position2="2" iValue="25"/>

</Array>

</root>

 

Is this what you mean? I am unsure what exactly you were asking in your last post. I assume you are looking for something like this.

 

With xml, just remember you set it how you want it. All I did here that is different from the last one was just gave the Value tags another attribute for Position2 and changed the original position to Position1. You can add as many attributes as you need to the tag, but this seems to be the way that I would do what you are trying to do.

The xml for this follows this path:

<root>

(<array><value />*</array>)*

</root>

 

remember, since Xml is what you make of it, you could have done whatever you wanted

<root>

(<anyTagName>(<Whatever><NestedTags />*</Whatever>)*</anyTagName>)*

</root>

 

.Net gives us some powerful ways using the DOM Document and datasets to get the xml attributes and so that is why I just put it to one level for the values. You could have done tags for each position, but it's a lot more work that way.

 

Anyway, I hope this has been helpful.

Brian

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...