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

XML double entermark merged xml tag affected

Participant ,
May 24, 2024 May 24, 2024

Copy link to clipboard

Copied

Dear Team,

 

When I used this grep command see below the screenshot, two enter marks It will combine into a single enter mark. In this case, the XML tag was removed. Please see the screenshot for your reference.

----------------------------------

1. After Figure moved to the top of the page:

kanagakumar_5-1716617953745.png

----------------------------------

2. One empty entermark created with xml tag:

 

 kanagakumar_0-1716616907932.png

----------------------------------

3. Please see the story board xml tag (empty entermark is "artgroup" xml tag)

 

 kanagakumar_1-1716617023721.png

----------------------------------

4. When i used this grep command, it was merged the entermark but xml tag was removed:

kanagakumar_4-1716617263953.png

 

5. The second entermark artgroup xml tag was removed, it is affect in xml structure.

 

kanagakumar_3-1716617166235.png

----------------------------------

 

My requirement is:

It is necessary to merge two entermarks into one, without affecting the XML structure. Now i manually merged the entermark.

 

kanagakumar_6-1716618372752.png

 

If possible, please provide your solutions or suggestions. It is very helpful for us.

 

Thanks

kk

 

 

 

TOPICS
Scripting

Views

177

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

correct answers 1 Correct answer

Community Expert , May 28, 2024 May 28, 2024

Hi @kanagakumar ,

without looking deeper into details here, you could try to remove one of the two characters and not set a new one.

Your GREP could be rewritten with a positive lookbehind or a positive lookahead, depending if the first or the second character of two should be removed.

 

Either remove an end of paragraph character that precedes an end of paragraph character:

 

\r(?=\r)

 

Or do it the other way and remove an end of paragraph character that comes after another end of paragraph cha

...

Votes

Translate

Translate
Participant ,
May 26, 2024 May 26, 2024

Copy link to clipboard

Copied

Dear Team,

 

I found one script in chartGPT but this coding was not run in the indesign, please advise

 

my xml tag name is "artgroup"

----------------------------

var doc = app.activeDocument;
var xmlElements = doc.xmlElements;

// Function to search for a specific tag name
function findXMLTags(tagName) {
var results = [];
for (var i = 0; i < xmlElements.length; i++) {
searchTag(xmlElements[i], tagName, results);
}
return results;
}

// Recursive function to search through XML elements
function searchTag(xmlElement, tagName, results) {
if (xmlElement.markupTag.name === tagName) {
results.push(xmlElement);
}
for (var i = 0; i < xmlElement.xmlElements.length; i++) {
searchTag(xmlElement.xmlElements[i], tagName, results);
}
}

// Example usage: Find all <title> tags
var titleTags = findXMLTags("artgroup");
for (var i = 0; i < titleTags.length; i++) {
$.writeln(titleTags[i].contents); // Print the contents of each <title> tag
}

----------------------------

Thanks

kk

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
Community Expert ,
May 28, 2024 May 28, 2024

Copy link to clipboard

Copied

Hi @kanagakumar ,

without looking deeper into details here, you could try to remove one of the two characters and not set a new one.

Your GREP could be rewritten with a positive lookbehind or a positive lookahead, depending if the first or the second character of two should be removed.

 

Either remove an end of paragraph character that precedes an end of paragraph character:

 

\r(?=\r)

 

Or do it the other way and remove an end of paragraph character that comes after another end of paragraph character:

 

(?<=\r)\r

 

In both cases leave the Change to field empty.

 

However, without any sample document, I cannot be sure, that one of my suggestions would work for you.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

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
Participant ,
May 28, 2024 May 28, 2024

Copy link to clipboard

Copied

LATEST

Dear Uwe Laubender,

 

Yes, This is a "Great" comment. It works perfectly and has no impact on XML coding.

 

Thanks a lot "Uwe Laubender".

 

KK

 

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