Skip to main content
June 20, 2008
Question

xml output

  • June 20, 2008
  • 4 replies
  • 444 views
I am trying to put hx:name and i am getting error message any idea? I think when I use : (colan) that consider as expression

<addresses>
<address>
<hx:name>Richard Mutt</hx:name>
<addrLine1>30 Main St.</addrLine1>
<addrLine2>New Haven, CT 06460</addrLine2>
</address>
</addresses>

<cfoutput>#resultsXML.address.hx:name.inner_text#</cfoutput>

Any help would be appreciated. Thanks
This topic has been closed for replies.

4 replies

BKBK
Community Expert
Community Expert
June 24, 2008
There is no XSD file at http://ns.qqq.org/report/s1/at.xsd
June 24, 2008
Thanks. I have similar question

<StandardReports xmlns=" http://ns.aaa.org/report/s1/" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:lom=" http://labc.org/xsd/doc" xmlns:m=" http://ns.abq.org/student/k1/" xmlns:n=" http://ns.cq.org/name/k1/" xmlns:hx=" http://ns.medbiq.org/extend/k1/" xsi:schemaLocation=" http://ns.qqq.org/report/s1/at.xsd">

How do I validate this xsd files.

I did this
<cfset myResults=XMLValidate("example.xml"," http://ns.qqq.org/report/s1/at.xsd")>

I am getting following error


struct
errors
array
1 [Error] :2:412: cvc-elt.1: Cannot find the declaration of element 'StandardReports'.
fatalerrors
array [empty]
status NO
warnings
array
1 [Warning] :2:412: SchemaLocation: schemaLocation value = ' http://ns.qqq.org/report/s1/at.xsd' must have even number of URI's.
BKBK
Community Expert
Community Expert
June 23, 2008
<cfxml variable="resultsXML">
<addresses>
<address>
<hx:name xmlns:hx=' http://www.google.com'>Richard Mutt</hx:name>
<addrLine1>30 Main St.</addrLine1>
<addrLine2>New Haven, CT 06460</addrLine2>
</address>
</addresses>
</cfxml>

<cfoutput>#resultsXML.addresses.address["hx:name"].xmltext#</cfoutput>


Three things:
1) Use namespace
(Here I use google arbitrarily)
2) Use associative array notation to avoid problems with the colon
3) I have corrected the output variable

BKBK
Community Expert
Community Expert
June 21, 2008
When you use a prefix like hx, the XML processor expects you to declare a namespace.

June 23, 2008
Thanks. You mean declare in xml file right or when you out put this?? I am not sure where to declare.