Codesnippets > Code Snippets

xml parser

<< < (2/5) > >>

I got it to parse everything now, as far as I can tell anyway. I'll post the new code here in a minute which will extract all tags/attributes from the project file.  I just want to make a correction to the xml declaration tag name, which shows "?xml" instead of just "xml".  Also, right now attributes only work with double quotes, not single quotes. I want to fix that too.

Does anyone know if mixing single and double quotes around an attribute value is permitted or do they have to match?
something = "puppy'

Well, I found either a bug in the INSTR command or in the help documentation.  The help says INSTR returns -1 if the substring isn't found, however, it actually returns 0.  Considering 0 could be the first character in the string, I'd say its a bug in the command.  Luckily, I can safely assume a quote or double quote will never be the first character on a line.

Have you updated your beta copy ?  Previously INSTR did have a bug!

I looked at the DBPro code ages ago - didn't know it was you who wrote it!

Well I'm just using the free version of GLB.  Right now I have a headache trying to track down one little bug.  If you look at a gbap file, the closing tag for GLBASIC is being added as it's inner content and I have no clue why. So basically it says the inner content of GLBASIC is "</GLBASIC" and it doesn't do this on any other tags.   I'll update the code above to what I have now.

At the moment, I dont think it can handle ?XML at the begining of GLBasic XML project files...

It should now, and should now find the attributes which using either double or single quotes.  And I've fixed the bug I just described above.  Like I figured, it was an issue with the DBP/GLB conversion where 0 is the start of a string and not 1. Basically, all I had to do was set matchOpenBracket to -1 instead of 0 and check for that condition when adding the content.

Everything should work now, I've already updated the code in the first post.  Give it a try with one of your project files.


[0] Message Index

[#] Next page

[*] Previous page

Go to full version