Will this do what you want?

http://www.cflib.org/udf.cfm?ID=1026



Ung, Seng wrote:
Blair
root1 is already a xWindow, so root1.xWindow.XmlChildren won't work.
however, when I inserted root2.xmlName it will pulled in the root level of b.xml but not all the XML nodes. <cfset ArrayAppend(root1.XmlChildren, XmlElemNew(v_xmlDoc1,#root2.xmlName#))>
    -----Original Message-----
    *From:* Shib71 [mailto:[EMAIL PROTECTED]
    *Sent:* Tuesday, March 14, 2006 6:11 PM
    *To:* [email protected]
    *Subject:* Re: [CFCDev] Appending XML:

    Use this instead:
    <cfset ArrayAppend(root1.xWindow.XmlChildren,
    XmlElemNew(v_xmlDoc2,#root2#))>
    An XML document can only have one root node.

    Blair

    On 3/15/06, *Ung, Seng* <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>> wrote:

        I got two xml files named A.xml and B.Xml, What I like to do is
        to append the B.xml to A.xml,
        But It seem to me that I am missing something from my code or I
        am just off the based.
        Any suggestions?

        ----> here is A.XML
        <?xml version="1.0" encoding="UTF-8"?>
        <xWindow>
          <General>
            <Name>Space Center</Name>
            <BackIndex>1</BackIndex>
          </General>
        </xWindow>

        ----> here is B.XML
        <?xml version="1.0" encoding="UTF-8"?>
        <GroupA>
                <Source>
                <URLSource> http://www.test.com</URLSource>
                <URLTable>CiCo</URLTable>
            </Source>
        </GroupA>

        -----> Here is what I want
        <xWindow>
          <General>
            <Name>Space Center</Name>
            <BackIndex>1</BackIndex>
          </General>
                <GroupA>
                        <Source>
                        <URLSource>http://www.test.com</URLSource>
                        <URLTable>CiCo</URLTable>
                    </Source>
                </GroupA>
        </xWindow>

        here is what I am trying to do:

        <cffile action="READ" file=" a.xml" variable="v_xmlCode1">
        <cffile action="READ" file="b.xml" variable="v_xmlCode2">
        <cfset v_xmlDoc1 = xmlParse(v_xmlCode1)>
        <cfset v_xmlDoc2 = xmlParse(v_xmlCode2)>

        <cfset root1 = v_xmlDoc1.xmlRoot>
        <cfset root2 = v_xmlDoc2.xmlRoot>

        <cfset ArrayAppend(root1.XmlChildren,
        XmlElemNew(v_xmlDoc2,#root2#))>

        <cfdump var="#root2#">
        <cfabort>

















        ----------------------------------------------------------
        You are subscribed to cfcdev. To unsubscribe, send an email to
        [email protected] <mailto:[email protected]> with the words
        'unsubscribe cfcdev' as the subject of the email.

        CFCDev is run by CFCZone (www.cfczone.org
        <http://www.cfczone.org>) and supported by CFXHosting (
        www.cfxhosting.com <http://www.cfxhosting.com>).

        An archive of the CFCDev list is available at
        www.mail-archive.com/[email protected]
        <http://www.mail-archive.com/[email protected]>



    ----------------------------------------------------------
    You are subscribed to cfcdev. To unsubscribe, send an email to
    [email protected] with the words 'unsubscribe cfcdev' as the
    subject of the email.

    CFCDev is run by CFCZone (www.cfczone.org) and supported by
    CFXHosting (www.cfxhosting.com).

    An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to