Validate xml encoding - BPEL
Hi!
I would like to validate the xml encoding in the BPEL process, does anyone know how to do this?
I mean, I have a BPEL process that receives an xml as the input. The input xml has a encoding specified. For example encoding="UTF-8". What I want to validate is that all the characters in the xml are valid in UTF-8 encoding (or whatever encoding is specified in the xml header).
I have used <property name="validateXML">true</property> in the bpel.xml. This works to validate the xml against the schema, but does not validate the encoding.
Please, I need help with this issue.
Thanks in advance,
Zaloa
when using the validate activity in the bpel itself, your instance is already created
You can enable payload validation per composite of global
If you go to the Em console > your composite > click the button at the top middle 'Settings' > Payload Validation
http://download.oracle.com/docs/cd/E15523_01/integration.1111/e10226/bp_config.htm
9.1 Configuring BPEL Process Service Engine Properties
Payload Validation
Similar Messages
-
Switching ON validate xml(Schema Validation) in BPEL Console for AIAtesting
While we were testing Oracle O2B pip, we have recently switched on schema validation by turning it on to 'Strict' so that we can Validate
XML in BPEL Console. Earlier when we were testing we had turned the schema validation as 'None' on BPEL console, and hence everything was working fine and
no errors we popping out while creating sales order in Siebel CRM. But the moment we put validate xml to ' Strict' it starts throwing validation errors.
So can you please help us to know whether it is right to test the Oracle O2B pip by putting validate xml to 'Strict'? If it is fair to test it by switching
ON Validate XML(putting validate xml to 'Strict') then we are getting below error.
We are creating a new sales order in Siebel CRM and when we check in BPEL console it was faulted at UpdateSalesOrderSiebelCommsProvABCSImpl (v. 1.0) .When we checked the BPEL flow it is throwing error at InvokeUpdateUpsert.
Error is According to the xml schemas, the xml document is invalid. The reason is: Error::cvc-complex-type.2.4.a: Invalid content was found starting with element 'xsdLocal1:Process_spcInstance_spcId'. One of '{"http://siebel.com/asi":Process_spcInstance_spcId}' is expected.
Steps for Switching on Validation ?
1) Login to BPEL Console
2) Go To Configuration section
3) Schema Validation changes
a. ON: populate validateXML with value strict
b. OFF: populate validateXML with value none
Really appreciate if you can help..hi
Indeed, the "Validate XML" menu option only shows "Validate XML: 0 errors, 0 warnings.".
But, if you look at the "Design" tab for your schema, the "invoices" element node contains an "xsd:invoice" sequence shown in red. If you change "xsd:invoice" to "invoice" this becomes white and the node can be expanded.
One other thing, registering an XML Schema in JDeveloper like the one you posted, isn't possible without an "oracle.xml.parser.schema.XSDException" (without further details).
regards
Jan Vervecken -
Hi,
I have a simple XML file with a internal DTD. I want to validate the XML file against this internal DTD. Following is the XML file with the internal DTD. Can you please let me know, why is the Validate XML disabled.
<?xml version='1.0' encoding='windows-1252'?>
<!DOCTYPE name_details [
<!ELEMENT name_details (first_name, middle_name, last_name, e_num)>
<!ELEMENT first_name (#PCDATA) >
<!ELEMENT middle_name (#PCDATA)>
<!ELEMENT last_name (#PCDATA)>
<!ELEMENT e_num (#PCDATA)>
]>
<name_details>
<first_name>fn=John</first_name>
<middle_name>mi=Smith</middle_name>
<last_name>ln=Putt</last_name>
<emp_number>e_num=988-987-898</emp_number>
</name_details>
Thanks
kiran"The Validate XML command will validate the XML against a schema registered with JDeveloper defined in the XML file. To register a schema with JDeveloper choose Tools> Preferences> XML Schemas. This command on the context menu is disabled whenever an XML file does not have an XML namespace defined. "
-
IsSchemaValid does chang the xml-encoding header from UTF-8 to WINDOWS-1252
I found the following effect:
isSchemaValid does changing the encoding - entry of the xml-file-header
generating xml-file by using DBMS_XMLGEN :
xmldoc := DBMS_XMLGEN.getXML(ctx);
with the header of the file is
<?xml version="1.0" encoding="UTF-8"?>
change the xmldoc to a xmlType
and validate it against the schema
xmldoc_xmlType:=(xmltype(xmldoc)) ;
xmldoc_xmlType.isSchemaValid ( bSchemalocation)
after this the header of the file is
<?xml version="1.0" encoding="WINDOWS-1252"?>
my DB:
R11_2_0_2 / Windows 64
the same in
R11_2_0_1 / Windows 32
select name, value from v$parameter where upper(name) like '%NLS%'
nls_calendar
nls_comp BINARY
nls_currency
nls_date_format
nls_date_language
nls_dual_currency
nls_iso_currency
nls_language AMERICAN
nls_length_semantics BYTE
nls_nchar_conv_excp FALSE
nls_numeric_characters
nls_sort
nls_territory AMERICA
nls_time_format
nls_timestamp_format
nls_timestamp_tz_format
nls_time_tz_format
register my schema by:
dbms_xmlschema.registerSchema(
schemaurl => vschemaurl,
schemadoc => xsd_file,
local => FALSE,
gentypes => TRUE,
genbean => FALSE,
gentables => TRUE,
force => FALSE,
owner => dbuser
,CSID => nls_charset_id('AL32UTF8')
How can I let or change back the xml-encoding entry to UTF-8 ?
regardsYour solution should not be relied upon...
C:\Temp>sqlplus /nolog @t1 %CD%
SQL*Plus: Release 11.2.0.2.0 Production on Fri Mar 4 09:41:32 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> spool testcase.log
SQL> --
SQL> connect sys/oracle as sysdba
Connected.
SQL> --
SQL> set define on
SQL> set timing on
SQL> --
SQL> def XMLDIR = &1
SQL> --
SQL> def USERNAME = XDBTEST
SQL> --
SQL> def PASSWORD = &USERNAME
SQL> --
SQL> def USER_TABLESPACE = USERS
SQL> --
SQL> def TEMP_TABLESPACE = TEMP
SQL> --
SQL> drop user &USERNAME cascade
2 /
old 1: drop user &USERNAME cascade
new 1: drop user XDBTEST cascade
User dropped.
Elapsed: 00:00:00.24
SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
2 /
old 1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
new 1: grant create any directory, drop any directory, connect, resource, alter session, create view to XDBTEST identified by XDBTEST
Grant succeeded.
Elapsed: 00:00:00.07
SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
2 /
old 1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
new 1: alter user XDBTEST default tablespace USERS temporary tablespace TEMP
User altered.
Elapsed: 00:00:00.00
SQL> set long 100000 pages 0 lines 256 trimspool on timing on
SQL> --
SQL> connect &USERNAME/&PASSWORD
Connected.
SQL> --
SQL> create or replace directory XMLDIR as '&XMLDIR'
2 /
old 1: create or replace directory XMLDIR as '&XMLDIR'
new 1: create or replace directory XMLDIR as 'C:\Temp'
Directory created.
Elapsed: 00:00:00.00
SQL> create table XML_DEFAULT of XMLTYPE
2 /
Table created.
Elapsed: 00:00:00.11
SQL> create table XML_CLOB of XMLTYPE
2 XMLTYPE store as CLOB
3 /
Table created.
Elapsed: 00:00:00.01
SQL> select *
2 from nls_database_parameters
3 where parameter in ('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET')
4 /
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CHARACTERSET AL32UTF8
Elapsed: 00:00:00.02
SQL> declare
2 XML_DEFAULT XMLType := xmltype('<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>') ;
3 XML_CLOB XMLType := xmltype('<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>') ;
4 begin
5 delete XML_DEFAULT;
6 delete XML_CLOB;
7 insert into XML_DEFAULT values (XML_DEFAULT);
8 dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT.xml');
9 IF XML_DEFAULT.isSchemaValid ( 'SCHEMALOCATION_DOES_NO_MATTER_FOR_TEST_CASE.XSD', 'SCHEMA_NO_MATTER') = 1 THEN null; ELSE null; END IF;
10 commit;
11 dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT_IS_VALID.xml',nls_charset_id('WE8MSWIN1252'));
12 dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT_WIN1252.xml');
13 insert into XML_CLOB values (XML_CLOB);
14 dbms_xslprocessor.clob2file( XML_CLOB.getclobval() , 'XMLDIR','XML_CLOB.xml');
15 commit;
16 end ;
17 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.27
SQL> --
SQL> host type XML_DEFAULT.xml
<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>
SQL> --
SQL> host type XML_DEFAULT_IS_VALID.xml
<?xml version="1.0" encoding="UTF-8"?>
<TEST>SELECT</TEST>
SQL> --
SQL> host type XML_DEFAULT_WIN1252.xml
<?xml version="1.0" encoding="UTF-8"?>
<TEST>SELECT</TEST>
SQL> --
SQL> host type XML_CLOB.xml
<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>
SQL> --
SQL>First, the character set changes because isSchemaValid() causes the document to be parsed and converted to the internal database character set, as does storing it in a table.
It appear that your solution works in SQL because the semantics of SQL are such that it causes a 'copy' of the XMLType to take place before running the isSchemaValid() processing, were we to optimize away that copy as a result of a patch or performance optimization project then you solution would break...
If you want the output in a particular character set you should force that using XMLSerialize or getBlobVal(charsetid). Unfortunately we don't have a convience method for writing BLOBS on DBMS_XSLPROCESSOR... -
Validate xml with complextype schema without root element!
Hi All!
I have a problem that. I want to validate a xml data of complextype but the schema i want to validate is[b] not have root element.
For example:
The schema like that
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="www.thachpn.test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="www.thachpn.test" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="Name">
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
and the xml data i want to validate like this
<?xml version="1.0" encoding="UTF-8"?>
<Name xmlns="www.thachpn.test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FirstName>Pham</FirstName>
<LastName>Thach</LastName>
</Name>
My Algorithm is like that:
I create a complextype object by above schema
then i create new element with given name and namespace
after that i use schema of this element to validate xml data.
I use xmlparserv2 lib of oracle
But i can not find how to create complextype from schema or create element with have complextype.
Please help me.
Thanks a lot!<?xml version="1.0" encoding="UTF-8"?>
Modify the schema.
Add a root element.
<xs:schema targetNamespace="www.thachpn.test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="www.thachpn.test" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:element name="Name" type="Name"/>
<xs:complexType name="Name">
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema> -
How to validate XML against XSD and parse/save in one step using SAXParser?
How to validate XML against XSD and parse/save in one step using SAXParser?
I currently have an XML file and XSD. The XML file specifies the location of the XSD. In Java code I create a SAXParser with parameters indicating that it needs to validate the XML. However, SAXParser.parse does not validate the XML, but it does call my handler functions which save the elements/attributes in memory as it is read. On the other hand, XMLReader.parse does validate the XML against the XSD, but does not save the document in memory.
My code can call XMLReader.parse to validate the XML followed by SAXParser.parse to save the XML document in memory. But this sound inefficient. Besides, while a valid document is being parsed by XMLReader, it can be changed to be invalid and saved, and XMLReader.parse would be looking at the original file and would think that the file is OK, and then SAXParser.parse would parse the document without errors.
<Book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="book.xsd" name="MyBook">
<Chapter name="First Chapter"/>
<Chapter name="Second Chapter">
<Section number="1"/>
<Section number="2"/>
</Chapter>
</Book>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Book">
<xs:complexType>
<xs:sequence>
<xs:element name="Chapter" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Section" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="xnumber"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
</xs:schema>
public class SAXXMLParserTest
public static void main(String[] args)
try
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
SAXParser parser = factory.newSAXParser();
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
BookHandler handler = new BookHandler();
XMLReader reader = parser.getXMLReader();
reader.setErrorHandler(handler);
parser.parse("xmltest.dat", handler); // does not throw validation error
Book book = handler.getBook();
System.out.println(book);
reader.parse("xmltest.dat"); // throws validation error because of 'xnumber' in the XSD
public class Book extends Element
private String name;
private List<Chapter> chapters = new ArrayList<Chapter>();
public Book(String name)
this.name = name;
public void addChapter(Chapter chapter)
chapters.add(chapter);
public String toString()
StringBuilder builder = new StringBuilder();
builder.append("<Book name=\"").append(name).append("\">\n");
for (Chapter chapter: chapters)
builder.append(chapter.toString());
builder.append("</Book>\n");
return builder.toString();
public static class BookHandler extends DefaultHandler
private Stack<Element> root = null;
private Book book = null;
public void startDocument()
root = new Stack<Element>();
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
if (qName.equals("Book"))
String name = attributes.getValue("name");
root.push(new Book(name));
else if (qName.equals("Chapter"))
String name = attributes.getValue("name");
Chapter child = new Chapter(name);
((Book)root.peek()).addChapter(child);
root.push(child);
else if (qName.equals("Section"))
Integer number = Integer.parseInt(attributes.getValue("number"));
Section child = new Section(number);
((Chapter)root.peek()).addSection(child);
root.push(child);
public void endElement(String uri, String localName, String qName) throws SAXException
Element finished = root.pop();
if (root.size() == 0)
book = (Book) finished;
public Book getBook()
return book;
public void error(SAXParseException e)
System.out.println(e.getMessage());
public void fatalError(SAXParseException e)
error(e);
public void warning(SAXParseException e)
error(e);
public class Chapter extends Element
public static class Section extends Element
private Integer number;
public Section(Integer number)
this.number = number;
public String toString()
StringBuilder builder = new StringBuilder();
builder.append("<Section number=\"").append(number).append("\"/>\n");
return builder.toString();
private String name;
private List<Section> sections = null;
public Chapter(String name)
this.name = name;
public void addSection(Section section)
if (sections == null)
sections = new ArrayList<Section>();
sections.add(section);
public String toString()
StringBuilder builder = new StringBuilder();
builder.append("<Chapter name=\"").append(name).append("\">\n");
if (sections != null)
for (Section section: sections)
builder.append(section.toString());
builder.append("</Chapter>\n");
return builder.toString();
}Edited by: sn72 on Oct 28, 2008 1:16 PMHave you looked at the XML DB FAQ thread (second post) in this forum? It has some examples for validating XML against schemas.
-
XML encoding to UTF-8 charset - Oracle 9i
Hi Masters
Database Version : 9i
Can you please help me here.. I am in a process of writing an Inventory Adjustment tool that will generate the XML and encode it to utf-8 charset…
I have successfully written the code to generate the XML in this format
<?xml version="1.0" encoding="ISO-8859-1" ?>
<InvAdjustDesc>
<dc_dest_id>323</dc_dest_id>
<InvAdjustDtl>
<item_id>12345678</item_id>
<adjustment_reason_code>383</adjustment_reason_code>
<unit_qty>4</unit_qty>
<from_disposition>ATS</from_disposition>
<to_disposition/>
<user_id>e7062159</user_id>
<create_date>
<year>2012</year>
<month>10</month>
<day>29</day>
<hour>14</hour>
<minute>59</minute>
<second>25</second>
</create_date>
<ww_liability_code>353</ww_liability_code>
<ww_ref_1/>
<ww_ref_2/>
<ww_tran_id>25863399875</ww_tran_id>
<ww_alloc_no/>
<ww_final_store>353</ww_final_store>
</InvAdjustDtl>
</InvAdjustDesc>
And now as part of the AIT requirement this XML needs to be encoded to utf-8 and look like this
<?xml version="1.0" encoding="UTF-8"?><RibMessages><ribMessage><family>InvAdjust</family><type>INVADJUSTCRE</type><id>54601557</id><ribmessageID>3</ribmessageID><publishTime>2012-10-29 15:03:12.000 SAST</publishTime><messageData><?xml version="1.0" encoding="ISO-8859-1" ?><InvAdjustDesc><dc_dest_id>323</dc_dest_id><InvAdjustDtl><item_id>12345678</item_id><adjustment_reason_code>383</adjustment_reason_code><unit_qty>4</unit_qty><from_disposition>ATS</from_disposition><to_disposition/><user_id>e7062159</user_id><create_date><year>2012</year><month>10</month><day>29</day><hour>14</hour><minute>59</minute><second>25</second></create_date><ww_liability_code>353</ww_liability_code><ww_ref_1/><ww_ref_2/><ww_tran_id>25863399875</ww_tran_id><ww_alloc_no/><ww_final_store>353</ww_final_store></InvAdjustDtl></InvAdjustDesc></messageData><customFlag>F</customFlag></ribMessage></RibMessages>
I am not quite familiar with xml encoding do you have any suggestion on how i can accomplish this?
ThanksHi Odie
I found a way of writing the encoded xml thanks for your help my man, much appreciated...
But now can you help me here this xml I am generating needs to be like the one at the bottom...
Here is my SQL I am using....
SELECT XMLELEMENT
("InvAdjustDesc"
,XMLFOREST
(inv.dc_dest_id AS "dc_dest_id"
,XMLFOREST
(NVL(inv.item_id, ' ') AS "item_id"
,NVL(inv.adjustment_reason_code, ' ') AS "adjustment_reason_code"
,NVL(inv.unit_qty, 0) AS "unit_qty"
,NVL(inv.from_disposition, ' ') AS "from_disposition"
,NVL(inv.to_disposition, ' ') AS "to_disposition"
,NVL(inv.user_id, ' ') AS "user_id"
,XMLFOREST(TO_CHAR(SYSDATE, 'yyyy') AS "year"
,TO_CHAR(SYSDATE, 'mm') AS "month"
,TO_CHAR(SYSDATE, 'dd') AS "day"
,TO_CHAR(SYSDATE, 'hh') AS "hour"
,TO_CHAR(SYSDATE, 'mi') AS "minute"
,TO_CHAR(SYSDATE, 'ss') AS "second"
) AS create_date
,NVL(inv.ww_liability_code, ' ') AS "ww_liability_code"
,NVL(inv.ww_ref_1, ' ') AS "ww_ref_1"
,NVL(inv.ww_ref_2, ' ') AS "ww_ref_2"
,NVL(inv.ww_tran_id, ' ') AS "ww_tran_id"
,NVL(inv.ww_alloc_no, ' ') AS "ww_alloc_no"
,NVL(inv.ww_final_store, ' ') AS "ww_final_store"
) AS InvAdjustDtl)) AS InvAdjustDesc
FROM invadjust inv
WHERE inv.dc_dest_id = 342
and rownum <= 3;
I need to have a leading <InvAdjustDesc> with a node <dc_dest_id> with repeating <InvAdjustDtl>
I did try to put XMLAGG to group all of my <InvAdjustDtl> nodes but the output I get is two entries of <InvAdjustDtl> as follows
<InvAdjustDesc>
<dc_dest_id>323</dc_dest_id>
<INVADJUSTDTL>
<InvAdjustDtl>
<item_id>20144791</item_id>
<adjustment_reason_code>6</adjustment_reason_code>
<unit_qty>-4</unit_qty>
<from_disposition>ATS</from_disposition>
<to_disposition />
<user_id>r7052891</user_id>
<CREATE_DATE>
<year>2012</year>
<month>10</month>
<day>31</day>
<hour>10</hour>
<minute>15</minute>
<second>44</second>
</CREATE_DATE>
<ww_liability_code>342</ww_liability_code>
<ww_ref_1 />
<ww_ref_2 />
<ww_tran_id>342021751178</ww_tran_id>
<ww_alloc_no />
<ww_final_store>342</ww_final_store>
</InvAdjustDtl>
<InvAdjustDtl>
<item_id>6009173222220</item_id>
<adjustment_reason_code>6</adjustment_reason_code>
<unit_qty>-1</unit_qty>
<from_disposition>ATS</from_disposition>
<to_disposition />
<user_id>r7052891</user_id>
<CREATE_DATE>
<year>2012</year>
<month>10</month>
<day>31</day>
<hour>10</hour>
<minute>15</minute>
<second>44</second>
</CREATE_DATE>
<ww_liability_code>342</ww_liability_code>
<ww_ref_1 />
<ww_ref_2 />
<ww_tran_id>342021751179</ww_tran_id>
<ww_alloc_no />
<ww_final_store>342</ww_final_store>
</InvAdjustDtl>
<InvAdjustDtl>
<item_id>2034180000008</item_id>
<adjustment_reason_code>6</adjustment_reason_code>
<unit_qty>-1</unit_qty>
<from_disposition>ATS</from_disposition>
<to_disposition />
<user_id>r7052891</user_id>
<CREATE_DATE>
<year>2012</year>
<month>10</month>
<day>31</day>
<hour>10</hour>
<minute>15</minute>
<second>44</second>
</CREATE_DATE>
<ww_liability_code>342</ww_liability_code>
<ww_ref_1 />
<ww_ref_2 />
<ww_tran_id>342021751180</ww_tran_id>
<ww_alloc_no />
<ww_final_store>342</ww_final_store>
</InvAdjustDtl>
</INVADJUSTDTL>
</InvAdjustDesc>cond>11</second>
</CREATE_DATE>
<ww_liability_code>342</ww_liability_code>
<ww_ref_1 />
<ww_ref_2 />
<ww_tran_id>342021751180</ww_tran_id>
<ww_alloc_no />
<ww_final_store>342</ww_final_store>
</INVADJUSTDTL>
</InvAdjustDesc>cond>11</second>
</CREATE_DATE>
<ww_liability_code>342</ww_liability_code>
<ww_ref_1 />
<ww_ref_2 />
<ww_tran_id>342021751180</ww_tran_id>
<ww_alloc_no />
<ww_final_store>342</ww_final_store>
</INVADJUSTDTL>
</InvAdjustDesc>
--------------------------------------Desired Output___________________
<?xml version="1.0" encoding="ISO-8859-1" ?>
<InvAdjustDesc>
<dc_dest_id>852</dc_dest_id>
<InvAdjustDtl>
<item_id>12345</item_id>
<adjustment_reason_code>989</adjustment_reason_code>
<unit_qty>4</unit_qty>
<from_disposition>ats</from_disposition>
<to_disposition>tst</to_disposition>
<user_id>w759862</user_id>
<create_date>
<year>2012</year>
<month>10</month>
<day>31</day>
<hour>09</hour>
<minute>14</minute>
<second>23</second>
</create_date>
<ww_liability_code>852</ww_liability_code>
<ww_ref_1/>
<ww_ref_2/>
<ww_tran_id>12358965</ww_tran_id>
<ww_alloc_no/>
<ww_final_store>323</ww_final_store>
</InvAdjustDtl>
<InvAdjustDtl>
<item_id>78952675</item_id>
<adjustment_reason_code>987</adjustment_reason_code>
<unit_qty>5</unit_qty>
<from_disposition>ats</from_disposition>
<to_disposition>asr</to_disposition>
<user_id>w7889526</user_id>
<create_date>
<year>2012</year>
<month>10</month>
<day>31</day>
<hour>09</hour>
<minute>15</minute>
<second>02</second>
</create_date>
<ww_liability_code>456</ww_liability_code>
<ww_ref_1/>
<ww_ref_2/>
<ww_tran_id>482665226</ww_tran_id>
<ww_alloc_no/>
<ww_final_store>456</ww_final_store>
</InvAdjustDtl>
</InvAdjustDesc> -
Hi,
i send via E-Mail Adapter an XML File.
Is there a possibility to change the xml encoding.
from:
<?xml version="1.0" encoding="UTF-8" ?>
to
<?xml version="1.0" encoding="ISO-8859-1" ?>
regards,
robinhi
check the below links
XI: Sender mail adapter - PayloadSwapBean - Step by step
/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
Mail Adapter (XI) - how to implement dynamic mail address
/people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
Note: reward points if solution found helpfull
Regards
Chandrakanth.k -
HI all,
we try to post an XML message (cXML invoice) to a receiver but it doesn´t work.
We use a communication channel "http-destination" where we configure content-type "text/xml" together with XML encoding "UTF-8".
The configured URL works fine and can be tested in SM59.
The XML payload itself has a declaration <?xml version="1.0" encoding="UTF-8"?>
but the strange thing that happens is that all these declarations are being ignored and instead US-ASCII is used. Which leads to an error due to some special german characters within the contents of the XML (e.g. ä, ö, etc.).
Does anybody of you know how I can achieve that the pre-set UTF-8 will be used as encoding type???
Many thanky in advance!
Willi WuerstlinHi.
I am trying to map the standard cXML invoice to SAP's standard idoc INVOIC01 - This is how the file looks like
<?xml version="1.0" ?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.014/InvoiceDetail.dtd">
<cXML version="" payloadID="2008-07-29T04:51:08-06:00.cXML.TEST4101V002" timestamp="2008-07-29T04:51:08-06:00" xml:lang="en-US">
<Header>...</Header>
...</cxml>
I am having problem with the line <!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.014/InvoiceDetail.dtd"> - when the payload is having this line XI is not accepting the message.
Please let me know how to address this.
Thanks. -
How to set the Xml Encoding ISO-8859-1 to Transformer or DOMSource
I have a xml string and it already contains an xml declaration with encoding="ISO-8859-1". (In my real product, since some of the element/attribute value contains a Spanish character, I need to use this encoding instead of UTF-8.) Also, in my program, I need to add more attributes or manipulate the xml string dynamically, so I create a DOM Document object for that. And, then, I use Transformer to convert this Document to a stream.
My problme is: Firstly, once converted through the Transformer, the xml encoding changed to default UTF-8, Secondly, I wanted to check whether the DOM Document created with the xml string maintains the Xml Encoding of ISO-8859-1 or not. So, I called Document.getXmlEncoding(), but it is throwing a runtime error - unknown method.
Is there any way I can maintain the original Xml Encoding of ISO-8859-1 when I use either the DOMSource or Transformer? I am using JDK1.5.0-12.
Following is my sample program you can use.
I would appreciate any help, because so far, I cannot find any answer to this using the JDK documentation at all.
Thanks,
Jin Kim
import java.io.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Attr;
import org.xml.sax.InputSource;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
public class XmlEncodingTest
StringBuffer xmlStrBuf = new StringBuffer();
TransformerFactory tFactory = null;
Transformer transformer = null;
Document document = null;
public void performTest()
xmlStrBuf.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
.append("<TESTXML>\n")
.append("<ELEM ATT1=\"Yes\" />\n")
.append("</TESTXML>\n");
// the encoding is set to iso-8859-1 in the xml declaration.
System.out.println("initial xml = \n" + xmlStrBuf.toString());
try
//Test1: Use the transformer to ouput the xmlStrBuf.
// This shows the xml encoding result from the transformer which will change to UTF-8
tFactory = TransformerFactory.newInstance();
transformer = tFactory.newTransformer();
StreamSource ss = new StreamSource( new StringBufferInputStream( xmlStrBuf.toString()));
System.out.println("Test1 result = ");
transformer.transform( ss, new StreamResult(System.out));
//Test2: Create a DOM document object for xmlStrBuf and manipulate it by adding an attribute ATT2="No"
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dfactory.newDocumentBuilder();
document = builder.parse( new StringBufferInputStream( xmlStrBuf.toString()));
// skip adding attribute since it does not affect the test result
// Use a Transformer to output the DOM document. the encoding becomes UTF-8
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(System.out);
System.out.println("\n\nTest2 result = ");
transformer.transform(source, result);
catch (Exception e)
System.out.println("<performTest> Exception caught. " + e.toString());
public static void main( String arg[])
XmlEncodingTest xmlTest = new XmlEncodingTest();
xmlTest.performTest();
}Thanks DrClap for your answer. With your information, I rewrote the sample program as in the following, and it works well now as I intended! About the UTF-8 and Spanish charaters, I think you are right. It looks like there can be many factors involved on this subject though - for example, the real character sets used to create an xml document, and the xml encoding information declared will matter. The special character I had a trouble was u00F3, and somehow, I found out that Sax Parser or even Document Builder parser does not like this character when encoding is set to "UTF-8" in the Xml document. My sample program below may not be a perfect example, but if you replaces ISO-8859-1 with UTF-8, and not setting the encoding property to the transfermer, you may notice that the special character in my example is broken in Test1 and Test2. In my sample, I decided to use ByteArrayInputStream instead of StringBufferInpuptStream because the documentation says StringBufferInputStream may have a problem with converting characters into bytes.
Thanks again for your help!
Jin Kim
import java.io.*;
import java.util.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Attr;
import org.xml.sax.InputSource;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
* XML encoding test for Transformer
public class XmlEncodingTest2
StringBuffer xmlStrBuf = new StringBuffer();
TransformerFactory tFactory = null;
Document document = null;
public void performTest()
xmlStrBuf.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
.append("<TESTXML>\n")
.append("<ELEM ATT1=\"Resoluci�n\">\n")
.append("Special charatered attribute test")
.append("\n</ELEM>")
.append("\n</TESTXML>\n");
// the encoding is set to iso-8859-1 in the xml declaration.
System.out.println("**** Initial xml = \n" + xmlStrBuf.toString());
try
//TransformerFactoryImpl transformerFactory = new TransformerFactoryImpl();
//Test1: Use the transformer to ouput the xmlStrBuf.
tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
byte xmlbytes[] = xmlStrBuf.toString().getBytes("ISO-8859-1");
StreamSource streamSource = new StreamSource( new ByteArrayInputStream( xmlbytes ));
ByteArrayOutputStream xmlBaos = new ByteArrayOutputStream();
Properties transProperties = transformer.getOutputProperties();
transProperties.list( System.out); // prints out current transformer properties
System.out.println("**** setting the transformer's encoding property to ISO-8859-1.");
transformer.setOutputProperty("encoding", "ISO-8859-1");
transformer.transform( streamSource, new StreamResult( xmlBaos));
System.out.println("**** Test1 result = ");
System.out.println(xmlBaos.toString("ISO-8859-1"));
//Test2: Create a DOM document object for xmlStrBuf to add a new attribute ATT2="No"
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dfactory.newDocumentBuilder();
document = builder.parse( new ByteArrayInputStream( xmlbytes));
// skip adding attribute since it does not affect the test result
// Use a Transformer to output the DOM document.
DOMSource source = new DOMSource(document);
xmlBaos.reset();
transformer.transform( source, new StreamResult( xmlBaos));
System.out.println("\n\n****Test2 result = ");
System.out.println(xmlBaos.toString("ISO-8859-1"));
//xmlBaos.flush();
//xmlBaos.close();
catch (Exception e)
System.out.println("<performTest> Exception caught. " + e.toString());
finally
public static void main( String arg[])
XmlEncodingTest2 xmlTest = new XmlEncodingTest2();
xmlTest.performTest();
} -
How to validate xml file with XSD schema ?? in JDK1.4.2
How to validate xml file with XSD schema ?? in JDK1.4.2
i dont want to use new Xerec Jar ...
Suggest option ...Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
Then use Stax (Woodstock) or Saxon.
- Saish -
How to validate XML Digital Signature with XML DB (o PL/SQL) in Oracle 11g
Hi,
Do you know if there is possibility to validate XML Digital Signature using XML DB (or PL/SQL) in Oracle 11g?
Let say I have CLOB/XMLType containing Digitally Signed XML, and I want to validate, that thsi is proper signature. I also have public key of signer (I could store it in CLOB or file or Oracle wallet).
Is it possible to do?
If there is need to install additional component - then which one?
Regards,
PawełHi,
this is what i got from someone...
but the links he gave are not opening up...
u have to place a picture there and have to load the digital signatures as Jpegs on to the server to OA top
and have to refer them in the XML for dynamically get the signature on the reports
when u select the properties of the picture placed in the XML template,
there will be one tab with "URL"... in that u have to give the path for that jpegs
Pls refer the following documents for enabling digital signature on pdf documents.
http://iasdocs.us.oracle.com/iasdl/bi_ee/doc/bi.1013/e12187/T421739T481159.htm#5013638 (refer section 'Adding or Designating a Field for Digital Signature'
http://iasdocs.us.oracle.com/iasdl/bi_ee/doc/bi.1013/e12188/T421739T475591.htm#5013688
(Implementing a Digital Signature
Is the BI Publisher installed on your instance of version 10.1.3.4 or higher?
Pls procure a digital signature as soon as possible. The process can take time. OR we could use any certificate that you already might have OR generate a certificate using Oracle Certificate Authority for demo. -
Validate XML using XSD (XML Schema)
Hi experts.
Is there any way in ABAP to validate XML file against specified XSD file?
I found only possibility to validate against DTD, but no XSD. As far as I know this is only possible in Java, or is a part of XI. Is it doable without Java or XI (on NetWeaver 2004s)?
Help appreciated (and rewarded).
Regards, Frantisek.Hello
Perhaps you missed this link: [How to Perform XML Validations in SAP NetWeaver Process Integration 7.1|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d06dff94-9913-2b10-6f82-9717d9f83df1]
Regards
Uwe -
Validate XML with Schema?
So, according to Adobe...
quote:
Dreamweaver CS3 continues to support not only the creation
and editing of XML and XSL files, but it also allows you to import
DTDs and schemas and to validate XML documents.
Does anyone know how to accomplish this task? Adobe's
documentation on this topic seems be less current than their
marketing material.
I mean, I'm assuming from the way this is worded it means
that you can "import DTDs and schemas and ... validate XML
documents"
with said schemas. Or is this just some shifty marketing
trickery which really means you can import (i.e., open) a DTD or
schema, and, as a completely unrelated task, you can "validate"
your XML file - to the extent that Dreamweaver will tell you if you
forgot to close a tag?I tried to move all the xml, class and xsd files in the same folder and it still didn't work...
And I can't hard coded the xsd file on the document... so the only way is to set the xsd location inside the java codes... here's what I have:
static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
File xsdFile = new File("schema.xsd");
saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
saxParser.setProperty(JAXP_SCHEMA_SOURCE, xsdFile);
Please help... thx. -
Hello
I have several XML files and into this XML files there is not th DTD call.
i have another file, the DTD.
There is any method or code example for, without modify the XML files for including the DTD call, validate the XML againts one DTD?
thanksAlice (guest) wrote:
: Hi! I have obtained the v2 parser for java and the one for
plsql.
: I want to validate xml documents against a DTD file provided
by
: another program. I can't find any sample code that does setDTD
: for validation.
: Can you tell me how it can be done, please?
: Thanks in advance!
The method to set the DTD is setDoctype().
Stub code follows:
// Test using InputSource
parser = new DOMParser();
parser.setErrorStream(System.out);
parser.showWarnings(true);
FileReader r = new FileReader(args[0]);
InputSource inSource = new InputSource(r);
inSource.setSystemId(createURL(args[0]).toString());
parser.parseDTD(inSource, args[1]);
dtd = (DTD)parser.getDoctype();
r = new FileReader(args[2]);
inSource = new InputSource(r);
inSource.setSystemId(createURL(args[2]).toString());
parser.setDoctype(dtd);
parser.setValidationMode(true);
parser.parse(inSource);
doc = (XMLDocument)parser.getDocument();
doc.print(new PrintWriter(System.out));
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null
Maybe you are looking for
-
Linksys access point is better than cisco's wireless router !?
I bought a Linksys WAP54G yesterday to see whether my 871w is faulty. (Constant signal drops). While I was testing, I noticed that WAP54G has a better signal strength than the 871w. What's interesting is, Linksys WAP54G only has a max power output of
-
Is there anyway that Mail 4.2 on OS X 10.6.3 can utilize a mailbox in a secured sparse bundle file system? This is what I would like to have: I use two imap accounts with various mailboxes within them, and I have a set of mailboxes on my Mac. I would
-
MC40: Some materials don't have ABC Indicator
Hi Experts, I run MC40 in background with 13000+ materials using usage value in % strategy, most of it has its ABC indicator updated while some are still blank. Are there any indications (in Material Master or anywhere) that those materials with "bla
-
This week, Apple advertised AmpliTube Fender in Time Magazine, but I cannot find it in the Apple App Store. Does it exist?
-
Illustrator CC 2014 crashes on mac (yosemite) on launch
Hi everybody My illustrator cc 2014 crashes all the time after launch with the ''stoped working unexpectly'' error. Can you guys help with that please? Thanks