FreeBSD Port: libpdel-0.5.3_4

Yuzhu Chen yuzhu.chen at ericsson.com
Sun Sep 23 05:01:02 UTC 2012


Hi Mav,


Sorry for disturbing!
We are using libpdel.
In our souce code, structs_xml_input is called with STRUCTS_XML_LOOSE which means unrecognised xml tags will be ignored.
We are doing some tests about this.

The xml file we are using is as follows and corresponding structs_type structs_field are well defined.

<?xml version="1.0" standalone="yes"?>
<AtmService_cdb_array>
 <AtmService_cdb_entry>
  <moid><class>AtmService</class><slot>3</slot><port>1</port></moid>
  <data><numOfUsedAtmIwf>0</numOfUsedAtmIwf><transportPort><class>747</class><slot>3</slot><port>1</port></transportPort></data>
 </AtmService_cdb_entry>
 <AtmService_cdb_entry>
  <moid><class>AtmService</class><slot>4</slot><port>1</port></moid>
  <data><numOfUsedAtmIwf>1</numOfUsedAtmIwf><transportPort><class>747</class><slot>4</slot><port>1</port></transportPort></data>
 </AtmService_cdb_entry>
</AtmService_cdb_array>

When an un necessary xml tag is added into the xml file(shown below) and corresponding structs_type and structs_field is kept unchanged. The xml file can no be parsed correctedly.

<?xml version="1.0" standalone="yes"?>
<AtmService_cdb_array>
 <AtmService_cdb_entry>
  <moid><class>AtmService</class><slot>3</slot><port>1</port></moid>
  <data><for_test>1234</for_test><numOfUsedAtmIwf>0</numOfUsedAtmIwf><transportPort><class>747</class><slot>3</slot><port>1</port></transportPort></data>
 </AtmService_cdb_entry>
 <AtmService_cdb_entry>
  <moid><class>AtmService</class><slot>4</slot><port>1</port></moid>
  <data><for_test>1234</for_test><numOfUsedAtmIwf>1</numOfUsedAtmIwf><transportPort><class>747</class><slot>4</slot><port>1</port></transportPort></data>
 </AtmService_cdb_entry>
</AtmService_cdb_array>

Xml tags after the first <for_test>1234</for_test> can not be handled correctly any more.

Looks like structs_xml_pop not be called for unrecognised tags after looking through source code of libpdel.
In the function of structs_xml_unnest, maybe "goto done;" need to be added to avoid this problem.

static void structs_xml_unnest(struct xml_input_info *info, const XML_Char *name)
{
        struct xmlinput_stackframe *const frame = &info->stack[info->depth];
        const struct structs_type *type;
        const char *s;
        char ebuf[64];
        void *data;

        /* Skip if any errors */
        if (info->error)
                return;
        if (info->skip) {
                info->skip--;
                        goto done;
                return;
        }
...

May I have your comments?
Thank you!

BR/ Yuzhu Chen



More information about the freebsd-ports mailing list