Hi,
I am tried to extracting content between hidden special words. But while extracting some content I am facing below error,
java.lang.ClassCastException: com.aspose.words.BookmarkEnd cannot be cast to com.aspose.words.CompositeNode
at Main.extractContent(Main.java:162)
at Main.getHtmlContentFromBookMark(Main.java:97)
at Main.SaveInItem(Main.java:64)
at Main.main(Main.java:50)
and extracting half of the content. I am attaching the sample code sample.zip (5.9 KB)
and input file input.docx (20.5 KB)
@Gptrnt You consider that every direct child of a body is a CompositeNode but in your document there is also a BookmarkEnd node on the same level. You should update your code to handle this case. For example you could cast to CompositeNode only when calling processMarker() and add an extra check:
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.