gpt4 book ai didi

org.apache.commons.betwixt.XMLIntrospector类的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 17:47:40 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.commons.betwixt.XMLIntrospector类的一些代码示例,展示了XMLIntrospector类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLIntrospector类的具体详情如下:
包路径:org.apache.commons.betwixt.XMLIntrospector
类名称:XMLIntrospector

XMLIntrospector介绍

暂无

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

public BetwixtModuleDefinitionReader() {
  final URL dtd = getClass().getResource(DTD);
  if (dtd == null) {
    throw new IllegalStateException("DTD not found at " + DTD);
  }
  dtdUrl = dtd.toString();
  final BetwixtBindingStrategy bindingStrategy = new BetwixtBindingStrategy();
  bindingStrategy.registerConverter(Version.class, new VersionConverter());
  beanReader = new BeanReader();
  try {
    beanReader.getXMLIntrospector().getConfiguration().setTypeBindingStrategy(bindingStrategy);
    beanReader.setValidating(true);
    beanReader.setErrorHandler(new ErrorHandler());
    beanReader.registerBeanClass(ModuleDefinition.class);
  } catch (IntrospectionException e) {
    throw new RuntimeException(e); // TODO
  }
}

代码示例来源:origin: org.jumpmind.symmetric/symmetric-ddl

protected BeanWriter getWriter(Writer output) throws DdlUtilsException
{
  try
  {
    BeanWriter writer = new BeanWriter(output);

    writer.getXMLIntrospector().register(getBetwixtMapping());
    writer.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
    writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
    writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
    writer.getBindingConfiguration().setMapIDs(false);
    writer.enablePrettyPrint();

    return writer;
  }
  catch (Exception ex)
  {
    throw new DdlUtilsException(ex);
  }
}

代码示例来源:origin: org.fcrepo/fcrepo-server

public void write(Writer outputWriter) throws IOException {
  outputWriter.write("<?xml version='1.0' ?>\n");
  BeanWriter beanWriter = new BeanWriter(outputWriter);
  beanWriter.getBindingConfiguration().setMapIDs(false);
  beanWriter.setWriteEmptyElements(false);
  beanWriter.enablePrettyPrint();
  try {
    beanWriter.getXMLIntrospector().register(getBetwixtMapping());
    beanWriter.write("users", this);
  } catch (IntrospectionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  beanWriter.flush();
  beanWriter.close();
}

代码示例来源:origin: fcrepo3/fcrepo

public void write(Writer outputWriter) throws IOException {
  outputWriter.write("<?xml version='1.0' ?>\n");
  BeanWriter beanWriter = new BeanWriter(outputWriter);
  beanWriter.getBindingConfiguration().setMapIDs(false);
  beanWriter.setWriteEmptyElements(false);
  beanWriter.enablePrettyPrint();
  try {
    beanWriter.getXMLIntrospector().register(getBetwixtMapping());
    beanWriter.write("users", this);
  } catch (IntrospectionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  beanWriter.flush();
  beanWriter.close();
}

代码示例来源:origin: org.gatein.shindig/shindig-common

StringWriter outputWriter = new StringWriter();
BeanWriter writer = new BeanWriter(outputWriter);
IntrospectionConfiguration configuration = writer.getXMLIntrospector().getConfiguration();
configuration.setAttributesForPrimitives(false);
configuration.setWrapCollectionsInElement(true);

代码示例来源:origin: fcrepo3/fcrepo

public void write(Writer outputWriter) throws IOException {
  //
  NamespacePrefixMapper nspm = new NamespacePrefixMapper();
  nspm.setPrefix(XSI.uri, "xsi");
  nspm.setPrefix("http://java.sun.com/xml/ns/j2ee", "xmlns");
  //
  outputWriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
  BeanWriter beanWriter = new BeanWriter(outputWriter);
  beanWriter.getBindingConfiguration().setMapIDs(false);
  beanWriter.setWriteEmptyElements(false);
  beanWriter.enablePrettyPrint();
  try {
    beanWriter.getXMLIntrospector().register(getBetwixtMapping());
    beanWriter.getXMLIntrospector().getConfiguration()
        .setPrefixMapper(nspm);
    beanWriter.write("web-app", this);
  } catch (IntrospectionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  beanWriter.flush();
  beanWriter.close();
}

代码示例来源:origin: org.gatein.shindig/shindig-common

public String convertToXml(Object obj) {
 StringWriter outputWriter = new StringWriter();
 BeanWriter writer = new BeanWriter(outputWriter);
 IntrospectionConfiguration configuration = writer.getXMLIntrospector().getConfiguration();
 configuration.setAttributesForPrimitives(false);
 configuration.setWrapCollectionsInElement(true);

代码示例来源:origin: org.fcrepo/fcrepo-server

public void write(Writer outputWriter) throws IOException {
  //
  NamespacePrefixMapper nspm = new NamespacePrefixMapper();
  nspm.setPrefix(XSI.uri, "xsi");
  nspm.setPrefix("http://java.sun.com/xml/ns/j2ee", "xmlns");
  //
  outputWriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
  BeanWriter beanWriter = new BeanWriter(outputWriter);
  beanWriter.getBindingConfiguration().setMapIDs(false);
  beanWriter.setWriteEmptyElements(false);
  beanWriter.enablePrettyPrint();
  try {
    beanWriter.getXMLIntrospector().register(getBetwixtMapping());
    beanWriter.getXMLIntrospector().getConfiguration()
        .setPrefixMapper(nspm);
    beanWriter.write("web-app", this);
  } catch (IntrospectionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  beanWriter.flush();
  beanWriter.close();
}

代码示例来源:origin: com.lmco.shindig/shindig-common

StringWriter outputWriter = new StringWriter();
BeanWriter writer = new BeanWriter(outputWriter);
IntrospectionConfiguration configuration = writer.getXMLIntrospector().getConfiguration();
configuration.setAttributesForPrimitives(false);
configuration.setWrapCollectionsInElement(true);

代码示例来源:origin: com.lmco.shindig/shindig-common

public String convertToXml(Object obj) {
 StringWriter outputWriter = new StringWriter();
 BeanWriter writer = new BeanWriter(outputWriter);
 IntrospectionConfiguration configuration = writer.getXMLIntrospector().getConfiguration();
 configuration.setAttributesForPrimitives(false);
 configuration.setWrapCollectionsInElement(true);

代码示例来源:origin: org.fcrepo/fcrepo-server

/**
 * Create an instance of WebXML from the specified file.
 *
 * @param webxml
 *        Path to web.xml file.
 * @return instance of WebXML
 */
public static WebXML getInstance(String webxml) {
  WebXML wx = null;
  BeanReader reader = new BeanReader();
  reader.getXMLIntrospector().getConfiguration()
      .setAttributesForPrimitives(false);
  reader.getBindingConfiguration().setMapIDs(false);
  try {
    reader.registerMultiMapping(getBetwixtMapping());
    wx = (WebXML) reader.parse(new File(webxml).toURI().toString());
  } catch (IntrospectionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return wx;
}

代码示例来源:origin: fcrepo3/fcrepo

/**
 * Create an instance of WebXML from the specified file.
 *
 * @param webxml
 *        Path to web.xml file.
 * @return instance of WebXML
 */
public static WebXML getInstance(String webxml) {
  WebXML wx = null;
  BeanReader reader = new BeanReader();
  reader.getXMLIntrospector().getConfiguration()
      .setAttributesForPrimitives(false);
  reader.getBindingConfiguration().setMapIDs(false);
  try {
    reader.registerMultiMapping(getBetwixtMapping());
    wx = (WebXML) reader.parse(new File(webxml).toURI().toString());
  } catch (IntrospectionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return wx;
}

代码示例来源:origin: org.jumpmind.symmetric/symmetric-ddl

public BeanReader getReader() throws IntrospectionException, SAXException, IOException
{
  BeanReader reader = new BeanReader();
  reader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
  reader.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
  reader.getXMLIntrospector().getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
  reader.setValidating(isValidateXml());
  if (isUseInternalDtd())
  {
    reader.setEntityResolver(new LocalEntityResolver());
  }
  reader.registerMultiMapping(getBetwixtMapping());
  return reader;
}

代码示例来源:origin: org.fcrepo/fcrepo-server

public static FedoraUsers getInstance(URI fedoraUsersXML) {
  FedoraUsers fu = null;
  BeanReader reader = new BeanReader();
  reader.getXMLIntrospector().getConfiguration()
      .setAttributesForPrimitives(false);
  reader.getBindingConfiguration().setMapIDs(false);
  try {
    reader.registerMultiMapping(getBetwixtMapping());
    fu = (FedoraUsers) reader.parse(fedoraUsersXML.toString());
  } catch (IntrospectionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return fu;
}

代码示例来源:origin: fcrepo3/fcrepo

public static FedoraUsers getInstance(URI fedoraUsersXML) {
  FedoraUsers fu = null;
  BeanReader reader = new BeanReader();
  reader.getXMLIntrospector().getConfiguration()
      .setAttributesForPrimitives(false);
  reader.getBindingConfiguration().setMapIDs(false);
  try {
    reader.registerMultiMapping(getBetwixtMapping());
    fu = (FedoraUsers) reader.parse(fedoraUsersXML.toString());
  } catch (IntrospectionException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return fu;
}

代码示例来源:origin: org.sakaiproject.sitestats/sitestats-impl

private static BeanWriter getBeanWriter(final StringWriter outputWriter) {
  BeanWriter beanWriter = new BeanWriter(outputWriter);
  beanWriter.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(false);
  beanWriter.getBindingConfiguration().setMapIDs(false);
  beanWriter.getBindingConfiguration().setValueSuppressionStrategy(new NullEmptyValueSuppressionStrategy());
  beanWriter.getBindingConfiguration().setObjectStringConverter(new SitestatsObjectStringConverter());
  beanWriter.setEndOfLine("");		
  return beanWriter;
}

代码示例来源:origin: org.sakaiproject.sitestats/sitestats-impl

private static BeanReader getBeanReader() throws IntrospectionException {
  BeanReader beanReader = new BeanReader();
  beanReader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(false);
  beanReader.getBindingConfiguration().setMapIDs(false);
  beanReader.getBindingConfiguration().setValueSuppressionStrategy(new NullEmptyValueSuppressionStrategy());
  beanReader.getBindingConfiguration().setObjectStringConverter(new SitestatsObjectStringConverter());
  beanReader.registerBeanClass("List", ArrayList.class);
  beanReader.registerBeanClass("ReportDef", ReportDef.class);
  beanReader.registerBeanClass("ReportParams", ReportParams.class);
  return beanReader;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com