Skip to main content
Participant
April 30, 2024
Question

Need to remove unwanted XML hidden space elements

  • April 30, 2024
  • 1 reply
  • 294 views

Hi All,

 

This is the XML project. I need to compare the TOC and chapter headings. When we tried to compare, we have captured the paragraph contents using paragraph styles (  "chapterHeadings.push(currentParagraph.contents);"  ). 

 

It was captured the actual text with XML hidden space elements(before and after). Because of the hidden elements we couln't be able to compare the actual text. You can find the attached screenshots.

 

Could someone help me to clear the hidden space elements without untagging?

 

Thanks in Advance,

Ashrafali R

This topic has been closed for replies.

1 reply

Robert at ID-Tasker
Legend
April 30, 2024

Check what Unicode you'll get in the .contents and then use JS replace() to remove it.

 

Participant
May 2, 2024

Hi Robert,

 

Thanks for the details. But we are unable to findout the Unicode. Please let us know the unicode for that element or can we get anyother ways to remove?

 

Thanks in advance,

Ashrafali R

Robert at ID-Tasker
Legend
May 2, 2024

I'm not JS guy - but quick googling returned:

 

charCodeAt()