Validate XML against XML Shema while marshalling/Unmarshalling in JAXB?.
Hi,
Can i validate XML documents against XML Shema when i marshall/unmarshall the same using JAXB API?.
Thanks
Well, it is weird, but, the code below works when validating the NonEmptyString type:
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add(null, "LogConfig.xsd");
XDocument doc1 = XDocument.Load("LogConfig.xml");
doc1.Validate(schemaSet, new ValidationEventHandler(ValidationCallBack), false);
However, if I leave the <LogName> empty it does not valid the values set on xsd fixed attribute,
The solution?
Well, I'm validating the same xml twice, the code above and the code on my first question.
Similar Messages
-
Getting invalid xml character while marshalling
Hi
I have a text which contains all characters including some special chars.I am replacing the html codes for &,>,<,\," characters. I am building the xml file and trying to marshall it. But i am getting "The character '' is an invalid XML character". I am using castor-0.9.6.jar. Can any one tell me how can i handle special chars like � is easy way rather than repacing each and every character.
Please let me know why i am getting the above error (is the special char end of file char. actually i am reating from string not from file).
Thanks & Regards,
PrasanthAs a guess because you are treating CDATA as meaning the same as 'binary' which it isn't. The characters in CDATA still must be valid XML characters.
If you want binary data then base64 encode it and put that in the document - and you won't need CDATA at all then, it will just be regular element text. -
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.
-
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 -
How to Validate XML against XSD through PL/SQL?
Hi friends,
I m new to this forum. This is my first query.
In our project, we are trying to generate output XML using PL/SQL procedure. I have done that successfully. Now my problem is I have to validate this against our XSD. How will I do that? Can you provide me with a sample example.
Thanks to all in advance.
Regards,
apkHave you looked at the XML DB FAQ thread (second post) in this forum? It has some examples for validating XML against schemas.
-
HOW TO USE isSchemaValid() in oracle 9i to validate XML against XSD
Hi
I am trying to validate xml file against xsd in oracle 9i.The steps are as follows:
*1.Created directory for xml and xsd file location:*
CREATE or replace DIRECTORY XML_DATA AS 'D:\prod\sample xml and xsd;
*2.Register the schema*
DECLARE
bf5 BFILE;
BEGIN
-- Register the schema
dbms_lob.filecloseall;
bf5 := BFILENAME('XML_DATA','xml1.xsd');
DBMS_XMLSCHEMA.registerSchema('http://www.example.com/schemas/ipo.xsd',bf5,TRUE, TRUE, FALSE,TRUE,TRUE);
-- dbms_lob.fileclose(bf5);
END;
*3.creatibg table to store xml files*
CREATE TABLE po_tab2 (id NUMBER,xmlcol SYS.XMLType) ;
*4.Inserting xml file into the table and validating that file with xml schema*
declare
aa clob:=' ';
b varchar2(4000);
c xmltype;
begin
dbms_lob.filecloseall;
aa:= GETCLOBDOCUMENT('XML_DATA','example.XML','WE8MSWIN1252');
INSERT INTO po_tab2 (ID, XMLCOL)
VALUES
(104,sys.XMLType.createXML(aa));
commit;
--c:=sys.xmltype.createXml(aa);
c:=xmltype(aa);
b:=VerifyXML(c,'http://www.example.com/schemas/ipo.xsd');
dbms_output.put_line(b);
end;
_5.VerifyXML function is:_
create or replace
function VerifyXML( xml xmltype, xmlSchema varchar2 ) return varchar2 AUTHID DEFINER is
xmlURL varchar2(4000);
begin
select
s.qual_schema_url into xmlURL
from user_xml_schemas s
where s.schema_url = xmlSchema;
if xml.isSchemaValid(xmlURL,'ManageRolloutRegionNotification') =1 then
return( 'Valid. The supplied XML complies with XSD '||xmlURL );
else
-- return null;
return(sqlcode|| 'Failed. The supplied XML does not comply with XSD '||xmlURL );
end if;
exception when others then
return(sqlcode);
end;
_6.PROBLEM:_
the problem is the function is always returning 'Failed ' status even though I am giving the correct file.. Is there any method to find the reason for failure. These codes are working fine oracle 11g. currently i am working in 9i version 9.2.0.1.0. IOracle 9iR2 is not supported anymore.
Oracle 9.2.0.8 is in sustained support.
Oracle 9.2.0.1 is not supported at all.
Upgrade to 11gR2.
Sybrand Bakker
Senior Oracle DBA -
Validate XML against XSD using PLSQL
Hi,
We now need some kind of automated solution that will pick
up the XMLs from a specific location or table and validate them
against the XSD in only Oracle PLSQL.
The validation of the XML against the XSD should take place when the XML is parsed.
I want to know how first the XSD's are stored or registered in the Oracle XDB repository.
Please can anyone suggest me how this can be done with a simple example
with a sample XML and XSD?
Regards,
Marlon.Hi, I'm not an expert but I've been reading a lot and I found this and it works. I'll hope it is useful.(Oracle 10)
declare
-- Local variables here
res BOOLEAN;
tempXML XMLType;
xmlDoc XMLType;
xmlSchema XMLType;
schemaURL varchar2(256) := 'testcase.xsd';
schemaPath varchar2(256) := '/public/testcase.xsd';
begin
dbms_xmlSchema.deleteSchema(schemaURL,4);
-- Test statements here
xmlSchema := xmlType(
'<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="root" xdb:defaultTable="ROOT_TABLE">
<xs:complexType>
<xs:sequence>
<xs:element name="child1"/>
<xs:element name="child2"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
dbms_xmlschema.registerSchema(schemaURL,
xmlSchema , --xdbURIType(schemaPath).getClob(),
TRUE,TRUE,FALSE,TRUE
xmlDoc:=xmltype('<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="' || schemaURL || '"><child1>foo</child1><child2>bar</child2></root>');
dbms_output.put_line(xmlDoc.getStringVal());
xmlDoc.schemaValidate();
END; -
Validate XML against Xml Schema using JDBC (thin_driver)
hi all,
i have a table with a xmltype-column (XmlSchema Support) and i wonna load(and validate) xml-data( as String) in the xmltype-column.
some thing like this :
int count=1;
String SQLTEXT=null;
Statement stmt=null;
ResultSet rs =null;
//while(count<=1000)
try
stmt = connection.createStatement();
rs = stmt.executeQuery("select SEQ_patxmlschema_ID.NEXTVAL from patxmlschema");
if(rs.next())
id =rs.getLong(1);
System.out.println(id);
stmt.close();
stmt=null;
rs.close();
SQLTEXT = "INSERT INTO patxmlschema(id, patID, name, status, patInfo)"+
"VALUES(?,?,?,?,XMLType(?))";
pStmt = connection.prepareStatement(SQLTEXT);
long patID = random.nextInt(30000);
System.out.println("patId: "+ patID);
String name = RandomStringUtils.random(6,true,false);
System.out.println("lastname: "+ name);
String firstname=RandomStringUtils.random(5,true,false);
System.out.println("firstname: "+ firstname);
String status=RandomStringUtils.random(8,true,false);
System.out.println("status: "+ status);
String street=RandomStringUtils.random(6,true,false);
System.out.println("street: "+ street);
String zip=RandomStringUtils.random(5,false,true);
System.out.println("zip: "+ zip);
String city=RandomStringUtils.random(6,true,false);
System.out.println("city: "+ city);
String phone=RandomStringUtils.random(8,false,true);
String email=RandomStringUtils.random(15,true,false);
String state=RandomStringUtils.random(6,true,false);
String country=RandomStringUtils.random(6,true,false);
System.out.println("country: "+ country);
xmldoc=
"<Patient>"+ "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+ "xsi:noNamespaceSchemaLocation='http://olidong.net/patInfo.xsd'>"+
"<Address>"+ "<street>"+street+"</street>"+ "<city>"+city+"</city>"+ "<zip>"+zip+"</zip>"+
"<state>"+state+"</state>"+ "<country>"+country+"</country>"+
"</Address>"+ "<phone>"+phone+"</phone>"+ "<email>"+email+"</email>"+
"</Patient>";
pStmt.setLong(1, id);
pStmt.setLong(2, patID);
pStmt.setString(3, name);
pStmt.setString(4, status);
pStmt.setString(5, xmldoc);
pStmt.executeUpdate();
pStmt.close();
pStmt=null;
count++;
//connection=null;
catch(Exception e){
e.printStackTrace();
can you help me?
Olidonghi Avi,
my xml doc is valid. with the sqlplus the are no problem or error. tryng the same with jddbc(thin driver) i got this error.
i don´t know, may be jdbc don´t support xml schema support insertion.
i got this sample:
DECLARE
doc VARCHAR2(2000) :=
'<schema
targetNamespace="http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd"
xmlns:po="http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<complexType name="PurchaseOrderType">
<sequence>
<element name="PONum" type="decimal"/>
<element name="Company">
<simpleType>
<restriction base="string">
<maxLength value="100"/>
</restriction>
</simpleType>
</element>
<element name="Item" maxOccurs="1000">
<complexType>
<sequence>
<element name="Part">
<simpleType>
<restriction base="string">
<maxLength value="20"/>
</restriction>
</simpleType>
</element>
<element name="Price" type="float"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
<element name="PurchaseOrder" type="po:PurchaseOrderType"/>
</schema>';
BEGIN
DBMS_XMLSCHEMA.registerSchema(
'http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd', doc);
END;
CREATE TABLE mypurchaseorders OF XMLType
XMLSchema "http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd"
ELEMENT "PurchaseOrder"
VARRAY xmldata."Item" STORE AS TABLE item_nested;
INSERT INTO mypurchaseorders
VALUES(
XMLType(
'<PurchaseOrder
xmlns="http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation
= "http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd
http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd">
<PONum>1001</PONum>
<Company>IBM</Company>
<Item>
<Part>DB2 v9 Set</Part>
<Price>2550</Price>
</Item>
<Item>
<Part>8i Doc Set</Part>
<Price>350</Price>
</Item>
</PurchaseOrder>'));
with the sqlplus the are no error
but insert with java jdbc:
SQLTEXT = "INSERT INTO mypurchaseorders VALUES(XMLType(?))";
String xmldoc= "<PurchaseOrder"+
"xmlns='http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd'" +
"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
"xsi:schemaLocation= 'http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd'"+
"'http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd'>"+
"<PONum>1001</PONum>"+
"<Company>IBM</Company>"+
"<Item> "+
"<Part>DB2 v9 Set</Part>"+
"<Price>2550</Price>"+
"</Item>"+
"<Item>"+
"<Part>8i Doc Set</Part>"+
"<Price>350</Price>"+
"</Item>"+
"</PurchaseOrder>";
pStmt.setString(1, xmldoc);
i got this error
java.sql.SQLException: ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00240: element-start tag is not well formed
Error at line 1
ORA-06512: at "SYS.XMLTYPE", line 301
ORA-06512: at line 1
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:213)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:952)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1160)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
at xml_tab.doInsert(xml_tab.java:118)
at xml_tab.main(xml_tab.java:138)
could you help me?
Olidong -
hello
trying to write a unit test that validates some xml we are marshalling against a dtd. here is a snippet of code. The problem is how to specify the dtd against which the xml is to be validated. verification_transaction is our root xml element. when i run this code i get a
malformedurlexception: no protocol: verification.dtd
any ideas?
StringWriter writer = new StringWriter();
// write the doctype declaration
writer.write("<!DOCTYPE verification_transaction SYSTEM \"verification.dtd\">");
// now marshal to the writer
marshaller.marshal(spec, requestType, componentNumber, writer);
InputStream inputStream = new ByteArrayInputStream(writer.getBuffer().toString().getBytes());
Reader reader = new InputStreamReader(inputStream);
// get a sax parser that is validating
TestHandler handler = new TestHandler();
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
SAXParser saxParser = factory.newSAXParser();
try {
saxParser.parse(new InputSource(reader), handler);
fail("Should have thrown exception.");
} catch (RuntimeException e) {
// pass
}Message was edited by:
shrndegruvI needed to do a bunch of things.
1.
URL url = getClass().getResource("/verification.dtd");
StringWriter writer = new StringWriter();
writer.write("<?xml version=\"1.0\"?><!DOCTYPE verification_transaction SYSTEM \"" + url + "\">");and then I had to use a handler which processed the errors (which I got from an online tutorial):
private static class MyErrorHandler extends DefaultHandler {
public void warning(SAXParseException e) throws SAXException {
System.out.println("Warning: ");
printInfo(e);
public void error(SAXParseException e) throws SAXException {
System.out.println("Error: ");
printInfo(e);
throw new SAXException("DTD Validation Error: [" + e.getMessage() + "]");
public void fatalError(SAXParseException e) throws SAXException {
System.out.println("Fatal error: ");
printInfo(e);
private void printInfo(SAXParseException e) {
System.out.println(" Public ID: " + e.getPublicId());
System.out.println(" System ID: " + e.getSystemId());
System.out.println(" Line number: " + e.getLineNumber());
System.out.println(" Column number: " + e.getColumnNumber());
System.out.println(" Message: " + e.getMessage());
} -
Hi,
Our process receives XML files on a daily basis and the files are processed through Java.
If a record in XML fails to validate against the XSD (i.e. schema validation error), the whole file gets rejected. The file gets loaded only after that record is corrected. That is the limitation of Java.
But now we will now be processing the XML files through PL/SQL.
I wanted to know whether the XML can be validated against the XSD record-by-record? Is it possible that only the record that fails to validate is rejected while the remaining records get loaded into the database?
If so, could you please also suggest the correct approach?
Thanks in advance.It should be possible but it will take some work because you only want/need to validate the XML starting from a given node against a XSD. Here's my thoughts on what it should take. I'm not sure what your XSD(s) look like so I'll make the following assumptions:
Assumption:
A XSD exists that can validate a single Customer.
A XSD exists that can validate a single Program.
The XML is syntactically valid to allow being created as a DOMDocument or XMLType
You would need to load the full XML file into a DOMDocument or XMLType, both will work fine for parsing. I would lean towards XMLType as you can use XPaths to pull info from the XML. You will then need to pull out the Programs and Customers from main XML. For each Program/Customer, pull out the individual Program/Customer and validate that against the XSD. If it passes validation, continue processing that Program/Customer. If it fails validation, go on to the next Program/Customer and repeat the process.
As I said, this approach only works if the XML is syntactically valid. If you can't load the file, you can't attempt to load the 99 Programs when the 1 Program is way off. If the XML is only invalid per the schema, then you can process as many Programs/Customers that are individually valid.
Hope this helps. I'm sure other methods exist but this is what I could think of. -
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. "
-
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 -
How to validate XML Schema in DOM?
I've got an XML file and corresponding XSD file.
How do I validate this XML file when using DOM parser?
ThanksYou can use the sun msv API.
This multi schema validator can validate documents against different sorts of Schema.
More info at http://wwws.sun.com/software/xml/developers/multischema/ -
How to validate XML at runtime and show the exact cause of validation failure .
Hi
How can I validate my generated XML at runtine against its schema ? I have used
the validate() method and it does validate correctly against the schema but the
problem is it just returns a boolean . I need to know the exact cause of failure
(like for example The element X was supposed to contain Y,Z etc ). I need to capture
the exact exception (like a Sax Parse exception details).
How do i do that using XMLBeans ??
- BanaHi Bana,
You could use the XmlOptions.setErrorListener(Collection) method to get the detailed error message by invoking validate(option).
Kind Regards,
Jennifer -
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
Maybe you are looking for
-
Data Federator data lineage and impact analysis
Hi, I am looking for the use of data lineage and impact analysis feature in data federator at Universe level. Can I know which objects are using which fields by uisng impact feature in the data federator. Thanks in Advance.
-
How do i transfer music from iTunes on my computer to my iPhone 4S?
how do i transfer music from iTunes on my computer to my iPhone 4S?
-
Reg. Getting Tables name from interbase
Hi, I like to get interbase database table name using a query from JDBC program .I am connecting interbase through interclient driver. Regrads, Vikki
-
i have taken pictures with my camera they are i photo how can i show these in lookbook pdf format, just like presentations, thank you
-
How do I filter the rows in application engine?
Hi Gurus, I have an APP engine which updates the custom table which gets inserted from the combination of 3 different PS tables. If any of the PS table used in select for insertion changes/updates ,I need to update my data of the custom table through