Is the answer to my original question "yes" or "no"?

AFAIK it is "no". A thorough reading of the documentation will give you a definite answer though.

The calling function does not know, and the called function does not care.

But why? If the sub createOwner is under your control, then the fix suggested by choroba solves the problem in only a few characters. I may be wrong, but I get the feeling from this and the previous questions you have posted that you are trying to bend the module to your wishes instead of accepting the API the way it is and just using it...

But anyway, here's an interesting hack ("just enough rope" etc. etc.): In your code, replace "sub _addNode {" with "sub XML::LibXML::Element::appendTextOrElement {" and then replace "$root = &_addNode($root, $owner);" with "$root->appendTextOrElement($owner);". Does that fit your expectations better? ;-)


In reply to Re^3: XML::LibXML creating nodes with a string OR a node by Anonymous Monk
in thread XML::LibXML creating nodes with a string OR a node by worik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.