tracker issue : CF-4201960

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Doc Bug for: StructAppend(xmlDoc, xmlDoc) example missing

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/NeedMoreInfo

Reporter/Name(from Bugbase): Aaron Neff / ()

Created: 04/12/2018

Components: Language

Versions: 2016

Failure Type: Usability Issue

Found In Build/Fixed In Build: 0 / docs

Priority/Frequency: Normal / Very few users will encounter

Locale/System: / Platforms All

Vote Count: 0

Issue: The "Modifying a ColdFusion XML object" doc's description of StructAppend is: "Appends a document fragment XML document object to another XML document object.", but there is no example.

I'm unsure what a working example would look like. FWIW, these all fail (i.e. the "bar" node does not appear in the dumps):

<cfscript>
  xmlDoc1 = xmlParse("<myXML><foo>foo</foo></myXML>");
  xmlDoc2 = xmlParse("<myXML><bar>bar</bar></myXML>");
  structAppend(xmlDoc1.myXML, xmlDoc2.myXML);//WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
  writeDump(xmlDoc1);
  abort;
</cfscript>

<cfscript>
  xmlDoc = xmlParse("<myXML><foo>foo</foo></myXML>");
  xmlElem = xmlElemNew(xmlDoc, "bar");
  structAppend(xmlDoc.myXML, xmlElem);
  writeDump(xmlDoc);//does not show the "bar" node
  abort;
</cfscript>

<cfscript>
  xmlDoc = xmlParse("<myXML><foo>foo</foo><bar>bar</bar></myXML>");
  xmlFragDoc = duplicate(xmlDoc.myXML.xmlNodes[2]);
  structDelete(xmlDoc.myXML, "bar");
  structAppend(xmlDoc.myXML, xmlFragDoc);
  writeDump(xmlDoc);//does not show the "bar" node
  abort;
</cfscript>

Related URL: https://helpx.adobe.com/coldfusion/developing-applications/using-web-elements-and-external-objects/using-xml-and-wddx/modifying-a-coldfusion-xml-object.html

Attachments:

Comments:

Hi Adobe, Another user asked the same question here: https://www.experts-exchange.com/questions/21679753/Using-StructAppend-with-two-XML-documents.html Thanks!, -Aaron
Comment by Aaron N.
27498 | April 12, 2018 06:53:37 AM GMT