This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!

Roopa Bagur

Ranch Hand
+ Follow
since Nov 03, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Roopa Bagur

ok.. After some reasearch I tried the following out
protected static final String XMLSCHEMA_URI_LOCATION = "file://C:/Projects/xml messaging/bin/XMLSchema.xsd";
Now I don't get the errors I used to get before but looks like the XMLSchema.xsd has problems.. BTW I had to remove the DOCType from the schema not validate against a DTD.
And also I had to copy xml.xsd locally ...& I point to it in the same URL format I have above..

My current errors..
[Error] XMLSchema.xsd:26:124: s4s-att-invalid-value: Invalid attribute value for 'schemaLocation' in element 'import': c
vc-datatype-valid.1.2.1.
[Error] XMLSchema.xsd:163:36: src-resolve: Cannot resolve the name 'xml:lang' to a(n) attribute declaration component.
[Error] XMLSchema.xsd:163:36: src-ct.0.1: Complex Type Definition Representation Error for type '#AnonType_schema'. Ele
ment 'attribute' is invalid, misplaced, or occurs too often.
[Error] XMLSchema.xsd:1178:34: src-ct.0.1: Complex Type Definition Representation Error for type '#AnonType_documentatio
n'. Element 'attribute' is invalid, misplaced, or occurs too often.

Originally posted by Beno�t d'Oncieu:
OK, for this one, you'll have to find it by yourself ;-)
The exception say: MalformedURLException
You have to write the location of the XML Schema as a URL (hint: the protocol is file).
Good luck

I am using the following path for the schemaURILocation & I get an error...I have the schema file in this location but still an error.. Am I doing something wrong with the path?
protected static final String XMLSCHEMA_URI_LOCATION = "c:\\projects\\xml messaging\\bin\\XMLSchema.xsd";

[Error] :-1:-1: schema_reference.4: Failed to read schema document 'c:\projects\xml messaging\bin\XMLSchema.xsd', becaus
e 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:sch
ema>.
**********input file abs path:C:\Projects\B2B Client\Shared\Reports\bin\ReportsTypes.xsd
java.net.MalformedURLException: unknown protocol: c
at java.net.URL.<init>(URL.java:586)
at java.net.URL.<init>(URL.java:476)
at java.net.URL.<init>(URL.java:425)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDocumentEntity(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.setInputSource(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at com.fifththird.b2b.messaging.compiler.MessageCompiler.validateSchema(MessageCompiler.java:693)
at com.fifththird.b2b.messaging.compiler.MessageCompilerFrame.butCompileActionPerformed(MessageCompilerFrame.jav

Originally posted by Beno�t d'Oncieu:
You may be using a transparent proxy, i.e. no direct access to the web resource. In that case, I suggest you store the XMLSchema locally and then replace the line:

by:

Other than that, the following line shows a package that does not exist in Xerces 2.2.1:

This shouldn't be the cause of your problem, but if you absolutely need to use version 2.2.1, try to see if there is no version conflict between you jar files.
Cheers

Guess what... I am using the exact same code & I get the following error..There is no meta element in my schema or in the w3c schema.......... I am sorry to keep bugging you & I really appreciate your patience ....
[Error] XMLSchema.xsd:6:20: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than x
s:appinfo and xs ocumentation. Saw 'web_redirect'.
[Fatal Error] XMLSchema.xsd:8:3: The element type "meta" must be terminated by the matching end-tag "</meta>".
::http://www.w3.org/2001/XMLSchema.xsd:http://www.w3.org/2001/XMLSchema.xsd:http://www.w3.org/2001/XMLSchema.xsd:8:3:The
element type "meta" must be terminated by the matching end-tag "</meta>".
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(Unknown Source)
at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.getSchema(Unknown Source)
at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
at org.apache.xerces.parsers.XMLGrammarPreparser.preparseGrammar(Unknown Source)
at com.fifththird.b2b.messaging.compiler.MessageCompiler.<init>(MessageCompiler.java:343)
at com.fifththird.b2b.messaging.compiler.MessageCompilerFrame.butCompileActionPerformed(MessageCompilerFrame.jav
a:470)

Originally posted by Beno�t d'Oncieu:
Hi Ropa,
Here is the result of the validation of your XML Schema:

I had to change a bit the code to adapt it to schema validation (as opposed to WSDL validation). Here it goes:

Cheers

Can u validate the following schema against W3C schema(http://www.w3.org/2001/XMLSchema.xsd).I used Xerces SAX parser & am still stepping into problems..
Here is my schema file:
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.53.com/b2b/reports"
xmlns="http://www.53.com/b2b/reports"
xmlns:b2b="http://www.53.com/b2b/messaging">
<xsd:complexType name="GetReportMetaDataRequest">
<xsd:annotation>
<xsd ocumentation>A GetReportMetaDataRequest contains the request for a message to
get the meta-data for series of reports.</xsd ocumentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="reportCode" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd ocumentation>The report codes of the reports whose meta-data are being requested. If no
report codes are specified, the meta-data for all reports will be returned.</xsd ocumentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:element>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="12"/>
</xsd:restriction>
</xsd:element>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Thanks a lot,
Roopa

Originally posted by Beno�t d'Oncieu:
Balaji,
Nice link, however, most ideas from the article can only be applied when using Microsoft .NET
Thanks

awsome...Thanks
BTW are u using Xerces 2.2.1. Have u tried using this parser to validate xml schemas too?
Thanks,
Roopa

Originally posted by Beno�t d'Oncieu:
I think I have it right now. Look at the main method to see how to use it. It's really a first attempt (using Xerces), but it still needs improving.
If your wsdl is using more namespaces, you can register them using the registerNamespace method before calling the validateSchema.
I also removed the verbose stuff for the ErrorHandler for the sake of simplicity

Do I have to change the code to the following to validate an WSDL file?
static final String WSDL_SOURCE =
"http://schemas.xmlsoap.org/wsdl/";
saxParser.setProperty(WSDL_SOURCE, new File("c:/projects/WSDLSchema.xsd"));

I did make the above change & the exception I get is
org.xml.sax.SAXNotRecognizedException: http://schemas.xmlsoap.org/wsdl/

Originally posted by Beno�t d'Oncieu:
Hi again Roopa,
By using the same code you submitted earlier
The schema location is:
http://schemas.xmlsoap.org/wsdl/
Hope this helps
[ December 16, 2002: Message edited by: Beno�t d'Oncieu ]

Thanks a lot again Beno�t d'Oncieu. I appreciate ur quick & very helpful responses.
Roopa

Originally posted by Beno�t d'Oncieu:
Hi again Roopa,
By using the same code you submitted earlier
The schema location is:
http://schemas.xmlsoap.org/wsdl/
Hope this helps
[ December 16, 2002: Message edited by: Beno�t d'Oncieu ]

Can anybody tell me whether one can validate an WSDL file..if so where can I find the WSDL schema that I can use for validation & also please suggest any good WSDL websites I could go to.
Thanks,
Roopa
Guys I really need ur help here..
I am trying to validate a schema file using JAXP1.2.. Here is my code .. I have no clue why I get this error
Schema_reference 4: Failed to read schema document 'null'

//constants
static String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static String W3C_XML_SCHEMA =
"http://www.w3.org/2001/XMLSchema";
static final String JAXP_SCHEMA_SOURCE =
"http://java.sun.com/xml/jaxp/properties/schemaSource";

try
{
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);
SAXParser saxParser = spf.newSAXParser();
try
{
saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
}
catch (SAXNotRecognizedException x)
{
throw new RuntimeException( "Parser doesn't support XML Schema. "+x.getMessage());
}
saxParser.setProperty(JAXP_SCHEMA_SOURCE, new File("c:\\projects\\xml Mssaging\\bin\\XMLSchema.xsd"));
// Validate
XMLReader xmlReader = saxParser.getXMLReader();
errorChecker = new ErrorChecker( verboseErrors );
xmlReader.setErrorHandler( errorChecker );

// Validate
xmlReader.parse(new InputSource(new FileReader(inputFile)));

// If error happened
if ( errorChecker.errorHappened )
{
isValid = false;
// Suggest "verboseerrors" att if not on
if ( ! verboseErrors )
{
System.out.println( "Error. Set SchemaValidate's 'verbose errors' attribute to true for a more detailed description on warnings.");
}
}
}
catch (IOException e)
{
isValid = false;
System.err.println("Error: IO Exception.");
e.printStackTrace();
}
catch (SAXException e)
{
isValid = false;
System.err.println("Error: SAXException.");
e.printStackTrace();
}
catch (ParserConfigurationException e)
{
isValid = false;
System.err.println("Error: ParserConfigurationException.");
e.printStackTrace();
}

I would really appreciate any help...This thing has been bugging me for a few days now..
Thanks,
Roopa
I have problems validating schema using JAXP1.2..
I think I am not doing something right..Here is my code..
//constants
static String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static String W3C_XML_SCHEMA =
"http://www.w3.org/2001/XMLSchema";
static final String JAXP_SCHEMA_SOURCE =
"http://java.sun.com/xml/jaxp/properties/schemaSource";

try
{
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);

SAXParser saxParser = spf.newSAXParser();
try
{
saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
}
catch (SAXNotRecognizedException x)
{
throw new RuntimeException( "Parser doesn't support XML Schema. "+x.getMessage());
}
saxParser.setProperty(JAXP_SCHEMA_SOURCE, new File("c:\\projects\\xml messaging\\bin\\XMLSchema.xsd"));
// Validate
XMLReader xmlReader = saxParser.getXMLReader();
errorChecker = new ErrorChecker( verboseErrors );
xmlReader.setErrorHandler( errorChecker );


// Validate
xmlReader.parse(new InputSource(new FileReader(inputFile)));


// If error happened
if ( errorChecker.errorHappened )
{
isValid = false;

// Suggest "verboseerrors" att if not on
if ( ! verboseErrors )
{
System.out.println( "Error. Set SchemaValidate's 'verbose errors' attribute to true for a more detailed description on warnings.");
}

}

}
catch (IOException e)
{
isValid = false;
System.err.println("Error: IO Exception.");
e.printStackTrace();
}
catch (SAXException e)
{
isValid = false;
System.err.println("Error: SAXException.");
e.printStackTrace();
}
catch (ParserConfigurationException e)
{
isValid = false;
System.err.println("Error: ParserConfigurationException.");
e.printStackTrace();
}


DO I have to implement the EntityResolver interface.. If so why?
Thanks,
Roopa
I fixed the problem... The reason for the error message was I had a copy of JRE in my programFiles folder which did not have the endorsed directory...

DO you know of any website that has some common schema validation error messages & their resolutions?.. 'coz now I am stepping into some validations errors which I'll have to fix.
Thanks & I appreciate ur help,
Roopa

Originally posted by Beno�t d'Oncieu:
Roopa,
Could you change the following lines:

by:

and give us the exact exception that was thrown.
Cheers

I am using the sax parser that comes with JAXP1.2..I have put all the 1.2 jars into JAVA_HOME\lib\endorsed directory...which is supposed to over ride other default versions of the jars.

Originally posted by Beno�t d'Oncieu:
Hi Roopa,
Could you tell us which parser you are using and which version? Is it the one that comes by default with the 1.4 SDK or you are specifying another one?
Actually, you may use the Xerces parser which is JAXP1.2 compliant.
Cheers
[ December 05, 2002: Message edited by: Beno�t d'Oncieu ]

Originally posted by Barry Brashear:
Can anyone tell me the necessary jar files to run SAX particularly the saxParser?
Thanks.


The parsers are in the JDK..look in the lib directory for sax.jar & dom.jar.
I am using JAXP1.2 for validating my schema file..inspite of following all installation instructions I still get the following message during parsing
"Parser doesn't support XMLSchema"
Here is my code
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);

SAXParser saxParser = spf.newSAXParser();
try
{

saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
}
catch (SAXNotRecognizedException x)
{
throw new RuntimeException( "Parser doesn't support XML Schema. " );
System.exit(1);
}
saxParser.setProperty(JAXP_SCHEMA_SOURCE, inputFile);
// Validate
XMLReader xmlReader = saxParser.getXMLReader();
ErrorChecker errorChecker = new ErrorChecker( verboseErrors );
xmlReader.setErrorHandler( errorChecker );
// Validate
xmlReader.parse( new InputSource(inputFile ) );
I appreciate any help..
Thanks
Roopa
Hi Everybody,
I am working on an application with JSP's which has images for tabs for the main menu.Here is the requirement.
Requirement:When you click on the tab which is an image the image changes & calls a jsp
I was wondering what was the best way to implement this requirement.
I would appreciate a quick response..
Thanks,
Roopa
16 years ago
JSP