cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

ACL find_pi Instruction and end of document hit

ptc-3115379
1-Visitor

ACL find_pi Instruction and end of document hit

Hello , I have a small issue working with ACL and developing some app extension. Problem description: I need to go through a document and replace all Processing Instructions with a custom text extension. To locate the PI, I'm using the function find_pi. This works nice so far. The one problem is, that when find_pi hits the documents end, it sometimes asks the user if he wants to continue the search at the top of the document ( as no more pi's are found at the bottom ) . How can I disable this message ? Thanks for your help ! Greetings !
4 REPLIES 4

Try setting the "wrapscan" option to "off". If this succeeds in disabling the prompt (and the wrapping behavior), then you can use the option("wrapscan") function call at the start of your script to get the current value and save it to a variable so you can turn it off, then restore it before the end. -Brandon

Hi, well, tried it out. Setting wrapscan to off disables the previos message "go to start of document", but unfortunatly now gives me the (warning) message, that no elements have been found. And that brings me again to the problem of dealing with messages presented to the user. *douh* Isn't there maybe a way of catching the response of the call find_pi into a variable for a later evaluation ? Sometimes working with the epic extensions and ACL is a little confusing and not quite motivating . And I have a lot of other issues left to do... Thank you ! greetings, roland

Try this in your script: find::keep_silent(1) # ... find::keep_silent(0) Caveat: This is not exactly documented functionality, so there's probably not a lot of guarantee of it continuing to work from version to version (or that it will even work at all in the version you're using... don't know which that is). You may want to consider switching to a technique that uses the oid_*() functions provided by ACL, as they are meant for scripting, where the commands are more for direct use by human operators. You can probably find some tips on how to walk the document to find PIs in the libraries at adepters.org, or in the archives (10+ years of 'em, all searchable) of the Adepters list, which is hosted in the Forums section of ptcuser.org. -Brandon

Hello, Yup, that undocumented features solves my problem like a charm . The problem I was working on was about handling "invalid Processing instructions" , with the format like : <?text:moretext restofPI ?> . Epic version 5.2, what is used in the production environment at the company, can handle those PIs, and that seems to be a bug. those invalid PIs are produced by some sgml-processor in the line of document production. The occurring problem were with some Extension programmed in Java that we have created to apply some transformations on the created document: The Java Implementation crashes and takes epic down with an error somewhere in the w3c-dom implementation. So my task was to create a workaround for those invalid PIs, and my solution is to modify the PI-Conent before letting Java do its work. As I could not rely on a selection in a document, I chose to do this replacement step on the whole document until I hit a PI whose oid is smaller than the one from the last run as a break condition. And there I encountered the message "Hit document end". As I have found out in discussion with my colleagues, this workaround will be fine for now, as the newer versions of the epic editor do not have this invalid PI-bug, and newer versions of the mentioned sgml processors will not produce those invalid PIs. So for now it seems that version 5.2 will be used for quite a while, I don't have to care about the undocumented feature and be 'appy appy' as it works . Thanks alot for the URL to ptcuser.org, I will definitly take a look inside , even if I don't know how much I will have to work in future with epic extensions and ACL . Thank you for your help and Happy Easter ( or Happy Holidays, depends on your religious beliefs, if any . So much for the political correctness issue ) Greetings ! roland
Announcements

Top Tags