05-01-2012 10:06 AM
Hi!
So, reading a html file and extracting a table, i used String to spreadsheet with "<tr" and an inner loop with "<td" as delimiters. Sound logical right?
Somehow i got an empty row and an empty column and it's reproducible with a string control starting with "<tr". Is this a known bug and/or fixed in 2011 SP1 ?
/Yamaeda
Solved! Go to Solution.
05-01-2012 10:27 AM
Please post your html file, so we can try.
05-01-2012 12:53 PM
I've extracted the innards of the html table in another step wants to convert this text (attached as file) to a 2D table.
/Y
05-01-2012 01:18 PM
I think what you're saying is that if the string begins with the delimiter, you get a blank element (if you set the delimiter to ',' and feed it ",5,8" you get ["","5","8"]). I wouldn't call this a bug, because there might be cases where you want to have an empty element (such as an empty string) in a list, and that empty element could be the first element of the array.
05-01-2012 04:11 PM
It would seem to me that it would be far more logical (in response to the first question in the original post) to use the XML Parser functions to do this since that portion of HTML can be treated as XML. Just providing an alternate solution.
05-01-2012 05:37 PM
I figured that Smercurio, but i haven't look at that alot so didn't get it to work in a hurry. Any pointers on that one?
@Nathan, you're right, the delimiter is supposed to be _after_ the cell, so i should get an empty first ... maybe i should use </tr> and </td> instead ...
So, there's no bug here, circle around, nothing to see. 😉
/Y
05-02-2012 08:13 AM
@Yamaeda wrote:
I figured that Smercurio, but i haven't look at that alot so didn't get it to work in a hurry. Any pointers on that one?
Sure, since you're dealing with Starcraft info, and I thought the original Starcraft was an awesome game.
If you open the Example Finder and search for "XML", open the example called "Query XML Document for Multiple Nodes". Take the text that you posted and replace everything between <bookstore> and </bookstore> in the large string control in the front. Thus, the large string control should have
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<tr> .... </tr>
</bookstore>
Change the search string to "/bookstore/tr/td". When you run the VI the array should give you all of the <td> elements.
That should be a good start.