XQuery contains function failing due to carriage return in XML
I am trying to perform the following xquery:
declare namespace tei="http://www.tei-c.org/ns/1.0";
for $line in //tei:l
where some $value in $line
satisfies (contains($value, "A cherdd, myn Siat"))
return $line
this works fine for almost all cases except when al 'l' element contains a carriage return half way through it, e.g.
<l n="15">A cherdd, myn Siat, yn
batent</l>
if I try to run the xquery above again to find the whole contents of the 'l' element it fails due to the carriage return
declare namespace tei="http://www.tei-c.org/ns/1.0";
for $line in //tei:l
where some $value in $line
satisfies (contains($value, "A cherdd, myn Siat, yn batent"))
return $line
I've been reading all the usual guides/sites and it seems that it might be possible to mitigate the effects of the 'carriage return' by the use of indexes. What I would really like to do however is to remove all the carriage returns. Does anyone know if it is possible to issue a command to dbxml to do this or should I just continue to investigate indexes?
thanks in advance
Edited by: user534203 on 27-Jul-2012 02:05
I have found a solution to my problem.
Basically, the problem was that my XML editor, Oxygen, has a 'pretty print' formatting command which cause windows line breaks to be introduced when XML lines get too long to make things easier to read.
I was saving the files with these line breaks included. Instead I should have been saving the files using the Document>Source>Join and Normalize menu option (Ctrl J). This removes all of the offending line breaks and solves the search problem within the db.
Hope this helps someone out there.
:)
Similar Messages
-
Add carriage return in XML file
Hi,
I found a topic that correspond to my requirement :
[Add carriage return in XML file|https://wiki.sdn.sap.com/wiki/display/XI/HowtoappendCarriageReturnintheendofeachtagofxml+file]
But i don't know where created this udf, which input parameter pass?
Thank you for your help.Hi Frantzy,
The link does not give enough explanation. What I am assuming is if you have xml string in one field then if you need to add new line after each tag then you can follow that.
If you want a udf where you want to insert a new line use this udf:
Create a Value UDF with one input argument 'a' and name the udf as addnewline. Then add this code:
Imports: java.*;
String lines;
lines = "";
lines = lines.concat(a + '\n' );
return lines;
Then where ever you want a new line just add this udf in your mapping. If you want a new line for 10 fields then you can put in all the 10 fields.
Example:
Source field --> logic --> udf (addnewline) --> target.
So after logic if you have the value as 123 then in the target you will see 123 followed by a carriage return.
Regards,
---Satish -
New line character and carriage return in XML, please help, thanks
In XML, " " is only the new line character. I have tried that. If you put that in your XML, for example:
<tag>line1 line2 line3</tag>
You will get the output as follow:
line1
____line2
________line3
(where ___ represents space)
The output that I want is actually like:
line1
line2
line3
So I would like to ask how I can do this.
Thanks,
Jackiewhile parsing your XML file you can directly suppress these newline and similar things in characters() method of SAX parser.
you can opt to do nothing when you encounter them else if it is normal character then use it to print it. -
Problem with "carriage Return" or "Line Feed" in a table
Hello,
I need help with the function Zeichen(), so called it in german, I'm not sure if it is char() in english.
In Pages Version 4.0.1 (746) I've created a table in Pages with this function to make an "carriage Return" in a cell.
Here an example: { ="Hello" & Zeichen(10) & "World" }, in the cell is now:
| Hello |
| World |
But in Pages Version 4.0.3 (766) this function ZEICHEN() not allow the number 10 and other till 32 (I allready read the manual and understand this problem).
Anybody an idea to make a "Carriage Return" or "Line feed" in a formular, in a cell, in a table, in Pages?
Thanks
Detlev Kormannkdetlev wrote:
Your workaround will not be possible in my table, because there is no empty cell in the table, but I think it is also a good help too.
*In fact I forgot that you are using a table in Pages.*
Remaining on my first idea, In Numbers we may achieve the same goal using an auxiliary table with a single cell containing the needed line break.
If this table is named "LineBreak",
the formula will be:
="Hello"&LineBreak :: $A$1&"World"
*In Pages, here is my workaround:*
Enter the cell
type a§b
don't type the character § but ctrl + return.
The cell will contain
a
b
with the arrow, move before the a
type =B2&"
delete the original a
move to the right
delete the original b
type "&C7
Yvan KOENIG (VALLAURIS, France) mercredi 7 octobre 2009 17:20:04 -
Remove carriage returns from a field in an oracle table
I have a field that is defined as a LONG in my oracle table; the data contained in this field has carriage returns/line feeds (it's free form text); as i'm selecting data from this field, i need the carriage returns removed so that the data from this field all appears on one line.
I tried using the TRANSLATE function to convert the carriage returns to something else, but that doesn't work.
Example:
Select comment from Notes:
COMMENT
the applicant called for an appointment;
an exam was scheduled for 4/1/05 at 9am;
called applicant to confirm app
this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled for 4/1/05 at 9am; called applicant to confirm app"
How can i do this? Can the decode function be used to remove the carriage returns in this field?when i used translate its giving correctly,
SQL> ed
Wrote file afiedt.buf
1 select translate('the applicant called for an appointment;
2 an exam was scheduled for 4/1/05 at 9am;
3 called applicant to confirm app
4 this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled
5 How can i do this? Can the decode function be used to remove the carriage returns in this field
6* ',' ') from dual
SQL> /
TRANSLATE('THEAPPLICANTCALLEDFORANAPPOINTMENT;ANEXAMWASSCHEDULEDFOR4/1/05AT9AM;CALLEDAPPLICANTTOCONF
the applicant called for an appointment; an exam was scheduled for 4/1/05 at 9am; called applicant t
SQL> ed
Wrote file afiedt.buf
1 select 'the applicant called for an appointment;
2 an exam was scheduled for 4/1/05 at 9am;
3 called applicant to confirm app
4 this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled
5* How can i do this? Can the decode function be used to remove the carriage returns in this field
SQL> /
'THEAPPLICANTCALLEDFORANAPPOINTMENT;ANEXAMWASSCHEDULEDFOR4/1/05AT9AM;CALLEDAPPLICANTTOCONFIRMAPPTHIS
the applicant called for an appointment;
an exam was scheduled for 4/1/05 at 9am;
called applicant to confirm app
this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled for 4
How can i do this? Can the decode function be used to remove the carriage returns in this field?
SQL> -
Removing the carriage return / Tab during data extraction
Hi ,
I have an issue with removing the carriage return / Tab from the extracted (Flat File) data from SAP EKPO table.
1) While uploading(Long Back) the Legacy data to SAP tables the carriage returns and Tabs in Product description were uploaded to SAP tables.
2) Now I am extracting data from bkpf,..EKPO.. tables to a flat file .
3) When I extract the data i. PO number, Product description,......
The Product description is going to 3 to 5 lines depending on the carriage returns and Tabs in the Product description. Ekpo-txz01
Ex : Mfg # DS104NA / NET######GEAR DS104 Hub######model
I want this product description in one continuous line. It is possible only by removing the Carriage returns and tabs from product description before concatenating and TRANSFERING the file to Server.
4) What is getting: The line is breaking @gear @ Hub due to Carriage return/Tab
Mfg D NET
GEAR DS104 Hub
model .
5) What is required is: in one line
Mfg D NETGEAR DS104 model
In the process I am extracting product description from Ekpo-txz01 . So it is internal table. Now I want to remove the carriage return / Tab .
How these can be removed.
Thanks,
VasuDear Vasu,
Sometimes there is a problem that cannot be solved normally. This is one of them.
The reason why the mentioned methods do not work is because you need to remove actually two characters CR and LF in one stroke. You can identify one but then not the other. So approach it from the other side.
Simply define what your correct characters might be AND only use them to export.
Below you will find a FORM routine that does just that (only passes defined valid characters and NOT others).
FORM validate_field USING VALUE(field_in)
CHANGING field_out.
CONSTANTS:
All low caps characters
validlow(26) TYPE c VALUE 'abcdefghijklmnopqrstuvwxyz',
All upper caps characters and all figures
validhigh(36) TYPE c VALUE '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',
All other characters (starting with space)
validrest(32) TYPE c VALUE ' <,>.?/:;"{[}]|\~`!@#$%^&*()_-+=',
Single quote
validquote VALUE ''''.
DATA:
pos(1) TYPE c, " Container to hold 1 character
l TYPE i, " Length
i TYPE i. " Indexer
Determine length
l = STRLEN( field_in ).
Stripping loop
WHILE i LT l.
Get one character
pos = field_in+i(1).
Check its validity
IF pos CO validlow
OR pos CO validhigh
OR pos CO validrest
OR pos EQ validquote.
When valid, use it
concatenate field_out
pos
into field_out.
ENDIF.
ENDWHILE.
ENDFORM.
Hopes this helps solving your problem.
Regards,
Rob. -
Converting carriage return in HTML spool
I've written an sql for spooling the result of a Select in HTML format by using "set markup html on spool on head".
The problem is that when I open the HTML file I no longer find the carriage returns. I mean the carriage returns that were in CLOB field of the table now miss. Could you help me?
This is the script:
set pagesize 10000
set scan off
set markup html on spool on head ' - '
column text heading "TEXT"
spool c:\temp\report.html
select dbms_lob.substr (t.field, 5000, 1) text
from table t;
spool off;
exit;
The "field" contains a long text with carriage returns that aren't in the report.html anymoreuser12180597 wrote:
I've written an sql for spooling the result of a Select in HTML format by using "set markup html on spool on head".
The problem is that when I open the HTML file I no longer find the carriage returns. I mean the carriage returns that were in CLOB field of the table now miss. Could you help me?
This is the script:
set pagesize 10000
set scan off
set markup html on spool on head ' - '
column text heading "TEXT"
spool c:\temp\report.html
select dbms_lob.substr (t.field, 5000, 1) text
from table t;
spool off;
exit;
The "field" contains a long text with carriage returns that aren't in the report.html anymoreset preformat to ON:
set markup html on spool on head ' - ' PRE ON -
IgnoreWhite doesn't strip carriage returns?
I have read in many resources that ignoreWhite gets rid of
all carriage returns. Yet, when I run this simple example, I see a
visible carriage return (2 in fact) in the output panel. What is
going on here?
XML:
<?xml version="1.0" encoding="UTF-8"?>
<portfolio>
<section sectionName="signature">
<content filename="filename.swf" caption="hello">
This is the text that goes in here.
</content>
</section>
</portfolio>
ActionScript:
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function (success:Boolean):Void {
if (success) {
trace(this);
else {
trace("Error loading XML file");
myXML.load("portfolio.xml");
Here is a screen shot of the output panel:
http://www.thinkseed.com/test/ignoreWhite_output.gifTwo things seem to solve this problem:
Adding a CDATA tag to the XML file:
<?xml version="1.0" encoding="UTF-8"?>
<portfolio>
<section sectionName="signature">
<content filename="filename.swf" caption="hello">
<![CDATA[This is the text that goes in here.]]>
</content>
</section>
</portfolio>
Or just simply getting rid of the carriage returns:
<?xml version="1.0" encoding="UTF-8"?>
<portfolio>
<section sectionName="signature">
<content filename="filename.swf" caption="hello">This
is the text that goes in here.</content>
</section>
</portfolio> -
Carriage returns causes enclosed VBScript to run and fail to complete
I am finding a weird problem.
I have my autosequence file working perfectly without any errors but the same VBscript file when enclosed runs and fails to complete I am unable to figure what is wrong.
I am using �vbCRLF� to read/write from INI files into the script files. Other than this I dont use any cariage returns. When Iopen my Script files in other editors like Notepad etc, I am able to find a small square kind of a character. Is there some unseen Carriage Returns (CRs) or Line Feeds (LFs) or some combination due to which I am facing this.
(I am using DIAdem 9)
Can anyone please help me out with this immediately.
Thanks in advance,
Wating for your quick response.Hello, I'm searching through the Diadem Forum and I didn't find something that I could use.
I have to exchange text information between to programs (DIAdem and CatmanProfessional).
My initial idea is to create INI file to acomplish this. Catman has a function to read or write quite easily describing the SECTIONS and KEYS of this INI file.
However I can't see something on Diadem Script. It onlys read or write Text files... And then I must extract the key values cutting and finding one by one.
I saw that Labview has an open VI to treat this, is there nothing similar for DIAdem? -
Due to my laptop screen failing I have to return it to factory settings, can I reinstall adobe reader and air afterwards?
I don't see why not. Do you foresee a special difficulty?
-
Document control failed due to error in [DOCMGR-CANCEL] with a return code
i am getting this error while calceling the purchase order "Document control failed due to error in [DOCMGR-CANCEL] with a return code of [OTHER]. "
I am doing the calcel like this
Nav: buyer work centre --> order
searche the po and then
select order --> cancel then click GO button
i gave the Reason as Cancel
communication method: email
Cancel Requisition: Yes
Please help on this, its urgent.
Thanks,
Vijay.Hi Vijay,
Check this MOS note.
Cancelling A Standard Purchase Order In Buyer Work Center Results In Error [Docmgr-Cancel] With A Return Code [ID 1338826.1]
Thanks
-Arif. -
JeditorPane text selection problem due to line feeds and carriage returns
Hi folks,
I have a jEditorPane (text/plain) that contains a document in which the user has highlighted some text. I want to pull the selected text from the pane, do some processing on it, and then put the altered text back in the same position.
First I get the starting and ending position of the highlighted text
int mySelStart = myJEditorPane.getSelectionStart();
int mySelEnd = myJEditorPane.getSelectionEnd();Then I get all the text from the pane and (in theory) strip out the portion the user highlighted
String myPaneText = myJEditorPane.getText();
String mySelectedText = myPaneText.substring(mySelStart,mySelEnd);But the text string in mySelectedText never matches what the user originally highlighted. The starting and ending positions are off by the number of carriage returns that proceed the highlighted text in the document. It appears that while in the jEditorPane Java treats the carriage return as one characters, but once the info is in the myPaneText field Java treats the carriage return as two characters.
Has anyone encountered this before? Am I doing something wrong? To fix the problem I'm looping through the entire document to find out how many carriage returns proceed the highlighted text, but there has to be an easier way.
ThanksIt appears that while in the jEditorPane Java treats the carriage return as one
characters, but once the info is in the myPaneText field Java treats the carriage
return as two characters.Correct on a Windows platform. Check out my posting here for a one line solution:
http://forum.java.sun.com/thread.jspa?forumID=31&messageID=1464594 -
Hi,
When i tried using the cancel PO API, it resulted in the following error.
Document control failed due to error in [DOCMGR-CANCEL], return code = [OTHER]
I searched the metalink and found out that it was a bug as p_doc_num variable was a number and in PO_HEADERS_ALL segment1 is VARCHAR2. But now the bug is fixed.
I tried both ways, with and without quotes but it is still giving this error. Please suggest.
I used the API in the following way.
DECLARE
l_return_status VARCHAR2(1);
BEGIN
fnd_global.apps_initialize(4480,20707,201);
--call the Cancel API
PO_Document_Control_PUB.control_document (
p_api_version=>1.0, -- p_api_version
p_init_msg_list=>FND_API.G_TRUE, -- p_init_msg_list
p_commit=>FND_API.G_TRUE, -- p_commit
x_return_status=>l_return_status,-- x_return_status
p_doc_type=>'PO', -- p_doc_type
p_doc_subtype=>'STANDARD', -- p_doc_subtype
p_doc_id=>34, -- p_doc_id
p_doc_num=>null, -- p_doc_num
p_release_id=>null, -- p_release_id
p_release_num=>null, -- p_release_num
p_doc_line_id=>null, -- p_doc_line_id
p_doc_line_num=>null, -- p_doc_line_num
p_doc_line_loc_id=>null, -- p_doc_line_loc_id
p_doc_shipment_num=>null, -- p_doc_shipment_num
p_action=>'CANCEL', -- p_action
p_action_date=>SYSDATE, -- p_action_date
p_cancel_reason=>null, -- p_cancel_reason
p_cancel_reqs_flag=>'N', -- p_cancel_reqs_flag
p_print_flag=>null, -- p_print_flag
p_note_to_vendor=>null ); -- p_note_to_vendor
commit;
-- Get any messages returned by the Cancel API
FOR i IN 1..FND_MSG_PUB.count_msg
LOOP
DBMS_OUTPUT.put_line(FND_MSG_PUB.Get(p_msg_index => i,
p_encoded => 'F'));
END LOOP;
END;
/first you have to assign org_id to the program,like fnd_client_info.set_org_context('167');
you also have to initialize,like this
fnd_global.initialize(session_id => l_session_id
,user_id => 2613
,resp_id => 50459
,resp_appl_id => 201
,security_group_id => 0
,site_id => -1
,login_id => 1102144
, --can't be -1,or else will be wrong
conc_login_id => 1102144
,prog_appl_id => -1
,conc_program_id => -1
,conc_request_id => -1
,conc_priority_request => NULL); -
Why returning string from java stored function failed ?
I created java stored function: it's doing http post, parsing xml from http reply, and returning string result.
Sometimes, it doesn't return any value. What can be a reason ?
The high level procedure, has following form:
class SBE {
public static String call(String arg0) {
SBE sbe=new SBE("d:\\oracle\\ora81\\network\\log\\SBE.log");
String result=SBEParser.go(sbe.sendRequest(arg0, ""), sbe.logger);
sbe.logger.log(result);
sbe.logger.log("Finish SBE intetraction");
return result;
PLSQL wrapper has a simple form:
create or replace package PG_SBE as
function CALL(arg0 in varchar2) return varchar2;
end;
create or replace package body PG_SBE as
function CALL(arg0 varchar2) return varchar2 as language java name 'SBE.call(java.lang.String) return java.lang.String';
end;
In log file ("d:\\oracle\\ora81\\network\\log\\SBE.log"), I can find message :
"Finish SBE intetraction"
but query:
select pg_sbe.call("any argument") from dual;
doesn't finish.
What can be a reason ? What can I do to trace stage of convertion java string to varchar ?
Please help me...
MarekThis comes up periodically. It just isn't possible using that type of approach. Probably the best you could do is the create an ADT (containing collections) and use that to pass a 'batch' of information.
Hopefully this will get addressed in the next release of the database. -
Adf mobile - Deployment failed due to one or more errors returned by 'osascript'
I had the mac jdeveoper deploying a mobile app in ios emulator file running fine.
I had to update the xcode to xcode5 to get the certificate - now the deployment to emulator won't work.
These are the error messages
[02:34:41 PM] Command-line execution succeeded.
[02:34:41 PM] Command-line executed: [osascript, -e, tell application "iPhone Simulator" to activate]
[02:34:41 PM] Command-line execution failed (Return code: 1)
[02:34:41 PM] Deployment cancelled.
[02:34:41 PM] ---- Deployment incomplete ----.
[02:34:41 PM] Failed deploying to the iOS simulator.
[02:34:41 PM] Deployment failed due to one or more errors returned by 'osascript'. The following is a summary of the returned error(s):
Command-line execution failed (Return code: 1)I deleted xcode 5 and installed xcode 4.6.3. Simulator works ok for 6.1 simulator target version.
In jdeveloper ios option only 6.1 shows up for simulator target version?
How do I get the 7 to show up there please?
If simulator will not show up - can I still deploy / test it in iphone with ios7?
Maybe you are looking for
-
I remember on other editing softwares using zooming and a sort of "sweeping" from left ro right etc. over photos. Is that possible with this program? Also, how do you pre-set how long the photos are going to be (this is for a different purpose, but t
-
I need to update my software to OS X 10.6.8 but my software update keep on showing that there is nothing to be update, my iMac is currently OS X 10.5.8. What do I need to do?
-
I am waiting on my new Mac Pro, and I have a question about the memory. I am going to install 4gb in addition to the 2gb that comes installed. I am ordering 2x2gb sticks from OWC. I am little confused on the which riser to put it on.. Should it go on
-
Wireless Mighty Mouse loses Bluetooth Connection
Our new iMac arrived today and works fine except for the wireless mouse which loses the Bluetooth connection frequently, especially when the mouse is "Turned off" and then turned back on (every time?). Has Apple acknowledged this problem? It appears
-
Problems with context in JAXB and ActiveX bridge
Hello! I'm using Java ActiveX Bridge for accesing from Navision to a digital invoice API developed by spanish Industry, Commerce and Tourism Department. I successfully executed the invoice creation process from a standalone java application. However,