Hi,
Previously I had not set default schema.I am using example for version 4.4.So
now I have set it for Releases.R4_4.But now getting following error:
errororg.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference
a node in a context where it does not exist.
Exception in thread "main" org.w3c.dom.DOMException: NOT_FOUND_ERR:
An attempt is made to reference a node in a context where it does not exist.
Hi,
I have sent you mail.
Only concern is I am trying to get Document instance constructed from xml
document by using method:
parse(file,errorhandler) which should return dom document.
But getting error:
errororg.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference
a node in a context where it does not exist.
Regards,
Aswad
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have downloaded java 1.2 alpha version of handcoded.While parsing fpml
message I am getting following error.
Error message:
cvc-elt.4.2: Cannot resolve 'DataDocument' to a type definition for element
'FpML'.
Code:
args = new String;
args= "src/com/fpml/valid-cd-3-01.xml";
ParserErrorHandler parserErrorHandler = new ParserErrorHandler(null);
ValidationErrorHandler validationErrorHandler = new
ValidationErrorHandler(null);
RuleSet rs = FpMLRules.getRules();
boolean parseAndValidate =false;
parseAndValidate = FpMLUtility.parseAndValidate(new
File(args),rs,parserErrorHandler,validationErrorHandler);
Help would be highly appreciated.
Regards,
Aswad
Have you initialised the toolkit and activated the version of the FpML schema
that your application expects? For example:
// Initialise the default catalog
String catalogPath = "files/catalog-fpml.xml";
try {
XmlUtility.setDefaultCatalog (CatalogManager.find (catalogPath));
}
catch (SAXException error) {
logger.severe ("Failed to parse XML catalog");
System.exit (1);
}
// Activate the FpML Schemas
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_0);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_1);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_2);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_3);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_4);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_5);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_6);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_7);
Hi,
Previously I had not set default schema.I am using example for version 4.4.So
now I have set it for Releases.R4_4.But now getting following error:
errororg.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference
a node in a context where it does not exist.
Exception in thread "main" org.w3c.dom.DOMException: NOT_FOUND_ERR:
An attempt is made to reference a node in a context where it does not exist.
Complete Source code is as follows:
package com.fpml;
import java.util.logging.Logger;
import com.handcoded.fpml.Releases;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.ErrorHandler.*;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.w3c.dom.Document;
import sun.security.validator.ValidatorException;
import sun.tools.jar.resources.jar;
//import edu.umd.cs.findbugs.BugCollection;
import java.io.File;
import java.io.FileNotFoundException;
import java.lang.reflect.Method;
import java.util.;
import java.lang.reflect.Constructor;
import javax.annotation.processing.FilerException;
import javax.management.JMRuntimeException;
import javax.naming.spi.ObjectFactory;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.ValidationException;
import javax.xml.;
import com.handcoded.fpml.FpMLUtility;
import com.handcoded.fpml.validation.*;
import com.handcoded.validation.RuleSet;
import com.handcoded.validation.ValidationError;
import com.handcoded.validation.ValidationErrorHandler;
import com.handcoded.xml.XPath;
import com.handcoded.xml.XmlUtility;
import com.handcoded.xml.resolver.CatalogManager;
import com.sun.org.apache.bcel.internal.generic.ConversionInstruction;
import com.sun.xml.internal.bind.v2.util.FatalAdapter;
import demo.com.handcoded.fpml.ContractValidate;
import demo.com.handcoded.fpml.Validate;
//import demo.com.handcoded.fpml.ContractValidate.ParserErrorHandler;
public class FPMLTOXML{
private static class ValidationErrorHandler
implements com.handcoded.validation.ValidationErrorHandler
{
public void error(String code, Node context, String description, String
ruleName, String additionalData)
{
if(additionalData != null)
{
System.err.println(ruleName + " " + XPath.forNode(context) + "
" + description + " ");
} else
{
System.err.println(ruleName + " " + XPath.forNode(context) + "
" + description);
}
}
private ValidationErrorHandler()
{
}
ValidationErrorHandler(ValidationErrorHandler validationerrorhandler)
{
this();
}
}
private static class ParserErrorHandler
implements ErrorHandler
{
public void warning(SAXParseException error)
{
System.err.println(error.getMessage());
}
public void error(SAXParseException error)
{//System.out.println("line "+);
System.err.println(error.getMessage());
}
public void fatalError(SAXParseException error)
{
System.err.println(error.getMessage());
}
private ParserErrorHandler()
{
}
ParserErrorHandler(ParserErrorHandler parsererrorhandler)
{
this();
}
}
public static void main(String args)
{
args = new String;
args= "src/com/fpml/valid-cd-11-01.xml";
String catalogPath = "src/com/fpml/files/catalog.xml";
try {
XmlUtility.setDefaultCatalog (CatalogManager.find (catalogPath));
}
catch (SAXException error) {
System.out.println("error"+ error);
System.exit (1);
}
// Activate the FpML Schemas
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_0);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_1);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_2);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_3);
XmlUtility.getDefaultSchemaSet ().add (Releases.R4_4);
ParserErrorHandler parserErrorHandler = new ParserErrorHandler(null);
ValidationErrorHandler validationErrorHandler = new
ValidationErrorHandler(null);
RuleSet rs = FpMLRules.getRules();
boolean parseAndValidate =false;
try{
parseAndValidate = FpMLUtility.parseAndValidate(new
File(args),rs,parserErrorHandler,validationErrorHandler);
System.out.println("parseAndValidate "+ parseAndValidate);
Document doc = FpMLUtility.parse(new File(args),parserErrorHandler);
System.out.println("doc "+doc.getLocalName());
}
catch(Exception error)
{
System.out.println("error"+ error);
}
String f ="src/com/fpml/invalid-cd-13-01.xml";
boolean invalid = FpMLUtility.parseAndValidate(new File(f),
rs,parserErrorHandler,validationErrorHandler);
System.out.println("invalid "+ invalid);
}
}
Regards,
Aswad
Can you mail me a copy of the log output to andrew@handcoded.com. I think part
of your configuration could be wrong.
Hi,
I have sent you mail.
Only concern is I am trying to get Document instance constructed from xml
document by using method:
parse(file,errorhandler) which should return dom document.
But getting error:
errororg.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference
a node in a context where it does not exist.
Regards,
Aswad
Hi,
I could validate and parse successfully.But now I need to convert fpml message
into normal xml.