Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

xml output

Guest
Jun 20, 2008 Jun 20, 2008
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
TOPICS
Advanced techniques
398
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 21, 2008 Jun 21, 2008
When you use a prefix like hx, the XML processor expects you to declare a namespace.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 23, 2008 Jun 23, 2008
Thanks. You mean declare in xml file right or when you out put this?? I am not sure where to declare.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 23, 2008 Jun 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 24, 2008 Jun 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 24, 2008 Jun 24, 2008
LATEST
There is no XSD file at http://ns.qqq.org/report/s1/at.xsd
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources