[olug] [OT]: C & XML

Chad Homan choman at gmail.com
Wed Nov 7 21:07:34 UTC 2012


If I took a guess, it's libxml2. I like the looks of mini-xml, but I am not
sure if I
can introduce a new library at this time.

to answer the other question.  currently I am trying to modify in place and
write it out,
because that's what most of the existing code does.  but whatever is easiest

>From my example:

   - The existing code, loops cur_node until is sees "data"
   - Fires a second loop child_node, string comparing each item:
      - if strcmp(child->name, "data1"):
         - xmlSetProp(child, "name", new_value)
      - if strcmp(child->name, "data2"):
         - xmlSetProp(child, "name", new_value)

Unfortunately this would add new or remove outdated entries, so what I am
trying to do is

   - The existing code, loops cur_node until is sees "data"
   - Fires a second loop child_node, string comparing each item:
      - if strcmp(child->name, "data1"):
         - NewFunc(child, list_of_objects)
         - if strcmp(child->name, "data2"):
         - NewFunc(child, list_of_objects)

so the newFunc, currently loops though the list_of_objects, but I'm having
issues
getting the correct APIs together to: clean-house and create new objects

 Together We Win!
--
Chad
Creating A More Meaningful Life


On Wed, Nov 7, 2012 at 11:37 AM, Ed Pluta <epluta3 at cox.net> wrote:

> What are you using to parse the XML (I like expat)?. Are you looking to
> update the xml file in place or read it in, update, and write another file
> out, or just parse it and update in memory?
>
> Ed
>
> -----Original Message-----
> From: olug-bounces at olug.org [mailto:olug-bounces at olug.org] On Behalf Of
> Chad
> Homan
> Sent: Wednesday, November 07, 2012 11:03 AM
> To: Omaha Linux User Group
> Subject: [olug] [OT]: C & XML
>
> looking for a pointer or assistance with a C and XML issue.
>
> please contact me off-list
>
> But to start the wheels turning, Ihave a section of an XML file that I need
> to update in C I really don't want to explain the C part, but it is a
> requirement.  Here is my sample xml:
>
> <xmldoc>
>    <data>
>       <data1 name  = "jump" />
>       <data2 name  = "plane" />
>    </data>
>
>     OTHER STUFF
> </xmldoc>
>
> needs to update to:
>
> <xmldoc>
>    <data>
>       <data1 name  = "leap" />
>       <data1 name  = "frog" />
>       <data2 name  = "bus" />
>       <data2 name  = "plane" />
>       <data2 name  = "car" />
>    </data>
>
>    OTHER STUFF
> </xmldoc>
>
>
> Together We Win!
> --
> Chad
> Creating A More Meaningful Life
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> https://lists.olug.org/mailman/listinfo/olug
>
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> https://lists.olug.org/mailman/listinfo/olug
>



More information about the OLUG mailing list