Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I hardly doubt any1 will understand
Its about an algorithm to parse, well, actualy store parsed data gained from an xml file. This is about programming, not web services and stuff, but i hope one here knows this. My freinds at C/C++ board dont seem to see it as related due to its title...So tither.
Is this a good way, or a good model, or algorithm, or something for storing the information tagged in a xml file?
We have a struct: (this is in C)
void *information;//or **
attributes *atribs;//an array of structs explained later
struct node *next;
for every tag we find we find we allocate a node,assign its name to the node.name (im not sure what its called, the text between '<' and '>'), and the void pointer array, well heres some explaining...
first the text between the tags will be put in a string which pointer of that string will be an element of the array. If all the tagged area contains is text, then this will be the only member of the array.
However, if a nother tag is encountered, it allocates another node, actually pushes it onto the stack (u can tell by the *next)and it repeats the process for that new node. The address of the new node becomes an element for the info array of in the last.
Any text after the nested area becomes a second string.Im not sure if this is all great, but it keeps things in order.
Therefore, all nodes can be nested. Any empty tags have NULL as a value for *info (or **info).
This seems prettry good...may be...namespaces can probably have some seperation from name...
Heres for the atrributes..
for every single attrib we'll have one of these, storing its name and value accordingly.
Thus, is this ok?
0 · ·