xmlTreeAddPrevSibling

 

SYNOPSIS

    xmlNode xmlTreeAddPrevSibling(xmlNode node, xmlNode sibling)

Parameters:

  • node - the xmlNode that the sibling is being added next to

  • sibling - the xmlNode that is being added as the previous sibling of node

Returns:

  • the sibling


DESCRIPTION
xmlTreeAddNextSibling() adds sibling before the specified node.


EXAMPLE
Given the XML document

<top>
    <item>item 1</item>
    <item>item 2</item>
    <summary>
        <name>Squiggy</name>
        <detail>fuzzy</detail>
        <color>blue</color>
        <size>big</size>
    </summary>
</top>

The command

    <$ret = (xmlTreeAddPrevSibling($summary, $detail))>

Would result in:

<top>
    <item>item 1</item>
    <item>item 2</item>
    <detail>fuzzy</detail>
    <summary>
        <name>Squiggy</name>
        <color>blue</color>
        <size>big</size>
    </summary>
</top>


CAVEATS
If this operations results in two text nodes being siblings of each other, the second node will be merged into the first and then unlinked. Any changes made to the second text node will not be reflected in the tree.


SEE ALSO
xmlTreeAddChild, xmlTreeAddChildList, xmlTreeAddNextSibling, xmlTreeAddSibling, xmlTreeSetRootElement


Copyright © Thunderstone Software     Last updated: Dec 10 2018
Copyright © 2019 Thunderstone Software LLC. All rights reserved.