Copy link to clipboard
Copied
The string extracted from indesign xml element contains ^I(tab) space. I want to trim the ^I from the string. tried Chr(9),ChrW(9),vbTab. My input string is (^I^I^IFigure^S6.1^I). This is extracted from xml file imported in indesign.
From this:
Dim FigCapElm As InDesign.XMLElement = figureElement.XMLElements(2)
I can see that you have a reference to the whole XML and figureElement is just a reference to some "branch", right?
As per your screenshot - (Figure 6.1 Schematic of an oxy-fuel combustion process. Oxygen is produced ) - is an XMLElement - that is build from TWO sub XMLElements:
If you go to your text, put cursor before the "Figure" word, then keep pressing right arrow and pressing spa
...Copy link to clipboard
Copied
Hi @Aysha27550661f9sm, so you want to trim the string in VB?
Copy link to clipboard
Copied
Yes I want to remove the ^I from the string. Kindly help me
Copy link to clipboard
Copied
@Robert at ID-Tasker can you help here?
Copy link to clipboard
Copied
There might be some encoding or formatting issue with the tab characters in your XML file. In that case, it would be helpful to see a bit more context or the structure of your XML file.
Copy link to clipboard
Copied
<!--E--><FgN aid:cstyle="FgN">Figure 6.1</FgN>	<!--/E--> This is xml node value
Copy link to clipboard
Copied
<!--E--><FgN aid:cstyle="FgN">Figure 6.1</FgN>	<!--/E--> This is xml node value
By @Aysha27550661f9sm
But this isn't what you've shown in the opening post?
(^I^I^IFigure^S6.1^I)
By @Aysha27550661f9sm
Or at least not all of it.
I can't "locate" what "^I" is...
" " is of course "reguar" space
"	" is TABulator
But I can't see "^I" there...
And there are no "(" & ")" in the raw XML...
Can you upload more screenshots from your text - in the InDesign - with Hidden Characters Visible.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Figure 6.1 is read from indesign.xmlelement. But it came with ^I. sometimes it is ~I. My input xml is
<title aid:pstyle="FigCap-1"><!--E--><FgN aid:cstyle="FgN">Figure 6.1</FgN>	<!--/E-->Schematic</title></figure>
By @Aysha27550661f9sm
OK.
The XML you are quoting - is it "raw" XML BEFORE importing, right? You need to forget about RAW XML.
Your "^I" things are XML markers.
I've selected 3x Characters - Tab, XML marker, "1":
So your "^I" is rather "0xFEFF".
BUT YOU CAN'T change <FEFF> on itself!!
"20" is now BEFORE the marker.
So you need to work around those markers.
Copy link to clipboard
Copied
I'm able to read and show XML like a "flat" database:
Copy link to clipboard
Copied
can you please help me to handle this using vb.net code
Copy link to clipboard
Copied
can you please help me to handle this using vb.net code
By @Aysha27550661f9sm
Why are you doing it in VB.net and not in VisualBasic 6 - or VBA?
You need to show me your code.
Copy link to clipboard
Copied
I know VB.net only and also I have completed remaining functions in VB.net.
Copy link to clipboard
Copied
I know VB.net only and also I have completed remaining functions in VB.net.
By @Aysha27550661f9sm
OK, but if you want my help - you need to show me your code - at least the problematic part.
Copy link to clipboard
Copied
Dim FigCapElm As InDesign.XMLElement = figureElement.XMLElements(2)
Dim splitFigCap() As String = FigCapElm.Contents.ToString.Split(vbTab)
Dim FigName As String = ""
If splitFigCap.Length > 1 Then
If splitFigCap(0).ToString.ToLower.Contains("figure") Then
FigName = splitFigCap(0).Replace(vbCr, "").Replace("&", "").Trim
FigName = Regex.Replace(FigName, Chr(9), "")
FigName = Regex.Replace(FigName, ChrW(9), "")
FigName = FigName.Replace(vbTab, "")
FigName = FigName.Replace(Chr(9), "")
FigName = Regex.Replace(FigName, "\t", "")
FigName = FigName.Replace("\u0009", "")
FigName = Regex.Replace(FigName, "\^I", "")
FigName = Regex.Replace(FigName, "^", "")
FigName = FigName.Replace(" "c, "")
FigName = Regex.Replace(FigName, "\s+", "")
End If
End If
in the attached image figureElement.XMLElements(2) is (Figure 6.1 Schematic of an oxy-fuel combustion process. Oxygen is produced ). I have to read the Fignumber and matches the text within the frame or not. it is in (A simple block diagram representing the main components of oxy-combustion can be observed in Figure 6.1.). When I manually remove the ^I in find it finds the text. But i have to do this via code.
Hope u clear my issue. Kindly do the needful.
Copy link to clipboard
Copied
From this:
Dim FigCapElm As InDesign.XMLElement = figureElement.XMLElements(2)
I can see that you have a reference to the whole XML and figureElement is just a reference to some "branch", right?
As per your screenshot - (Figure 6.1 Schematic of an oxy-fuel combustion process. Oxygen is produced ) - is an XMLElement - that is build from TWO sub XMLElements:
If you go to your text, put cursor before the "Figure" word, then keep pressing right arrow and pressing space:
>,space,>,space,>,space,>...
you will see that those XML markers start separatting - right now, you have at least TWO XML markers on top of each other:
So, instead of trying to split "dirty" text contents of the figureElement - just get a reference to its 1st Child - the same way as you are getting FigCapElm - 2nd element of the figureElement - I don't code in VB.net so just guessing:
Dim RealFigureElement As String = FigCapElm.XMLElements(1).Contents.ToString
Copy link to clipboard
Copied
Yes It works. Thank You very much.
Copy link to clipboard
Copied
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more