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

XML & Indesign image path

New Here ,
Feb 20, 2018 Feb 20, 2018

Hi,

I'm really new to the xml import part for indesign, but i'm going to need it extensively.

How do I format the xml to be able to import images from a local path or a url path from my server?


I can do everything with text but it doesn't work for image files.

I tried the <image href="localimagepath"></image> but this doesn't work, it says there is an error in my code when importing.

This is on osx and the path is from my terminal.

5.2K
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

correct answers 1 Correct answer

Explorer , Jul 06, 2018 Jul 06, 2018

Hi,

The correct syntax for file path is <image href="File:///Path/to/file"></image>

A pretty complete reference can be found here.

Hope it helped.

Translate
Explorer ,
Jul 06, 2018 Jul 06, 2018

Hi,

The correct syntax for file path is <image href="File:///Path/to/file"></image>

A pretty complete reference can be found here.

Hope it helped.

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
New Here ,
Jan 24, 2025 Jan 24, 2025

Hello i'm having the same problem.

I've tried your syntax but it doesn't work, sayng there is an error.

With this sintax there is no error, but also no image:  <image>href=“file:///img/123456.png”</image>

The image folder is in the same xml folder.

 

Thanks in advance.

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
LEGEND ,
Jan 24, 2025 Jan 24, 2025

@LMR78

 

You've "file" instead of "File".

 

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
New Here ,
Jan 27, 2025 Jan 27, 2025

Thanks for the help Robert, but it doesn't works for me.

Here is the line:  <image>href=“File:///img/123456.png”</image>

I dont' know why.

 

When i import the xml in my indesign, i have to do something to see the image or only put my data in a text window?
Thank you.

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
LEGEND ,
Jan 27, 2025 Jan 27, 2025

You have unnecessary ">" after the image - which makes text after that - as text - not an argument for "image". 

 

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
New Here ,
Jan 27, 2025 Jan 27, 2025

I have tried with this, <image href=“File:///img/123456.png”></image>

but indesign reports a sintax error.

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
LEGEND ,
Jan 27, 2025 Jan 27, 2025

Probably because you've different double quotes. 

 

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
LEGEND ,
Jan 27, 2025 Jan 27, 2025

You need to prepare your mockup / test file in the plain-text ASCII editor - Notepad on Windows - not RTF editor. 

 

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
New Here ,
Jan 27, 2025 Jan 27, 2025

My xml comes out from notepad, then i'm modifing it using notepad++, then saving it as xml.

I can upload it for your review.

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
LEGEND ,
Jan 27, 2025 Jan 27, 2025

You need to replace RED ones with the GREEN ones:

 

RobertatIDTasker_0-1737999673103.png

 

 

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
New Here ,
Jan 28, 2025 Jan 28, 2025

Finally, it works!

 

Thank you a lot Robert.

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
LEGEND ,
Jan 28, 2025 Jan 28, 2025
quote

Finally, it works!

 

Thank you a lot Robert.


By @LMR78

 

You'are welcome.

 

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
New Here ,
Jan 28, 2025 Jan 28, 2025

I'm sorry Robert, i'm here again with another issue:

I've edited another xml file, the image are imported, but indesign opens the window to select the image for every image istance. So, i have to select the image every time for every instance.

The file seems good to me, i don't know why. The file is attached, can you please check it?

 

Another question: what is the right sintax in the xml reference file to get a string like this,

<image href="File:///img/DSC_0005.JPG"></image>?

Now i'm using <image>DATA</image, but i have to modify the results manually to get the string above.

What is the right sintax to recall an image?

 

Thank you a lot!

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
LEGEND ,
Jan 28, 2025 Jan 28, 2025
quote

I'm sorry Robert, i'm here again with another issue:

I've edited another xml file, the image are imported, but indesign opens the window to select the image for every image istance. So, i have to select the image every time for every instance.

The file seems good to me, i don't know why. The file is attached, can you please check it?


By @LMR78

 

No idea why? You've had PNGs before? Now JPGs? Are you sure you've those JPGs there?

 

quote

Another question: what is the right sintax in the xml reference file to get a string like this,

<image href="File:///img/DSC_0005.JPG"></image>?

Now i'm using <image>DATA</image, but i have to modify the results manually to get the string above.

What is the right sintax to recall an image?


By @LMR78

 

Not sure what do you mean?

 

href="..." is an argument / parameter for InDesign's XML to place image.

 

<image>DATA</image> will be treated as a "text" with "DATA" as contents - as you've experienced before.

 

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
New Here ,
Jan 29, 2025 Jan 29, 2025

Yes i'm sure about the jpg.

The image import works, the strange thing is that indesign opens the window to select the image to import for every image. (attached a little video to show what happens)

 

About the second issue, i try to explain: the colums "Image" in the excel file contains all the paths like: href="File:///img/DSC_0005.JPG". This rapresent my data.

What is the right syntax to recall this data in the xml file using image tags??

 

Thank you Robert.

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
LEGEND ,
Jan 29, 2025 Jan 29, 2025

Was it working with PNG files? 

 

quote

[...] 

About the second issue, i try to explain: the colums "Image" in the excel file contains all the paths like: href="File:///img/DSC_0005.JPG". This rapresent my data.

What is the right syntax to recall this data in the xml file using image tags??


By @LMR78

 

I still don't understand what do you mean? "href" represents file path and InDesign should use it to import image - what do you mean by "right syntax to recall this data"? 

 

How exactly are you preparing your XML files? 

 

(most often I respond from my phone, so would be great if you could post screenshots instead of XML files - sometimes my phone do not open them so I can't see their contents) 

 

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
New Here ,
Jan 29, 2025 Jan 29, 2025

Yes, with png files no troubles. It happens only with jpg, really strange.

The situation is: i have to do a catalogue. I have an xcel with all the data, also images name.

About the image issue: i would like to know what i have to write in my xml, and what i have to write in the colum image of my xcel file to directly import the image in my indesign.

 

i use this xml to pilot the extraction from the xcel file.

LMR78_0-1738157407238.png

 

Then, this is the result with the data merged, as you can see the syntax of the image tag is not correct:

LMR78_1-1738157542771.png

 

Maybe i'm not running the right way to do this. Is the first time for me, i dont know.

Thank you.

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
New Here ,
Jan 29, 2025 Jan 29, 2025

Sorry, i have to say that the image import window appear also with the png format.

In the previous file this issue wasn't present. I don't know why.

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
LEGEND ,
Jan 29, 2025 Jan 29, 2025
quote

Sorry, i have to say that the image import window appear also with the png format.

In the previous file this issue wasn't present. I don't know why.


By @LMR78

 

Are your files located on the server or locally? 

 

Can you prepare a sample package - short XML file + PNGs and JPEGs? 

 

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
LEGEND ,
Jan 29, 2025 Jan 29, 2025

Can you try with JPEG instead of JPG extension? Or stick with PNG? 

 

Looks like you've a template that you fill with data from Excel, right? 

 

But here is the problem: 

 

1000028853.jpg

Your "Image" field from Excel - is placed in the wrong place - it should be directly after "<image" and before ">": 

 

<image Image></image>

 

Otherwise, is treated as a text contents of the XML tag - not an Attribute of this XML tag. 

 

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
New Here ,
Feb 02, 2025 Feb 02, 2025

Hello Robert,

sorry for the late reply.

quote

Can you try with JPEG instead of JPG extension? Or stick with PNG? 

 

Looks like you've a template that you fill with data from Excel, right? 

 

But here is the problem: 

 

1000028853.jpg

Your "Image" field from Excel - is placed in the wrong place - it should be directly after "<image" and before ">": 

 

<image Image></image>

 

Otherwise, is treated as a text contents of the XML tag - not an Attribute of this XML tag. 

 


By @Robert at ID-Tasker

No, my image files are located in a local folder.

"Can you try with JPEG instead of JPG extension? Or stick with PNG?"
I've tried, same problem. The issue happens also with png.

 

Looks like you've a template that you fill with data from Excel, right? 
That's right.

 

Your "Image" field from Excel - is placed in the wrong place - it should be directly after "<image" and before ">"...

This is what i was tring to ask to you, thanks! I will try following your precoius hints, i will come back soon.

Thanks a lot Robert!

 

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
LEGEND ,
Feb 03, 2025 Feb 03, 2025
LATEST

You're welcome and good luck. 

 

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