nevermind i found my error. i was trying to push in the new node at the
wrong position
jonese
On 8/12/05, jonese <[EMAIL PROTECTED]> wrote:
>
> I'm trying to update some XML which is stored in our DB and i'm getting an
> odd error.
>
> The error is:
> The index of a child element is out of range. There are only
> *"12"*children under this node.
> Therefore index *"14"* is out of the allowed range *[1-12]*.
>
> Here's the code i'm running:
>
> <cfif IsDefined('q_getDataDefinitions') AND
> q_getDataDefinitions.RecordCount>
> <cfloop query="q_getDataDefinitions">
> <!--- Turn the RAW XML Text into an XML Object so we can manipulate it in
> CF --->
> <cfif Len(Trim(q_getDataDefinitions.datadefinition))>
> <cfset thisXML = XMLParse(q_getDataDefinitions.datadefinition)>
> <cfset firstFindNode =
> XmlSearch(thisXml,'/datadefinition/item/SEKEYNAMEFIELD')>
> <cfdump var="#thisXML#">
> <cfoutput>#q_getDataDefinitions.formobjectname# is XML #IsXML(thisXml)#
> and has #ArrayLen(thisXML.datadefinition.item)# Items<br></cfoutput>
> <cfloop index="j" from="1" to="#ArrayLen(thisXML.datadefinition.item)#">
> Inserting sekeynamefiled into Item<cfoutput>#j#</cfoutput><br>
> <cfset thisXML.datadefinition.item[j] = XmlElemNew(thisXML,
> "sekeynamefield")>
> </cfloop>
> <cfset newfindNode =
> XmlSearch(thisXml,'/datadefinition/item/SEKEYNAMEFIELD')>
> <cfdump var="#newfindNode#">
> </cfif>
> </cfloop>
> </cfif>
>
> The dump shows up just fine, and it shows a total of 25 Item Nodes or
> elements (whatever the proper name is)
>
> The loop goes through 13 of the 25 elements and then when it gets to
> number 14 it chokes.
>
> Here's the XML for Item 14 as if it was the only thing in an XML file
>
> <?xml version="1.0" encoding="UTF-8"?>
> <datadefinition>
> <item id="14">
> <DATATYPE>varchar</DATATYPE>
> <LOOKUPTABLE/>
> <FIELDNAME>Envpreconfirm</FIELDNAME>
> <JAVASCRIPT/>
> <LOOKUPMULTIPLE/>
> <TABINDEX/>
> <READONLY>0</READONLY>
> <TABINDEX/>
> <READONLY>0</READONLY>
> <JAVASCRIPTHANDLER/>
> <COMMIT>1</COMMIT>
> <INPUTSTYLE/>
> <PK>0</PK>
> <LOOKUPDISPLAY/>
> <LOOKUPQUERY/>
> <INPUTTYPE>Text</INPUTTYPE>
> <LENGTH>255</LENGTH>
> <OBJECTLABEL>Pre Confirm</OBJECTLABEL>
> <DEFAULTVALUE/>
> <GRIDPOSVALUE>14_2</GRIDPOSVALUE>
> <MAXLENGTH>255</MAXLENGTH>
> <REQUIRED>0</REQUIRED>
> <LOOKUPLIST/>
> <GRIDPOSLABEL>14_1</GRIDPOSLABEL>
> <LOOKUPKEY/>
> <VALIDATE/>
> <WIDTH>40</WIDTH>
> <HEIGHT/>
> <LOOKUPTYPE/>
> </item>
> </datadefinition>
>
> Anyone see anything which would cause CF to choke? i already validated the
> XML and it's fine.
>
> thoughts?
>
> jonese
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:214811
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54