azzeddine1265 / libkml

Automatically exported from code.google.com/p/libkml
Other
0 stars 0 forks source link

ExpatHandlerNs hands bad xml to underlying ExpatHandler #105

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. ParseAtom() on <atom:content> with unknown child
2.
3.

What is the expected output? What do you see instead?

ExpatHandlerNs::TranslatePrefixedName's TODO indicates the problem.
The result is that the underlying ExpatHandler is passed something like
<urn:foo:bar:goo|element> which is not legal xml.

The fix is as the TODO indicates

What version of the product are you using? On what operating system?

1.0.1-ish

Did you run the unit test suite that comes with the project? Did all tests pass?

yes.  no unit test for this particular case

Please provide any additional information below.

Original issue reported on code.google.com by bent.hag...@gmail.com on 18 Jun 2009 at 2:08

GoogleCodeExporter commented 9 years ago

use the attached file as this xml and notice that the
xml returned by get_unknown_elements_array_at()
has elements expanded to:

<urn:oasis:names:tc:emergency:cap:1.1|alert>

  std::string errors;
  kmldom::AtomFeedPtr feed =
      kmldom::AsAtomFeed(kmldom::ParseAtom(xml, &errors));
  if (!feed.get()) {
    LOG(ERROR) << "atom parse failed: " << url;
    LOG(ERROR) << "atom parse failed: " << errors;
    return 1;
  }

  int entry_count = feed->get_entry_array_size();
  LOG(INFO) << "entry count: " << entry_count;
  for (int i = 0; i < entry_count; ++i) {
    const kmldom::AtomEntryPtr entry = feed->get_entry_array_at(i);
    LOG(INFO) << "title: " << entry->get_title();
    if (entry->has_content() &&
        entry->get_content()->get_unknown_elements_array_size() > 0) {
      // TODO(bent): parse the CAP <alert>
      VLOG(1) << entry->get_content()->get_unknown_elements_array_at(0);
    }
  }

Original comment by bent.hag...@gmail.com on 18 Jun 2009 at 2:24

Attachments: