on 02-08-2010 3:42 AM
Hi XI Gurus
I'm trying to create an xml output that can be saved as excel (.xls). I started creating the data types but i'm getting an error when I activate the data type. I'm getting the following error:
Name of '/schema/complexType("Workbook")/attribute("xmlns")' starts with 'xml'
Value "xmlns:o" is not allowed for the attribute "name" of type "NCName" in element "/schema/complexType("Workbook")/attribute("xmlns:o")".
Name of '/schema/complexType("Workbook")/attribute("xmlns:o")' starts with 'xml'
Value "xmlns:x" is not allowed for the attribute "name" of type "NCName" in element "/schema/complexType("Workbook")/attribute("xmlns:x")".
Name of '/schema/complexType("Workbook")/attribute("xmlns:x")' starts with 'xml'
Value "xmlns:dt" is not allowed for the attribute "name" of type "NCName" in element "/schema/complexType("Workbook")/attribute("xmlns:dt")".
How can I append the attributes with xmlns in the main node? I tried searching SDN for answers but I can only find steps on how to delete the xmlns part by using XMLBeanalyzer
Thanks!!!
IX
Hi,
You Can create a Java Mapping and add the xmlns tag at the desired position using String operations.
for e.g.
String sb = null;
byte[] b = new byte[80000];
int count = 0;
for (int n; (n = inputStream.read(b)) != -1;)
{
sb = new String(b, 0, n);
sb = sb.replaceAll("<MT_test xmlns=\"http://www.w3.org/2001/XMLSchema-instance\" noNamespaceSchemaLocation=\"EDItX_TradeStockReport_V1.1.xsd\" version=\"1.1">","<MT_Test xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"EDItX_TradeStockReport_V1.1.xsd\" version=\"1.1\">");
}
Here I am replacing adding xsi prefix to xmlns attribute.
Likewise you can modify and change it according to your requirement
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fariha,
The UDF did not work. I'm getting syntax errors.
cannot find symbol symbol : variable inputStream
cannot find symbol symbol : variable xmlns
Note: /usr/sap/D37/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map4ef021d0147a11df94350025b3237ae8/source/com/sap/xi/tf/_SAPSRMCLMExcel_MM_.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.
Hi Suraj,
This is the output that I'm expecting. I'm planning to do an XML based on excel:
<?xml version="1.0" encoding="UTF-8"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:ns0="http://smart.com.ph/SRM_CLM">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Version>12.00</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>10005</WindowHeight>
<WindowWidth>10005</WindowWidth>
<WindowTopX>120</WindowTopX>
<WindowTopY>135</WindowTopY>
<ActiveSheet>1</ActiveSheet>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
</Styles>
<Worksheet ss:Name="Configuration">
<Table ss:ExpandedColumnCount="11" ss:ExpandedRowCount="7" x:FullColumns="1"
x:FullRows="1" ss:DefaultRowHeight="15">
<Row>
<Cell ss:MergeAcross="10">
<Data ss:Type="String">ContractsImport Workbook</Data>
</Cell>
</Row>
Hi Ignatius,
>>I'm planning to do an XML based on excel:
So are you using any XSD in the target side? I thin rather than making a Data type in PI and then adding the necessary tags, it will be better to create a excel and download the schema of it.
Then you can import it in PI and you will have the necessary tags. I have done a little google and found out this link
May be if you try more you will get to know how to make a xsd schema out of an excel sheet. Once it is done import it as an external definition and see whether you get the required XML structure or not
Regards
Suraj
How can I append the attributes with xmlns in the main node?
Does not seem to be possible.
You can try with one workaround....create a XSD in some tool (like STYLUS or even notepad) and then import it as ED....use it as message type....check if this approach helps.
Regards,
Abhishek.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.