Skip navigation
Currently Being Moderated

Hyphen in XML row name causing problems

Jan 10, 2014 12:41 PM

Tags: #xml #query #cf9

I have an xml file that I am trying to turn into a qury object so I can have the query interact with my SQL database

 

The XML file has 15 rows and I have successfully got 13 of them into a query.

 

The problem is that the remaining 2 fields have hyphens  or dashes -  in the row names. Like (WORK_E-MAIL)..See the - between E-Mail

 

So when I go to set the value in the query with this code

 

   <cfset temp = QuerySetCell(orderquery,"WORK_E_MAIL",

   #mydoc.rowset.ROW[i].WORK_E-MAIL.XmlText#, #i#)>  

 

I get this error message

 

Error Occurred While Processing Request

Invalid construct: Either argument or name is missing.

 

 

Is there some way to alias the row name with the hypen, maybe like this {WORK_E-MAIL}  or like this [WORK_E-MAIL]

 

I need to ge these 2 hypenated named rows into my query.

 

Any ideas?

 
Replies
  • Currently Being Moderated
    Jan 10, 2014 4:41 PM   in reply to weezerboy

    Try:

     

    <cfset temp = QuerySetCell(orderquery,"WORK_E_MAIL",

    mydoc.rowset.ROW[i].WORK_E-MAIL.XmlText, i)>

    

     

    or:

     

    <cfset temp = QuerySetCell(orderquery,"WORK_E_MAIL",

    "#mydoc.rowset.ROW[i].WORK_E-MAIL.XmlText#", i)>

     

    If either of these work, I'm not sure how your code worked for the first 13 rows.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 11, 2014 6:09 AM   in reply to weezerboy

    Have you attempted to use an assosicative array syntax?

     

    mydoc.rowset.row[ i ][ 'WORK_E-MAIL' ].XMLText

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points