[OPEN-ILS-DEV] PATCH: osrf_system.c

Mike Rylander mrylander at gmail.com
Mon May 21 12:44:48 EDT 2007


On 5/21/07, Scott McKellar <mck9 at swbell.net> wrote:
>
> --- Mike Rylander <mrylander at gmail.com> wrote:
>
> <snip>
>
> > I'm not certain I follow.  Do you mean extra text nodes in the DOM
> > tree that show up as strings of whitespace between, say, the <config>
> > element and the <srfsh> element?  If so, I can't think of any reason
> > that those should be considered meaningful, and should be ignored.
>
> No, I'm referring to non-whitespace text, such as:
>
> <srfsh>
>         <router_name>router</router_name>
>         <domains>
>                 <domain>localhost</domain>
>         </domains>
>         <username>osrf</username> Extra text here
>         <passwd>osrf</passwd>
>         <port>5222</port>
>         <logfile>/openils/var/log/srfsh.log</logfile>
>         <loglevel>4</loglevel>
> </srfsh>

Wow ... yeah, we should definitely ignore that -- assuming it parses
properly.  I never would have thought to try that, honestly, and I can
see no use for such orphaned text nodes.

I didn't notice such a construct in any of the example config files,
so I suppose this was an experiment on your part?

>
> We appear to skip over the text between tags if it's all white space,
> but if there's anything other than whitespace, we capture all of
> the text -- including the whitespace.
>
> It might not break if the extra text comes last -- e.g. after
> the loglevel element in the above example.  I haven't tried that
> yet.
>
> Give it a try -- add some extraneous text and see what happens when
> you run, for example, srfsh.  Things might work a little differently
> in your environment, especially if you're using a different version
> of object.c with more sanity checking.

The key seems to be ILS/OpenSRF/src/utils/xml_utils.c -- specifically
_xmlToJSON().  It should be simple enough to fix this, really.  We can
just check to see if there is more than one child node for a given
parent, and ignore text nodes in that case.  See

http://open-ils.org/cgi-bin/viewcvs.cgi/ILS/OpenSRF/src/utils/xml_utils.c?r1=1.2&r2=1.3&diff_format=l

for my provisional approach to a fix (ignore the spacing :P), and
thanks, as usual...

--miker

>
> It's a bit convoluted.  I'm at work now and can't go into the details.
> I'll explain further tonight when I get home, if you don't find it
> yourself first.
>
> Scott McKellar
> http://home.swbell.net/mck9/aargh/
>
>


-- 
Mike Rylander


More information about the Open-ils-dev mailing list