本文整理了Java中nu.xom.Builder.build()
方法的一些代码示例,展示了Builder.build()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Builder.build()
方法的具体详情如下:
包路径:nu.xom.Builder
类名称:Builder
方法名:build
暂无
代码示例来源: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: 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: stackoverflow.com
builder.withValue(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME, lastname);
builder.withValue(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME, firstname);
ops.add(builder.build());
builder.withSelection(ContactsContract.Data.CONTACT_ID + "=?" + " AND " + ContactsContract.Data.MIMETYPE + "=?"+ " AND " + ContactsContract.CommonDataKinds.Organization.TYPE + "=?", new String[]{String.valueOf(id), ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE, String.valueOf(ContactsContract.CommonDataKinds.Phone.TYPE_HOME)});
builder.withValue(ContactsContract.CommonDataKinds.Phone.NUMBER, number);
ops.add(builder.build());
builder.withSelection(ContactsContract.Data.CONTACT_ID + "=?" + " AND " + ContactsContract.Data.MIMETYPE + "=?", new String[]{String.valueOf(id), ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE});
builder.withValue(ContactsContract.CommonDataKinds.Photo.PHOTO, image.toByteArray());
ops.add(builder.build());
代码示例来源:origin: stackoverflow.com
Builder boundsBuilder = new LatLngBounds.Builder();
boundsBuilder.include(currentLocationLatLng);
boundsBuilder.include(targetLocationLatLng);
// pan to see all markers on map:
LatLngBounds bounds = boundsBuilder.build();
googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 3));
代码示例来源: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: stackoverflow.com
@Override
public void onClick(final View v) {
Location location = this.mGoogleMap.getMyLocation();
if (location != null) {
LatLng target = new LatLng(location.getLatitude(), location.getLongitude());
CameraPosition position = this.mGoogleMap.getCameraPosition();
Builder builder = new CameraPosition.Builder();
builder.zoom(15);
builder.target(target);
this.mGoogleMap.animateCamera(CameraUpdateFactory.newCameraPosition(builder.build()));
}
}
代码示例来源: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: com.thoughtworks.xstream/xstream
public HierarchicalStreamReader createReader(URL in) {
try {
final Document document = createBuilder().build(in.toExternalForm());
return new XomReader(document, getNameCoder());
} catch (ValidityException e) {
throw new StreamException(e);
} catch (ParsingException e) {
throw new StreamException(e);
} catch (IOException e) {
throw new StreamException(e);
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
Builder parser = new Builder();
StringReader in = new StringReader(xml);
docElem = parser.build(in).getRootElement();
} catch (ParsingException | IOException e) {
throw new RuntimeException(String.format("error:\n%s\ninput:\n%s", e, xml));
代码示例来源:origin: com.thoughtworks.xstream/xstream
public HierarchicalStreamReader createReader(Reader text) {
try {
final Document document = createBuilder().build(text);
return new XomReader(document, getNameCoder());
} catch (ValidityException e) {
throw new StreamException(e);
} catch (ParsingException e) {
throw new StreamException(e);
} catch (IOException e) {
throw new StreamException(e);
}
}
代码示例来源:origin: com.thoughtworks.xstream/xstream
public HierarchicalStreamReader createReader(File in) {
try {
final Document document = createBuilder().build(in);
return new XomReader(document, getNameCoder());
} catch (ValidityException e) {
throw new StreamException(e);
} catch (ParsingException e) {
throw new StreamException(e);
} catch (IOException e) {
throw new StreamException(e);
}
}
代码示例来源:origin: com.thoughtworks.xstream/xstream
public HierarchicalStreamReader createReader(InputStream in) {
try {
final Document document = createBuilder().build(in);
return new XomReader(document, getNameCoder());
} catch (ValidityException e) {
throw new StreamException(e);
} catch (ParsingException e) {
throw new StreamException(e);
} catch (IOException e) {
throw new StreamException(e);
}
}
代码示例来源:origin: stackoverflow.com
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(lRosterContentCount);
Builder cpo = ContentProviderOperation.newUpdate(ProviderConstants.CONTENT_URI);
cpo.withValues(Entries);
cpo.withSelection(SQLTables.ID + "=?", selection);
ops.add(cpo.build());
代码示例来源:origin: stackoverflow.com
OkHttpClient httpClient = new OkHttpClient.Builder()
.addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Builder ongoing = chain.request().newBuilder();
ongoing.addHeader("Accept", "application/json;versions=1");
if (isUserLoggedIn()) {
ongoing.addHeader("Authorization", getToken());
}
return chain.proceed(ongoing.build());
}
})
.build();
Retrofit retrofit = new Retrofit.Builder()
// ... extra config
.client(httpClient)
.build();
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) throws IOException
{
Path file = Paths.get("c:/touch.txt");
AclFileAttributeView aclAttr = Files.getFileAttributeView(file, AclFileAttributeView.class);
System.out.println(aclAttr.getOwner());
for(AclEntry aclEntry : aclAttr.getAcl()){
System.out.println(aclEntry);
}
System.out.println();
UserPrincipalLookupService upls = file.getFileSystem().getUserPrincipalLookupService();
UserPrincipal user = upls.lookupPrincipalByName(System.getProperty("user.name"));
AclEntry.Builder builder = AclEntry.newBuilder();
builder.setPermissions( EnumSet.of(AclEntryPermission.READ_DATA, AclEntryPermission.EXECUTE,
AclEntryPermission.READ_ACL, AclEntryPermission.READ_ATTRIBUTES, AclEntryPermission.READ_NAMED_ATTRS,
AclEntryPermission.WRITE_ACL, AclEntryPermission.DELETE
));
builder.setPrincipal(user);
builder.setType(AclEntryType.ALLOW);
aclAttr.setAcl(Collections.singletonList(builder.build()));
}
代码示例来源: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
private LatLng getPolygonCenterPoint(ArrayList<LatLng> polygonPointsList){
LatLng centerLatLng = null;
Builder builder = new LatLngBounds.Builder();
for(int i = 0 ; i < polygonPointsList.size() ; i++)
{
builder.include(polygonPointsList.get(i));
}
LatLngBounds bounds = builder.build();
centerLatLng = bounds.getCenter();
return centerLatLng;
}
代码示例来源: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
内容来源于网络,如有侵权,请联系作者删除!