本文整理了Java中nu.xom.Builder.<init>()
方法的一些代码示例,展示了Builder.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Builder.<init>()
方法的具体详情如下:
包路径:nu.xom.Builder
类名称:Builder
方法名:<init>
暂无
代码示例来源:origin: com.thoughtworks.xstream/xstream
/**
* Create the Builder instance.
*
* A XOM builder is a wrapper around a {@link org.xml.sax.XMLReader}
* instance which is not thread-safe by definition. Therefore each reader
* should use its own builder instance to avoid concurrency problems.
*
* Overload this method to configure the generated builder instances e.g.
* to activate validation.
*
* @return the new builder
* @since 1.4.9
*/
protected Builder createBuilder() {
final Builder builder = getBuilder();
return builder != null ? builder : new Builder();
}
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
public void init() throws ServletException {
pipeline = new StanfordCoreNLP();
String xslPath = getServletContext().
getRealPath("/WEB-INF/data/CoreNLP-to-HTML.xsl");
try {
Builder builder = new Builder();
Document stylesheet = builder.build(new File(xslPath));
corenlpTransformer = new XSLTransform(stylesheet);
} catch (Exception e) {
throw new ServletException(e);
}
}
代码示例来源:origin: stackoverflow.com
Builder builder = new Builder(this);
final EditText input = new EditText(this);
builder
.setTitle(R.string.dialog_title_addsubject)
.setMessage(R.string.dialog_addsubject)
.setView(input)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String value = input.getText().toString();
if (input.getText().toString().trim().length() == 0) {
Toast.makeText(Main.this, R.string.input_empty, Toast.LENGTH_SHORT).show();
} else {
db.insertSubject(value);
getData();
}
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(input.getWindowToken(), 0);
}
})
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(input.getWindowToken(), 0);
}
});
builder.show();
input.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
代码示例来源:origin: AxonFramework/AxonFramework
@Override
public Document convert(InputStream original) {
try {
return new Builder().build(new InputStreamReader(original));
} catch (ParsingException | IOException e) {
throw new CannotConvertBetweenTypesException("Cannot convert from InputStream to XOM Document.", e);
}
}
}
代码示例来源:origin: wiztools/rest-client
protected Document getDocumentFromFile(final File f)
throws IOException, XMLException {
try {
Builder parser = new Builder();
Document doc = parser.build(f);
return doc;
}
catch (ParsingException | IOException ex) {
throw new XMLException(ex.getMessage(), ex);
}
}
代码示例来源:origin: wiztools/rest-client
@Deprecated
public static String indentXML(final String in)
throws XMLException, IOException {
try {
Builder parser = new Builder();
Document doc = parser.build(in, null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Serializer serializer = new Serializer(baos);
serializer.setIndent(4);
serializer.setMaxLength(69);
serializer.write(doc);
return new String(baos.toByteArray());
} catch (ParsingException ex) {
// LOG.log(Level.SEVERE, null, ex);
throw new XMLException("XML indentation failed.", ex);
}
}
}
代码示例来源:origin: jaxen/jaxen
public Object getDocument(String s) throws FunctionCallException {
try {
return new Builder(new NodeFactory()).build(s);
} catch (Exception pe) {
throw new FunctionCallException(pe);
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
private static Annotation toAnnotation(String xml) throws IOException {
Element docElem;
try {
Builder parser = new Builder();
StringReader in = new StringReader(xml);
docElem = parser.build(in).getRootElement();
代码示例来源:origin: stackoverflow.com
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
...
XMLReader xmlreader = XMLReaderFactory.createXMLReader();
xmlreader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
Builder builder = new Builder(xmlreader);
代码示例来源:origin: stackoverflow.com
Builder builder = new Builder(this);
builder.setTitle("foo");
代码示例来源:origin: stackoverflow.com
import nu.xom.*;
import java.io.*;
[...]
public static String format(String xml) throws ParsingException, IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
Serializer serializer = new Serializer(out);
serializer.setIndent(4); // or whatever you like
serializer.write(new Builder().build(xml, ""));
return out.toString("UTF-8");
}
代码示例来源:origin: stackoverflow.com
import nu.xom.Builder;
import nu.xom.Document;
import java.io.File;
[...]
File file = new File("some/path");
Document document = new Builder().build(file);
代码示例来源:origin: stackoverflow.com
//measured as 223 pixels on Nexus 5, which has xxhdpi, so divide by 3
final float oneDegreeInPixels = convertDpToPixels( 223.0f / 3.0f);
final float mapViewCenter = mapViewHeight / 2.0f;
final float bottomViewHeight = ...;
final float posToFocusInPixelsFromTop = (mapViewHeight - bottomViewHeight) / 2.0f ;// can optionally add the height of the view on the top area
final float deltaLatDegreesToMove = (mapViewCenter - posToFocusInPixelsFromTop) / oneDegreeInPixels;
LatLng posToFocusOn = new LatLng(latitude - deltaLatDegreesToMove, longitude);
final CameraUpdate cameraPosition = CameraUpdateFactory.newCameraPosition(new Builder().target(posToFocusOn).zoom(neededZoom).build());
代码示例来源:origin: x-stream/xstream
/**
* Create the Builder instance. A XOM builder is a wrapper around a {@link org.xml.sax.XMLReader} instance which is
* not thread-safe by definition. Therefore each reader should use its own builder instance to avoid concurrency
* problems. Overload this method to configure the generated builder instances e.g. to activate validation.
*
* @return the new builder
* @since 1.4.9
*/
protected Builder createBuilder() {
final Builder builder = getBuilder();
return builder != null ? builder : new Builder();
}
代码示例来源:origin: stackoverflow.com
import nu.xom.*;
[...]
Builder builder = new Builder();
Document alertDoc = builder.build(new File("src/xomtest", "alertset.xml"));
Document weatherDoc = builder.build(new File("src/xomtest", "weatherset.xml"));
Document mainDoc = builder.build("<DataSet><blank/><blank/></DataSet>", "");
Element root = mainDoc.getRootElement();
root.replaceChild(
root.getFirstChildElement("blank"), alertDoc.getRootElement().copy());
root.replaceChild(
root.getFirstChildElement("blank"), weatherDoc.getRootElement().copy());
代码示例来源:origin: stackoverflow.com
Builder foo = new Builder(1, 2); // The "return" value of a ctor is the reference, foo
foo.sodium(10); // Returns foo, but we ignore it
foo.calories(42); // Returns foo, but we ignore it
(foo.sodium(10)).calories(42);
^^^^^^^^^^^^^^^^ foo, with the side effect of setting the sodium value
代码示例来源:origin: org.springframework.ws/spring-ws-core
@Override
public void source(String systemId) throws Exception {
try {
Builder builder = new Builder();
Document document = builder.build(systemId);
element = document.getRootElement();
}
catch (ParsingException ex) {
throw new XomParsingException(ex);
}
}
}
代码示例来源:origin: org.springframework.ws/spring-ws-core
@Override
public void streamSource(Reader reader) throws IOException {
try {
Builder builder = new Builder();
Document document = builder.build(reader);
element = document.getRootElement();
}
catch (ParsingException ex) {
throw new XomParsingException(ex);
}
}
代码示例来源:origin: org.springframework.ws/spring-ws-core
@Override
public void streamSource(InputStream inputStream) throws IOException {
try {
Builder builder = new Builder();
Document document = builder.build(inputStream);
element = document.getRootElement();
}
catch (ParsingException ex) {
throw new XomParsingException(ex);
}
}
代码示例来源:origin: BruceEckel/OnJava8-Examples
public People(String fileName) throws Exception {
Document doc =
new Builder().build(new File(fileName));
Elements elements =
doc.getRootElement().getChildElements();
for(int i = 0; i < elements.size(); i++)
add(new APerson(elements.get(i)));
}
public static void
内容来源于网络,如有侵权,请联系作者删除!