private Element getRootElement() { Element eRoot = new Element("rest-client"); // set version attributes to rest-client root tag eRoot.addAttribute(new Attribute("version", Versions.CURRENT)); return eRoot; }
private static void addDependencyInfo(Element depInfo, String rel, boolean isExtra, int source, String sourceWord, Integer sourceCopy, int target, String targetWord, Integer targetCopy, String curNS) { Element depElem = new Element("dep", curNS); depElem.addAttribute(new Attribute("type", rel)); if (isExtra) { depElem.addAttribute(new Attribute("extra", "true")); } Element govElem = new Element("governor", curNS); govElem.addAttribute(new Attribute("idx", Integer.toString(source))); govElem.appendChild(sourceWord); if (sourceCopy != null && sourceCopy > 0) { govElem.addAttribute(new Attribute("copy", Integer.toString(sourceCopy))); } depElem.appendChild(govElem); Element dependElem = new Element("dependent", curNS); dependElem.addAttribute(new Attribute("idx", Integer.toString(target))); dependElem.appendChild(targetWord); if (targetCopy != null && targetCopy > 0) { dependElem.addAttribute(new Attribute("copy", Integer.toString(targetCopy))); } depElem.appendChild(dependElem); depInfo.appendChild(depElem); }
public void addAttribute(final String name, final String value) { top().addAttribute(new Attribute(encodeAttribute(name), value)); }
Element mentionElem = new Element("mention", curNS); if (representative) { mentionElem.addAttribute(new Attribute("representative", "true"));
private static Element toXML(RelationTriple triple, String curNS) { Element top = new Element("triple", curNS); top.addAttribute(new Attribute("confidence", triple.confidenceGloss())); subject.addAttribute(new Attribute("begin", Integer.toString(triple.subjectTokenSpan().first))); subject.addAttribute(new Attribute("end", Integer.toString(triple.subjectTokenSpan().second))); Element text = new Element("text", curNS); text.appendChild(triple.subjectGloss()); relation.addAttribute(new Attribute("begin", Integer.toString(triple.relationTokenSpan().first))); relation.addAttribute(new Attribute("end", Integer.toString(triple.relationTokenSpan().second))); text = new Element("text", curNS); text.appendChild(triple.relationGloss()); object.addAttribute(new Attribute("begin", Integer.toString(triple.objectTokenSpan().first))); object.addAttribute(new Attribute("end", Integer.toString(triple.objectTokenSpan().second))); text = new Element("text", curNS); text.appendChild(triple.objectGloss());
e.addAttribute(new Attribute("type", req.getKeyStore().getType().name())); e.addAttribute(new Attribute("file", req.getKeyStore().getFile().getAbsolutePath())); e.addAttribute(new Attribute("password", Util.base64encode(new String(req.getKeyStore().getPassword())))); eSsl.appendChild(e); e.addAttribute(new Attribute("type", req.getTrustStore().getType().name())); e.addAttribute(new Attribute("file", req.getTrustStore().getFile().getAbsolutePath())); e.addAttribute(new Attribute("password", Util.base64encode(new String(req.getTrustStore().getPassword())))); eSsl.appendChild(e);
public static void writeRequestCollectionXML(final List<Request> requests, final File f) throws IOException, XMLException { XmlPersistenceWrite xUtl = new XmlPersistenceWrite(); Element eRoot = new Element("request-collection"); eRoot.addAttribute(new Attribute("version", Versions.CURRENT)); for(Request req: requests) { Element e = xUtl.getRequestElement(req); eRoot.appendChild(e); } Document doc = new Document(eRoot); xUtl.writeXML(doc, f); }
private static Element toXML(EntityMention entity, String curNS) { Element top = new Element("entity", curNS); top.addAttribute(new Attribute("id", entity.getObjectId())); Element type = new Element("type", curNS); type.appendChild(entity.getType()); top.appendChild(entity.getType()); if (entity.getNormalizedName() != null){ Element nm = new Element("normalized", curNS); nm.appendChild(entity.getNormalizedName()); top.appendChild(nm); } if (entity.getSubType() != null){ Element subtype = new Element("subtype", curNS); subtype.appendChild(entity.getSubType()); top.appendChild(subtype); } Element span = new Element("span", curNS); span.addAttribute(new Attribute("start", Integer.toString(entity.getHeadTokenStart()))); span.addAttribute(new Attribute("end", Integer.toString(entity.getHeadTokenEnd()))); top.appendChild(span); top.appendChild(makeProbabilitiesElement(entity, curNS)); return top; }
private static Element buildDependencyTreeInfo(String dependencyType, SemanticGraph graph, List<CoreLabel> tokens, String curNS) { if(graph != null) { Element depInfo = new Element("dependencies", curNS); depInfo.addAttribute(new Attribute("type", dependencyType));
private static void addWordInfo(Element wordInfo, CoreMap token, int id, String curNS) { wordInfo.addAttribute(new Attribute("id", Integer.toString(id))); Timex timex = token.get(TimeAnnotations.TimexAnnotation.class); Element timexElem = new Element("Timex", curNS); timexElem.addAttribute(new Attribute("tid", timex.tid())); timexElem.addAttribute(new Attribute("type", timex.timexType())); timexElem.appendChild(timex.value()); wordInfo.appendChild(timexElem);
for(String value: headers.get(key)) { Element ee = new Element("header"); ee.addAttribute(new Attribute("key", key)); ee.addAttribute(new Attribute("value", value)); e.appendChild(ee); ee.addAttribute(new Attribute("name", cookie.getName())); ee.addAttribute(new Attribute("value", cookie.getValue())); ee.addAttribute(new Attribute("version", String.valueOf(cookie.getVersion()))); e.appendChild(ee);
new Attribute("subtype", entity.getSubtype().name())); new Attribute("mode", entity.getMode().name())); ePart.addAttribute(new Attribute("name", p.getName())); ePart.addAttribute(new Attribute("name", p.getName())); ePart.addAttribute(new Attribute("filename", p.getFilename())); ePart.addAttribute(new Attribute("filename", p.getPart().getName()));
for (CoreMap sentence: annotation.get(CoreAnnotations.SentencesAnnotation.class)) { Element sentElem = new Element("sentence", NAMESPACE_URI); sentElem.addAttribute(new Attribute("id", Integer.toString(sentCount))); Integer lineNumber = sentence.get(CoreAnnotations.LineNumberAnnotation.class); if (lineNumber != null) { sentElem.addAttribute(new Attribute("line", Integer.toString(lineNumber))); if (sentimentTree != null) { int sentiment = RNNCoreAnnotations.getPredictedClass(sentimentTree); sentElem.addAttribute(new Attribute("sentimentValue", Integer.toString(sentiment))); String sentimentClass = sentence.get(SentimentCoreAnnotations.SentimentClass.class); sentElem.addAttribute(new Attribute("sentiment", sentimentClass.replaceAll(" ", "")));
private static Element toXML(RelationMention relation, String curNS) { Element top = new Element("relation", curNS); top.addAttribute(new Attribute("id", relation.getObjectId())); Element type = new Element("type", curNS); type.appendChild(relation.getType()); top.appendChild(relation.getType()); if (relation.getSubType() != null){ Element subtype = new Element("subtype", curNS); subtype.appendChild(relation.getSubType()); top.appendChild(relation.getSubType()); } List<EntityMention> mentions = relation.getEntityMentionArgs(); Element args = new Element("arguments", curNS); for (EntityMention e : mentions) { args.appendChild(toXML(e, curNS)); } top.appendChild(args); top.appendChild(makeProbabilitiesElement(relation, curNS)); return top; }
Attribute codeAttributes = new Attribute("code", String.valueOf(bean.getStatusCode())); respChildSubElement.addAttribute(codeAttributes); respChildSubElement.appendChild(bean.getStatusLine()); for(String value: headers.get(key)) { respChildSubSubElement = new Element("header"); keyAttribute = new Attribute("key", key); valueAttribute = new Attribute("value", value); respChildSubSubElement.addAttribute(keyAttribute); respChildSubSubElement.addAttribute(valueAttribute);
public static byte[] createPermissionsXml(Permission... permissions) { final Element permissionsElement = new Element("permissions"); permissionsElement.setNamespaceURI("http://xmlns.jcp.org/xml/ns/javaee"); permissionsElement.addAttribute(new Attribute("version", "7")); for (Permission permission : permissions) { final Element permissionElement = new Element("permission");
@Override public Unit call( final Integer x) { e.addAttribute(new Attribute("width", null, x.toString())); return Unit.unit(); } });
static Element linkRaw( final String target) { final Element e = new Element("a", SXHTML.XHTML_URI.toString()); e.addAttribute(new Attribute("href", null, target)); return e; }
public void beforeProcessingSpecification(SpecificationProcessingEvent event) { Resource resource = event.getResource(); //work around with setValue() necessary for Concordion.NET Attribute srcAttribute = new Attribute("src", ""); srcAttribute.setValue(resource.getRelativePath(javaScriptResource)); script.addAttribute(srcAttribute); }