anish reddy

Ranch Hand
+ Follow
since Apr 19, 2008
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 anish reddy

i developed this component some year back.


i am not able to post the source code i developed .
if you want can you post your email id i will send to that.

Hi All,

Can any one tell popular open source spell checker ,so that it can be used in java.


regards
anish
8 years ago
in gwt can any one give tips/ideas to validate ascii and prevent non ascii
8 years ago
GWT
Hi

Can any one give idea/ tips/code to validate sgml against DTD.


regards
anish
i want to call in html ,i am using java 1.6.is it possible to call in scriplet of html
can any one give information on how to call java method in java script and return type from that method should be setted as title for the html.
code snippets do that.
Hi

I am using GWT com.extjs.gxt.ui.client.widget.form.TimeField for display of time in a day.I have to select a time of a day to get record based on it.
For the first time the display is correct.But once after selecting time from next time onwards it is displaying scrollable time with only one item.

Which to seems to be a problem.

Could any one give any ideas to resolve it.

I am sending screen shot as an attachment doc.

regards
anish

8 years ago
GWT
can any one provide info on spring schedulers and examples on it
9 years ago

anish reddy wrote:example code to validate xml which has inline schema.

jaxp code to validate inline schema in an xml.

i pass only xml file name.

xml containing schema.

please anyone give inputs/ideas code snippets to resolve this issue.

example code to validate xml which has inline schema.

jaxp code to validate inline schema in an xml.

i pass only xml file name.

please anyone give inputs/ideas code snippets to resolve this issue.
hi

i want to validate xml by using external dtd.

i pass xml file
and dtd filename as input parameters which are in a system.

now i want to validate xml.

please can any one give inputs/ideas to do this.

thanks in advance
can any one help me to validate xml doc using external dtd.

please give ideas/inputs to do that.
i am developing xml business component which validates xml according to schema/dtd.

Here is my code which does validation.


/**
* create a Stream source for all schemas
*
* @param pSchema
* @return StreamSource[]
*/
public StreamSource[] getStreamSource(String... pSchema) {
StreamSource[] lstStreamSource = new StreamSource[pSchema.length];
for (int i = 0; i < pSchema.length; i++) {
StreamSource lStreamSource = new StreamSource(pSchema[i]);
lstStreamSource[i] = lStreamSource;
}

return lstStreamSource;
}

/**
* Validating xml doc with their schema
*
* @param pFileXmlOne
* @param pFileXmlTwo
* @param pValidate
* @param pSchemaNameOne
* @param pSchemaTwo
* @return boolean
*/
public boolean performValidation(String pFileXmlOne, String... pSchemaNames)
throws Exception {

logger.log(Level.INFO, "in performValidation");


SchemaFactory factory = SchemaFactory
.newInstance("http://www.w3.org/2001/XMLSchema";);

Source[] lStreamSources = null;

Schema schema = null;

Validator lValidator = null;

Source lSource = new StreamSource(pFileXmlOne);

// split schema string by delimiter

lStreamSources = getStreamSource(pSchemaNames);
logger.log(Level.INFO, myClassName + "total no of schemas"
+ lStreamSources.length);
try {
schema = factory.newSchema(lStreamSources);
} catch (SAXException e) {
// TODO Auto-generated catch block
logger.log(Level.INFO, myClassName
+ "sax exception in creating schema" + e.getMessage());
throw new SAXException(e.getMessage());
}
logger.log(Level.INFO, myClassName
+ " before creating validator object");
lValidator = schema.newValidator();
logger
.log(Level.INFO, myClassName
+ " after creating validator object");
try {
logger.log(Level.INFO, myClassName
+ " before performing validation");
lValidator.validate(lSource);
lValidator.setErrorHandler(new SimpleErrorHandler());

logger
.log(Level.INFO, myClassName
+ " after performing validation");
}
catch (SAXException e) {
// TODO Auto-generated catch block
logger.log(Level.INFO, myClassName + " sax exception"
+ e.getMessage());
throw new CAFException(e.getMessage());
} catch (IOException e) {
logger.log(Level.INFO, myClassName + " IOException"
+ e.getMessage());
throw new IOException(e.getMessage());
}
catch(Exception e)
{
throw new Exception("xml do not contain xsd,dtd|| xml is not following dtd or xsd");
}

return true;
//------------------------------------------------------------------------------------------------------------------------





}

i am able to validate when i pass xml and the schema used in the xml.

if xml satisfies schema then i return true.
else iam throwing exception concerned to violation.

It is working fine ,but my problem is suppose i pass xml and the schema that is not used in the xml.

At that situation it is still validating according to schema and i am throwing exception of violation

But i should get output as schema not found.

please give your inputs/ideas to resolve this issue.

Thanks in advance.
i am validating an xml according to schema present in it. i pass xml and schema to the


public boolean validation(String pFileXmlOne, String... pSchemaNames)throws SAXException,IOException ,Exception
{
SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
Source[] lStreamSources = null;
Schema schema = null;
Validator validator = null;
Source source = new StreamSource(pFileXmlOne);
try {
lStreamSources = getStreamSource(pSchemaNames);
schema = factory.newSchema(lStreamSources);
validator = schema.newValidator();
validator.validate(source);
} catch (SAXException e) {
throw new SAXException(e.getMessage());
} catch (IOException e) {
throw new IOException(e.getMessage());
} catch (Exception e) {
throw new Exception(e.getMessage());
}

return true;
}


i am able to validate xml according to schema i pass.

but when i pass xml and schema not in xml.still it is validating instead of exception that schema could not be found.

can any one give inputs/ideas to get schema/dtd name of an xml dynamically.so that i can compare with schema name i pass and do validation accordingly if matches.