  | |  | Xerces and Schema Validation | Xerces and Schema Validation 2003-08-25 - By Jay Garala
Hi folks, I was wondering if there is a way to do schema validation on an XML that does not have the
"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" <http://www.myurl.com/my#> http://www.myurl.com/my# C:\Tomcat\webapps\myapp\xml\myschema.xsd"
in the root element. I am having really bad problems combining multiple XML documents with different schemas and namescapes. I want this so.. i can manually invoke the validator (can I?) <myDoc> <ele1>3</ele1> <ele2>a</ele2> <ele3>df3</ele3> </myDoc> myschema.... Then in a java app... myValidator.validate(myXML, mySchema) Is this possible? Or are there any other suggestions or workarounds? Thanks a bunch, Jay
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1226" name=GENERATOR></HEAD> <BODY> <DIV><FONT face=Arial size=2><SPAN class=589561623-25082003>Hi folks,</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=589561623-25082003></SPAN></FONT> </DIV> <DIV><FONT><SPAN class=589561623-25082003><FONT face=Arial size=2> I was wondering if there is a way to do schema validation on an XML that does not have the </FONT> <P><FONT size=2><FONT face=Arial><FONT color=#ff0000><SPAN class=589561623-25082003>"</SPAN>xmlns:xsi</FONT></FONT><FONT face=Arial><FONT color=#0000ff>="</FONT>http://www.w3.org/2001/XMLSchema-instance<FONT color=#0000ff>"</FONT><FONT color=#ff0000> xsi:schemaLocation</FONT><FONT color=#0000ff>="</FONT></FONT></FONT><A href="http://www.myurl.com/my#"><FONT face=Arial size=2>http://www.<SPAN class=589561623-25082003>myurl</SPAN>.com/<SPAN class=589561623-25082003>my</SPAN>#</FONT></A><FONT face=Arial><FONT size=2><SPAN class=589561623-25082003> </SPAN>C:\Tomcat\webapps\<SPAN class=589561623-25082003>myapp</SPAN>\xml\<SPAN class=589561623-25082003>myschema</SPAN>.xsd<FONT color=#0000ff>"</FONT></FONT></FONT></P></DIV> <DIV><FONT face=Arial><FONT size=2><FONT face=Arial><FONT size=2><FONT color=#0000ff></FONT></FONT></FONT></FONT></FONT> </DIV> <DIV><FONT><FONT color=#0000ff><SPAN class=589561623-25082003><FONT face=Arial color=#000000 size=2>in the root element.</FONT></SPAN></FONT></FONT></DIV> <DIV><FONT><FONT color=#0000ff><SPAN class=589561623-25082003><FONT face=Arial color=#000000 size=2></FONT></SPAN></FONT></FONT> </DIV> <DIV><FONT><FONT color=#0000ff><SPAN class=589561623-25082003><FONT face=Arial color=#000000 size=2>I am having really bad problems combining multiple XML documents with different schemas and namescapes. </FONT></SPAN></FONT></FONT></DIV> <DIV><FONT><FONT color=#0000ff><SPAN class=589561623-25082003><FONT face=Arial color=#000000 size=2></FONT></SPAN></FONT></FONT> </DIV> <DIV><FONT><FONT color=#0000ff><SPAN class=589561623-25082003><FONT face=Arial color=#000000 size=2>I want this so.. i can manually invoke the validator (can I?)</FONT></SPAN></FONT></FONT></DIV> <DIV><FONT><FONT color=#0000ff><SPAN class=589561623-25082003><FONT face=Arial color=#000000 size=2></FONT></SPAN></FONT></FONT> </DIV> <DIV><FONT><FONT color=#0000ff><SPAN class=589561623-25082003><FONT face=Arial color=#000000 size=2><myDoc></FONT></SPAN></FONT></FONT></DIV> <DIV><FONT><FONT><SPAN class=589561623-25082003></SPAN></FONT></FONT><FONT> <FONT color=#0000ff><SPAN class=589561623-25082003><FONT face=Arial color=#000000 size=2> <ele1>3</ele1></FONT></SPAN></DIV> <DIV></FONT><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003> <ele2>a</ele2></SPAN></FONT></DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003> <ele3>df3</ele3></SPAN></FONT></DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003></myDoc></SPAN></FONT></DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003><EM>myschema....</EM></SPAN></FONT></DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003>Then in a java app...</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003> </SPAN></FONT></DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003> myValidator.validate(myXML, mySchema)</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003>Is this possible? Or are there any other suggestions or workarounds?</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003 >Thanks a bunch,</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#000000 size=2><SPAN class=589561623-25082003>Jay</SPAN></FONT></FONT></SPAN></FONT></DIV></BODY>< /HTML>
|
|
 |