0
Explorer
,
/t5/coldfusion-discussions/xml-to-query-error/td-p/391057
Mar 05, 2008
Mar 05, 2008
Copy link to clipboard
Copied
I have an XML document that I'm trying to turn into a query,
but I'm getting an error: "Element P is undefined in MYDOC." I have
an element called "P-Info" and I think that the code doesn't like
the dash.
I am trying to extract the TS, Latitude, Longitude and Own values out of the XML document.
I'm using CFMX 7.
I am trying to extract the TS, Latitude, Longitude and Own values out of the XML document.
I'm using CFMX 7.
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
LEGEND
,
Mar 05, 2008
Mar 05, 2008
unleashed wrote:
> I have an XML document that I'm trying to turn into a query, but I'm getting an
> error: "Element P is undefined in MYDOC." I have an element called "P-Info"
> and I think that the code doesn't like the dash.
>
> I am trying to extract the TS, Latitude, Longitude and Own values out of the
> XML document.
>
> CFML Document:
>
> <cffile action="read" variable="xml" file="#ExpandPath('.')#\sample.xml">
> <CFSet mydoc = XMLParse(xml)>
> <cfset pb = mydoc.META.P-Info.xmlChild...
> I have an XML document that I'm trying to turn into a query, but I'm getting an
> error: "Element P is undefined in MYDOC." I have an element called "P-Info"
> and I think that the code doesn't like the dash.
>
> I am trying to extract the TS, Latitude, Longitude and Own values out of the
> XML document.
>
> CFML Document:
>
> <cffile action="read" variable="xml" file="#ExpandPath('.')#\sample.xml">
> <CFSet mydoc = XMLParse(xml)>
> <cfset pb = mydoc.META.P-Info.xmlChild...
LEGEND
,
/t5/coldfusion-discussions/xml-to-query-error/m-p/391058#M35265
Mar 05, 2008
Mar 05, 2008
Copy link to clipboard
Copied
unleashed wrote:
> I have an XML document that I'm trying to turn into a query, but I'm getting an
> error: "Element P is undefined in MYDOC." I have an element called "P-Info"
> and I think that the code doesn't like the dash.
>
> I am trying to extract the TS, Latitude, Longitude and Own values out of the
> XML document.
>
> CFML Document:
>
> <cffile action="read" variable="xml" file="#ExpandPath('.')#\sample.xml">
> <CFSet mydoc = XMLParse(xml)>
> <cfset pb = mydoc.META.P-Info.xmlChildren>
> <cfdump var="#pb#">
Yes, when you use dot notation every element must be a valid ColdFusion
variable name which means no spaces, dashes, ect.
If you have elements like this you must use array notation.
I.E. <cfset pb = mydoc["meta"]["p-info"]["xmlChildren"]>
OR if you don't mind mixing dot and array notation.
<cfset pb= myDoc.meta["p-info"].xmlChildren>
> I have an XML document that I'm trying to turn into a query, but I'm getting an
> error: "Element P is undefined in MYDOC." I have an element called "P-Info"
> and I think that the code doesn't like the dash.
>
> I am trying to extract the TS, Latitude, Longitude and Own values out of the
> XML document.
>
> CFML Document:
>
> <cffile action="read" variable="xml" file="#ExpandPath('.')#\sample.xml">
> <CFSet mydoc = XMLParse(xml)>
> <cfset pb = mydoc.META.P-Info.xmlChildren>
> <cfdump var="#pb#">
Yes, when you use dot notation every element must be a valid ColdFusion
variable name which means no spaces, dashes, ect.
If you have elements like this you must use array notation.
I.E. <cfset pb = mydoc["meta"]["p-info"]["xmlChildren"]>
OR if you don't mind mixing dot and array notation.
<cfset pb= myDoc.meta["p-info"].xmlChildren>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
unleashed
AUTHOR
Explorer
,
LATEST
/t5/coldfusion-discussions/xml-to-query-error/m-p/391059#M35266
Mar 06, 2008
Mar 06, 2008
Copy link to clipboard
Copied
Thanks Ian... I thought that it was probably the "d" (dash)
that was causing the issue.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

