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

XML Includes and XMLPArse()

New Here ,
Oct 26, 2006 Oct 26, 2006

Copy link to clipboard

Copied

I have an XML file that has the following at the top:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MyDtd[
<!ENTITY getInclude SYSTEM "thisInclude.xml">
]>

Later on in the file I call the include:
<product>
<name>productName</name>
<version>ProductVersion</version>
&getInclude;
</product>

Both the parent and the include XML files are properly formated and when I open the parent or even just the include in a browser they render correctly. However, when I use Coldfusion's XML Parse():

<cfscript>
Request.myXML = XmlParse(expandPath('/config/config.xml'));
</script>
<cfdump var="#Request.myXML#">

the results are incorrect. What I get back is this "[unknown type]". However, if I remove the &getInclude; the page renders fine. So far I must conclude that XMLParse() cannot handle XML Includes. This isn't anything new. Includes inXML has been around for awhile. I can't be the first to encounter this am I? Is there something I'm missing or not aware of that's preventing this from working?
TOPICS
Advanced techniques

Views

492

Translate

Translate

Report

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
Advisor ,
Oct 26, 2006 Oct 26, 2006

Copy link to clipboard

Copied

"&getInclude;" is not an XML include.
XmlParse often fails with invalid XML.

See the XML spec: http://www.w3.org/TR/xinclude/ .

Votes

Translate

Translate

Report

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
New Here ,
Oct 26, 2006 Oct 26, 2006

Copy link to clipboard

Copied

MikerRoo,

There is more than one way to do an include in XML and yours is one of them. However, yours doesn't work either. For the record "&getInclude;" IS a valid XML include and the XML parses correcly. Just not using the coldfusion function.

Thanks for trying.


Votes

Translate

Translate

Report

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
Advisor ,
Oct 26, 2006 Oct 26, 2006

Copy link to clipboard

Copied

Wrong.

What you are doing is using an external entity, NOT an include. Read the specs.

Anyway, XmlParse is very primative. It's been reported that external entity support will be added to CF 8.

Votes

Translate

Translate

Report

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
New Here ,
Oct 26, 2006 Oct 26, 2006

Copy link to clipboard

Copied

"What you are doing is using an external entity, NOT an include. Read the specs." <--- Hmmm, almost an RTFM.

"Anyway, XmlParse is very primative. It's been reported that external entity support will be added to CF 8." <-- This was more informative.

I guess the question now changes to: Can XMLPArse() handle XML includes or External entities? And as it is now, it would seem that it can't.

Votes

Translate

Translate

Report

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
Advisor ,
Oct 26, 2006 Oct 26, 2006

Copy link to clipboard

Copied

LATEST
quote:

Originally posted by: little seal
I guess the question now changes to: Can XMLPArse() handle XML includes or External entities? And as it is now, it would seem that it can't.


Yes, after rummaging through my archives, that appears to be the case. You will have to use java or some other workaround until this is fixed in CF8.

Votes

Translate

Translate

Report

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
Documentation