How to add prefixes to xml output?
Does anyone know a quick and easy way to add a namespace prefix to an xml document when you output it as a string?
i'm looking for somethinglike this.
<Order xmlns="http://www.something.com/name">
<item>sink</item>
<Order>
converted into
<dof:Order xmlns:dof="http://www.something.com/name">
<dof:item>sink</dof:item>
<dof:Order>
I have attempted to use the xmlText method on the XmlObject class passing in an XmlOptions object with setSaveSuggestedPrefixes() set to my hsahmap with the namespace and prefix, however nothing happens. Well, sometimes it works and other times it does not.
It seems that it works when i programatically build my xml using XmlObject methods, but it fails when i parse an existing xml string into the XmlObject using parse(String).
Any help would be appreciated. I can't find any detailed help anywhere.
Thanks
Jeremy
You can achieve your requirement using XSLT maaping on XML. Read more about XSLT mapping. Also read more about WordML processing tool by Microsoft.
Similar Messages
-
How to add prefix zero to all matnr fields in itab
Hi,
I ve a internal table with following fields
Matnr bwkey
6 678
67 rty
678 78k
How to add prefix zero to all tha matnr fields.
like
matnr bwkey
00000000000000006 678
00000000000000067 rty
00000000000000678 78k
Thanks in advanceHi,
commonly used conversion routine is ALPHA.
It is conversion used to insert leading zero for document number.
For example, in sales order (VBAK-VBELN length 10),
when we key in order no, for example we key in '4302',
conversion routine input will automatically add leading zero,
so it will become '0000004302', this is real value stored in table VBAK.
On conversion routine output, it will delete leading zero
function CONVERSION_EXIT_ALPHA_INPUT, this will add leading zeros to a character based field of any length.
Ex:
data: lv_c(10) type c value '123'.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = lv_c
importing
output = lv_c.
write:/ lv_c.
Regards. -
How to add prefix to standard PO sequence.
Hi all,
Requirement is how to add prefix to Purchase order number auto generated sequence.The only options you have for po numbering is automatic and manual.
What you are looking for is not available out of the box.
You can always write a customization to achieve it.
Here are couple of options for the customization. You will have to explore them a little bit to identify any pitfalls.
1) A before-insert trigger on po_headers_all that appends the suffix to the PO#
2) A when-new-record-instance personalization to generate the new PO# with suffix.
Hope this helps
Sandeep Gandhi
Independent Consultant -
Hi Experts,
How to add additional field into output table VENDORS/WH TAX TYPES AND CODES in RFIDYYWT(Generic Withholding Tax Reporting).
I have no idea how to start with, please give some advice.
Thanks!
IceDear Ice,
Use Append structure, see given link:
https://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eb61446011d189700000e8322d00/content.htm
Regards,
Abbas. -
Dear Gurus,
I am working on a scenario where vendor master is triggered from SAP-XI--FTP.
when i am posting the vendor master on FTP.. i am getting
the xml output with prefix as below
<ns0:VENDORID>0000100000</ns0:VENDORID>at each element in vendor master xml file.
Instead of <VENDORID>0000100000</VENDORID>
could anyone tell how to fix this prefix at each level.
Does i need to add any module in file receiver adapter..or any patch i need to apply ..
we are on SP9 PI 7.0
Kind Regards,
VijayHi,
I tryed as per blog earlier ..it is not working
i am using file receiver adapter...any other solution to fix this.
Regards,
Vijay -
How to add new fileds in Output :
Hi I have copied COOISPI Transaction (Program PPIO_ENTRY) into a new transactiopn.
I have restricted the selection criterial to particular fields.
Now i need to add extra fields to the output.The output screen it self it is a standard program.The program name is SAPLCOISDISP.Please guide me how to add extra fields to this output screen.Hi Vinay,
You have made the Z Copy of the program. Now you can make the Z Copy yof the screen, where you can add your field. And also change the screen no to your Z screen no.
Hope this resolves your query.
Regards,
Manish -
How to generate the following XML-Output?
Hi all,
I would like to generate the following XML-Output without defining any types or tables:
<?xml version = '1.0'?>
<DEPARTMENTS_EMPLOYEES>
<DEPARTMENT NAME="ACCOUNTING">
<DEPTNO>10</DEPTNO>
<LOC>NEW YORK</LOC>
<EMPLOYEES_OF_DEPARTMENT>
<EMPNO>...</EMPNO>
<ENAME>...</ENAME>
</EMPLOYEES_OF_DEPARTMENT>
</DEPARTMENT>
<DEPARTMENT NAME="RESEARCH">
<DEPTNO>20</DEPTNO>
<LOC>DALLAS</LOC>
<EMPLOYEES_OF_DEPARTMENT>
</EMPLOYEES_OF_DEPARTMENT>
</DEPARTMENT>
</DEPARTMENTS_EMPLOYEES>
Unfortunately the following SQL-Statement does not working:
select xmlElement("DEPARTMENTS_EMPLOYEES",
xmlAttributes(d.deptno as "DEPTNO"),
xmlElement("DNAME", d.dname),
xmlElement("LOC", d.loc),
xmlElement("EMPLOYEES_OF_DEPARTMENT",
(select xmlAgg(xmlElement("EMPLOYEE", xmlAttributes(e.empno as "EMPNO"), xmlForest(e.ename as "ENAME", e.job as "JOB", e.hiredate as "HIREDATE", e.sal as "SAL", e.comm as "COMM", m.empno as "MGRNO", m.ename as "MGRNAME" ) )
from emp e, emp m
where e.deptno = d.deptno
and m.empno = e.mgr
) as XML
from dept d;
1. When I provide this statement with SQL*Plus
(unfortunately 9.0.1.3.0) then I get the
following output:
XML()
XMLTYPE()
XMLTYPE()
XMLTYPE()
XMLTYPE()
2. When I provide this statement with SQL Navigator
4.3.0.456 then I get the following error:
[1]: (Error): OCI-21560: argument 3 is null, invalid,
or out of range
3. When I execute the following PL/SQL-Code then I get
the XML-Error message:
DECLARE
x CLOB;
xmlstr VARCHAR2(32767);
line VARCHAR2(2000);
BEGIN
x := dbms_xmlquery.getxml('select xmlElement("DEPARTMENT",
xmlAttributes(d.deptno as "DEPTNO"),
xmlElement("DNAME", d.dname),
xmlElement("LOC", d.loc),
xmlElement("EMPLOYEELIST",
(select xmlAgg(xmlElement("EMPLOYEE",
xmlAttributes(e.empno as "EMPNO"),
xmlForest(e.ename as "ENAME",
e.job as "JOB",
e.hiredate as "HIREDATE",
e.sal as "SAL",
e.comm as "COMM",
m.empno as "MGRNO",
m.ename as "MGRNAME"
from emp e, emp m
where e.deptno = d.deptno
and m.empno = e.mgr
) as XML
from dept d');
xmlstr := dbms_lob.SUBSTR(x,32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
DBMS_OUTPUT.PUT_LINE(line);
xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
END LOOP;
END;
<?xml version = '1.0'?>
<ERROR>oracle.xml.sql.OracleXMLSQLException: Unimplemented Feature</ERROR>
4. When I provide the following PL/SQL-Code then I get the same xml-error:
DECLARE
x CLOB;
xmlstr VARCHAR2(32767);
line VARCHAR2(2000);
BEGIN
x := dbms_xmlquery.getxml('select xmlElement("SYSDATE", xmlElement("Datum", to_char(sysdate,''DD.MM.YYYY'')),
xmlElement("Zeit", to_char(sysdate,''HH24:MI:SS''))) as XML
from dual');
xmlstr := dbms_lob.SUBSTR(x,32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
DBMS_OUTPUT.PUT_LINE(line);
xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
END LOOP;
END;
<?xml version = '1.0'?>
<ERROR>oracle.xml.sql.OracleXMLSQLException: Unimplemented Feature</ERROR>
Can I generate the needed XML-Output from Database with SQL or PL/SQL?
Can anybody help me?
Regards
Leonid PavlovI have this done with:
DECLARE
qryCtx DBMS_XMLGEN.ctxHandle;
result CLOB;
xmlstr VARCHAR2(32767);
line VARCHAR2(2000);
BEGIN
qryCtx := dbms_xmlquery.newContext('select deptno, dname, loc, cursor(select e.empno, e.ename, e.job,
to_char(e.hiredate,''DD.MM.YYYY'') hiredate, e.sal, e.comm,
m.empno MGRNO, m.ename MGRNAME
from emp e, emp m
where e.deptno = dept.deptno
and m.empno(+) = e.mgr) emp
from dept');
dbms_xmlquery.useNullAttributeIndicator(qryCtx, FALSE);
dbms_xmlquery.setRowsetTag(qryCtx, 'DEPARTMENTS_EMPLOYEES');
dbms_xmlquery.setrowtag(qryCtx, 'DEPARTMENT');
DBMS_XMLQuery.setRowIdAttrName(qryCtx, 'ID');
DBMS_XMLQuery.setRowIdAttrValue(qryCtx, 'DEPTNO');
-- dbms_xmlquery.setrowidattrname(qryCtx, NULL);
result := dbms_xmlquery.getXML(qryCtx);
DBMS_XMLQuery.closeContext(qryCtx);
xmlstr := dbms_lob.SUBSTR(result,32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
DBMS_OUTPUT.PUT_LINE(line);
xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
END LOOP;
END;
But how can I rename the <EMP>-Element to Employees? -
How to generate PDF from XML output without XML publisher
Hi,
I am facing a problem while splitting the rdf generated XML output.
Problem Description:
I have a oracle invoice report which runs once every day (scheduled program). This report fetches me the invoices generated on that day and needs to be Mailed / Faxed to the customers.
So i developed the report in such a way that it generates the output order by customers...since the output generated will be as one .out file in APPLCSF/out directory...the .out file needs to be splitted by customers, for which i have written a cursor which takes the data of the main query and submits that many requests as many as customers are there.....There is a possibility of having 1000 customers per day also. If that is the case then my main program will fire that many requests.
Is there a different approach......any inputs are highly appreciated.
Also, i am generating the output in XML format. Is there a way from which i can directly generate a PDF from that XML output rather using any other tool.
Thanks & Regards,
Lakshmi Kalyan Vara Prasad.Hi,
with Reports Bursting and the defined "distributions" it's possible to have one report splittet to several parts with different receipients. Have a look at http://download-uk.oracle.com/docs/cd/B14504_01/dl/bi/B13673_01/pbr_dist.htm.
With xsl-fo it's possible to create pdf out of xml ... that's what xml publisher is doing.
Regards
Rainer -
Hi ALL
I want to add new fields on seeded EBS page to store their values in hr_api_transaction table whoch contain information of other fields on that page which are seeded
but that table has one column which stores xml file and that xml file has all information about that page's fields
how can I store my custom fields values in that xml file ?Hi,
As Andy said, add data to an xml file is overwriting, if you mean append data to xml file, please look this article:
http://codesamplez.com/programming/linq-to-xml-tutorial, Since this issue is more related to ASP.net, you could also ask this issue in asp.net forum:
http://forums.asp.net/
Best Regards,
Jambor
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to add line breaks to output fixed width flat file
0
I need to create a Flat file without column headers, no comma separated values but each column will have a fixed starting position and a fixed length in the text file. For example, below is the text file to be created with six columns
Column1 Column2 Column3 Column4 Column5 Column6
abc 1 New emp xxxx xxxx
xxx
Fixed starting position and a fixed lenth values for these columns as are below;
Column1 : Starting Position -1, Fixed Length -4
Column2 : Starting Position - 8, Fixed Length - 2
Column3 : Starting Postion - 11, Fixed Length - 10
Column4 : Starting Position -1, Fixed Length -5
Column5 : Starting Position - 10, Fixed Length - 2
Column6 : Starting Postion - 15, Fixed Length - 5
The out put file each line have only 20 characters length.First 3 columns comes in first line and 4-6 columns comes in 2nd line.
OUTPUT FILE:
1234 89 11121314151617181920
12345 1011 151617181920BOL says that:
The Fixed width with row delimiters option is not available in the Flat File Connection Manager Editor.
If necessary, you can emulate this option in the editor. To emulate this option, on the General page of the Flat File Connection Manager
Editor, for Format, select Ragged right. Then on the Advanced page
of the editor, add a new dummy column as the final column of data.
More details steps:
http://www.coderewind.com/2012/08/ssis-how-to-include-rowdelimiter-with-destination-flat-files/
Below blog should make things clear:
SSIS Flat File Export - "Fixed Width" vs "Ragged Right"
-Vaibhav Chaudhari -
How to ignore prefix from XML while converting XML to csv using XSLT
Hi All,
I am trying to convert XML to csv file.
the XML i have is like....
<?xml version="1.0"?>
<bulkCmConfigDataFile xmlns:es="SpecificAttributes.3.0.xsd" xmlns:un="utranNrm.xsd" xmlns:xn="genericNrm.xsd" xmlns:gn="geranNrm.xsd" xmlns="configData.xsd">
<configData dnPrefix="Undefined">
<xn:SubNetwork id="AU_R">
<xn:SubNetwork id="H5RG_0501">
<xn:MeContext id="Firle_5070020">
<xn:ManagedElement id="1">
<un:RncFunction id="1">
<un:UtranCell id="50390303">
<un:attributes>
<un:userLabel>UtranCell 50390303</un:userLabel>
<un:cId>52383</un:cId>
<un:localCellId>50390303</un:localCellId>
<un:uarfcnUl>9613</un:uarfcnUl>
<un:uarfcnDl>10563</un:uarfcnDl>
<un:primaryScramblingCode>502</un:primaryScramblingCode>
<un:primaryCpichPower>287</un:primaryCpichPower>
<un:maximumTransmissionPower>403</un:maximumTransmissionPower>
<un:primarySchPower>-18</un:primarySchPower>
<un:secondarySchPower>-20</un:secondarySchPower>
<un:bchPower>-20</un:bchPower>
<un:lac>50301</un:lac>
<un:rac>1</un:rac>
<un:sac>52383</un:sac>
<un:utranCellIubLink>SubNetwork=AU_R,SubNetwork=H5RG_0501,MeContext=H5RG_0501,ManagedElement=1,RncFunction=1,IubLink=5039030</un:utranCellIubLink>
</un:attributes>
</un:UtranCell>
</un:RncFunction>
</xn:ManagedElement>
</xn:MeContext>
</xn:SubNetwork>
</xn:SubNetwork>
</configData>
</bulkCmConfigDataFile>now when i am using XSLT functionality to convert this XML into a csv i want ignore all the prefix from this xml like "un" , "xn" etc....
can anybody has idea how i can ignore all this value using XSLTI just dont understand why factory.setIgnoringElementContentWhitespace(true) did not work.That only does something if the XML has a DTD that enables it to know what whitespace can be ignored and what is significant. The API documentation for the method refers you to this document:
http://www.w3.org/TR/REC-xml#sec-white-space -
How to add numbers in XML?567- 5+6+7=18?
I have a requirement in check printing to print the check no at the bottom of the check.
1. Compute sum of all the digits in the check number and divide it by 9.
E.g.:
1. 0+0+7+0+0+5+7+9 = 28 (SUM)
2. 28 / 9 = 3 (with remainder 1)
3.2. Compute the difference between 9 and the remainder in step 2. This number is the check digit (Modulus 9).
E.g.:
1. 9 – 1 = 8
2. 8 is the check digit.
If the remainder in Step2=0, then the check digit is 9
So I will display 007005798
In XML or XSL , How can I do this?
Question: Is there any built in SQL function available to compute the sum of individuals of a number?For eg 567-> 5+6+7=18
If I am ending up wrinting a function for the above how can I call that in RTF?
thanks
prasannaSrini
Can you please help me out..The xml formula works for hardcoded values but not for the actual tag values.
1) I am not finding space to copy the following into the form field:\
You gave:
<?9-((substring(555555555,1,1)+ substring (555555555,2,1) + substring (555555555,3,1) + substring (555555555,4,1) + substring (555555555,5,1) + substring (555555555,6,1) + substring (555555555,7,1) + substring (555555555,8,1) + substring (555555555,9,1)) mod 9)?>
I remodified for my situation:
<?9-((substring(../PaymentNumber/CheckNumber,1,1)+ substring (../PaymentNumber/CheckNumber,2,1) +
substring (../PaymentNumber/CheckNumber,3,1) + substring (../PaymentNumber/CheckNumber,4,1) +
substring (../PaymentNumber/CheckNumber,5,1) + substring (../PaymentNumber/CheckNumber,6,1) +
substring (../PaymentNumber/CheckNumber,7,1) + substring (../PaymentNumber/CheckNumber,8,1) +
substring (../PaymentNumber/CheckNumber,9,1)) mod 9)?>
But the above dont fit into the form field.How to take care of this?
thanks
prasanna -
How to add new fields on output list of ME5A(Purchase Requisitions)
Hi Friends,
I have to do a task to add a new field ABC Indicator (MARC-MAABC) on the output list of ME5A. IS there any standard way to to this or do I have to copy ME5A to ZME5A and do? Please advice.
Apprecaite your suggestions ont his thread.
Thanks,
HarryHi,
Already there are some ENHANCEMENT spots are available in the program RM06BA00.. check if you can use them to add your logic to get the new field... -
How to add DOCTYPE in XML using jaxp-1.2 ????
Hi all,
I know this question has been asked at least 2000 times. But I couldn't find the answer from the previously posted messages.
I would like to create a new Document (actually a XML document) and to write it out into a file. Of course, to be useful, that document needs a DTD... But I can't find a way to create that DOCTYPE tag.
In fact, I get this error: org.apache.crimson.tree.DomEx: HIERARCHY_REQUEST_ERR: This node isn't allowed there.
at org.apache.crimson.tree.XmlDocument.appendChild(XmlDocument.java:661)
at ServiceManager.PlaylistDOM.createDoc(PlaylistDOM.java:99)
at ServiceManager.PlaylistDOM.load(PlaylistDOM.java:52)
at java.lang.Thread.run(Thread.java:536)The code I have is the following:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
//create a factory and configure it
DocumentBuilder builder = factory.newDocumentBuilder();
playlistDoc = builder.newDocument();
DOMImplementation impl = builder.getDOMImplementation();
DocumentType doctype = impl.createDocumentType(ROOT_EL, null, "playlist.dtd");
playlistDoc = impl.createDocument(null, ROOT_EL, doctype);
catch (ParserConfigurationException pce) {}
//create the root of the XML file
Element root = (Element) playlistDoc.createElement(ROOT_EL);
root.setAttribute(FRAME_ATTR, fNb);
playlistDoc.appendChild(root);
//now print it out into XML file
TransformerFactory tfactory = TransformerFactory.newInstance();
try {
Transformer transformer = tfactory.newTransformer();
DOMSource source = new DOMSource(playlistDoc.getDocumentElement());
StreamResult res = new StreamResult(new File(filename));
transformer.transform(source, res);
catch (TransformerConfigurationException tce) {}
catch (TransformerException te) {}Thank you for your helpadd both SYSTEM and PUBLIC, then you will find PUBLIC :P
================
If the doctype-public or doctype-system attributes are specified, then the html output method should output a document type declaration immediately before the first element. The name following <!DOCTYPE should be HTML or html. If the doctype-public attribute is specified, then the output method should output PUBLIC followed by the specified public identifier; if the doctype-system attribute is also specified, it should also output the specified system identifier following the public identifier. If the doctype-system attribute is specified but the doctype-public attribute is not specified, then the output method should output SYSTEM followed by the specified system identifier.
reference: http://java.sun.com/j2se/1.4.1/docs/api/javax/xml/transform/OutputKeys.html -
How to add User SamAccountName to output of Get-ADPrincipalGroupMembership
Hello, I am trying to fill the 1st column of the csv file with the User's SamAccountName and then hopefully the groups they are in, but the syntax I chose only gives a blank value. I'm able to get all groups out of AD that a user is a member of using
Get-ADPrincipalGroupMembershipbut am thinking that the cmdlet only grabs the group attribs and
no user attribs. The script finishes without errors, but I'm guessing I need Get-ADuser cmdlet somehow to get that User SamAccountName in there? I'm not really looking for nesting here. Just a list of users and the groups they are members of. Thanks
$user="Doe,John"
Get-ADPrincipalGroupMembership -Identity $user |
Select @{ expression={$user.SamAccountName}; label='SID' },distinguishedName,GroupCategory,GroupScope,name,objectClass,objectGUID,SamAccountName |
Export-Csv -NoTypeInformation C:\scripts\Output\SingleUserGroupMembership3.csvI just wasn't sure if there was a way to grab Get-ADUser properties as well as those from
Get-ADPrincipalGroupMembership?
Sure, you can do that. Here's an example of getting the display name from Get-ADUser along with the membership:
$user = 'tester1'
Get-ADPrincipalGroupMembership -Identity $user |
Select @{N='Username';E={$user}},@{N='DisplayName';E={(Get-ADUser -Identity $user -Properties DisplayName).DisplayName}},Name |
Export-Csv .\groupMemberships.csv -NoTypeInformation
Just out of curiosity, how would you combine or extract properties from different cmdlets?
That all depends on what you're trying to do. I'll generally store the output of each cmdlet in a variable and then build a custom object based on what I need from each. Here's an example:
$os = Get-WmiObject Win32_OperatingSystem
$cs = Get-WmiObject Win32_ComputerSystem
$bios = Get-WmiObject Win32_BIOS
$props = @{
'OS Version' = $os.Caption
'Computer Manufacturer' = $cs.Manufacturer
'Model' = $cs.Model
'Computer Name' = $cs.Name
'System Type' = $cs.SystemType
'BIOS Serial Number' = $bios.SerialNumber
New-Object PsObject -Property $props
Also, it appears you can't grab a list of users this way. I tried Import-csv with a few SamAccountNames, but the cmdlet doesn't support this.
That should work fine, here's an example (assumes a header of Username in your input CSV):
Import-Csv .\userList.csv | ForEach {
$user = $_.Username
Get-ADPrincipalGroupMembership -Identity $user |
Select @{N='Username';E={$user}},@{N='DisplayName';E={(Get-ADUser -Identity $user -Properties DisplayName).DisplayName}},Name
} | Export-Csv .\groupMemberships.csv -NoTypeInformation
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing)
Maybe you are looking for
-
Restart problem with cd in drive
So it all started when trying to close a program and the system wouldn't allow it. I tried to restart it but it wouldn't do it. So I shut it down by holding the power button. When restarting it sent me to a blue screen with the spinner, then eventual
-
X server crashes when trying to switch from compiz to metacity
Hi, i updated mesa to 7.4-1, xf86-video-ati to 6.12.2-1, xorg-server to 1.6.1-1 and now i see that when i try to switch from compiz to metacity, my xserver crashes and login window shows up. i tried that many times, but everytime my xserver crashed.
-
Hi Guys, I am running Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production on Solaris 9. I have a datafile that is on recover status and I can't recover this database to a consistent state with other datafiles. The reason being that one o
-
Please help me in Merging the Persons Together by assining the same id
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production Please Help Me We_addr_id defines the Address. We_pid Defines the Person. i am planning to merge the same person together by assigining the same we_pid. WITH merge_names
-
This is what happened ..
after i fully charged my ipod5, i plugged it into somespeakers to blast up some music.. and it blacked out once i heard this loud buzzing sound . i immediately plugged off the cords from the speakers . i havent used it for a couple days now .. what d