Was this page helpful?

Xml.Html

    Table of contents
    1. 1. Usage Restrictions
    2. 2. Parameters
    3. 3. Result
    4. 4. Samples
    xml.Html(doc : xml, xpath? : str) : xml
    

    Extract the inner portion of xml nodes into a new xml document.

    Usage Restrictions

    9.02 or later

    Parameters

    Name Type Description
    source doc XML source document
    xpath str (optional, default:none) Xpath of the element(s) to extract child nodes from

    Result

    The result is always a new document and since documents cannot have more than one root, the result is always wrapped in <html><body>...</body></html>, which is the default envelope for emitted xml from dekiscript. I.e. it is automatically stripped when inserted into Deki. When the xpath matches multiple elements, all child nodes of the matched elements are appended to the <html><body> document, but the matched node themselves are omitted.

    Samples

    Dekiscript Xml Emitted on page
     Inner Xml:
    {{xml.html(<div>"some ";<b>"text"</b></div>)}}
    <html>
      <body>
        some <b>text</b>
      </body>
    </html>
    
    some text
     Inner Xml of Xpath:
    {{xml.html(<ul><li>"a"</li><li><b>"b"</b></li></ul>, "li")}}
    <html>
      <body>
        a
        <b>b</b>
      </body>
    </html>
     a b
    Rewriting <ul> with <ol>
    var html = <div>
        <p> 123 </p>
        <p> 456 </p>
        <p> 789 </p>
    </div>;
    xml.html(html, 'p');
    <html>
      <body>
        123456789
      </body>
    </html>

    123456789

    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by