* Melchior FRANZ -- Monday 04 December 2006 15:53:
> * Stefan Seifert -- Monday 04 December 2006 15:47:
> > <foo include="bar.xml" omit-tag="yes"/>
> 
> Yes, that's probably the cleanest solution. (Using "y" instead of or
> in addition to "yes", to be consistent with other attribute values.)

My current favorite is "omit-node". The syntax would be:

  <whatever  include="some-file.xml"  omit-node="y"/>

but this would work, too, and do what one would expect:

  <whatever  include="some-file.xml"  omit-node="y">
      <something>bad</something>
  </whatever>

The contents of some-file.xml as well as the <something> node
would appear on the same level where <whatever> was, as that
node was simply dropped. The <whatever> is completely arbitrary.
One could have written:

  <_ include="some-file.xml" omit-node="y"/>

or 

  <imported-instrument-animations include="some-file.xml" omit-node="y"/>




The changes are less intrusive than I had feared:



diff -u -p -r1.14 props_io.cxx
--- props_io.cxx        8 Mar 2006 18:16:09 -0000       1.14
+++ props_io.cxx        4 Dec 2006 18:34:18 -0000
@@ -229,6 +229,21 @@ PropsVisitor::startElement (const char *
       } catch (sg_io_exception &e) {
        setException(e);
       }
+
+      const char *omit = atts.getValue("omit-node");
+      if (omit && !strcmp(omit, "y")) {
+        int nChildren = node->nChildren();
+        for (int i = 0; i < nChildren; i++) {
+          SGPropertyNode *src = node->getChild(i);
+          const char *name = src->getName();
+          int index = st.counters[name];
+          st.counters[name]++;
+          SGPropertyNode *dst = st.node->getChild(name, index, true);
+          copyProperties(src, dst);
+        }
+        st.node->removeChild(node->getName(), node->getIndex(), false);
+        node = st.node;
+      }
     }

     const char *type = atts.getValue("type");


Does anyone have objections to the whole idea? Or not understand
what it's good for? Or better suggestions for "omit-node"?

m.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to