[英]Does anyone know how to add a value to org.w3c.dom.Element to instantiate both MiningSchema and SupportVectorMachineModel?
I have a github repo here that has all of my code in it. 我在这里有一个github仓库,里面有我所有的代码。 The snippet that gives me a null pointer is in Model, nullpointer at Model:32. 为我提供空指针的代码段在Model中,在Model:32处为nullpointer。 I'm still not completely sure what to do here. 我仍然不太确定该怎么做。 I have everything else ready to work, this is the one thing giving me an issue. 我已经准备好其他所有工作,这是给我一个问题的一件事。 The code snippet is as follows: 代码片段如下:
private SupportVectorMachine svm = new SupportVectorMachine();
private SupportVectors supportVectors = new SupportVectors();
private SupportVectorMachineModel svmModel;
private MiningSchema schema;
private ClassLoader loader = new ClassLoader();
private Element element;
public void create(Instances instances) throws IOException, SAXException
{
assert instances!=null;
DocumentBuilder builder = null;
element = (Element) builder.parse(instances.toString());
try
{
schema = new MiningSchema(element, instances, schema.getTransformationDictionary());
svmModel = new SupportVectorMachineModel(element, instances, schema);
} catch (Exception e)
{
e.printStackTrace();
}
}
private Element element;
Document doc;
public void create(Instances instances) throws IOException, SAXException, ParserConfigurationException {
assert instances!=null;
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();
assert builder != null;
doc = builder.parse(instances.toString());
element = (Element) doc;
I created a new Document from the instances, then cast it to an element. 我从实例创建了一个新Document,然后将其转换为一个元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.