use of org.jdom.Document in project cxf by apache.
the class WriterTest method testLiteral.
@Test
public void testLiteral() throws Exception {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ElementWriter writer = new ElementWriter(bos, "root", "urn:test");
write(writer);
writer.flush();
bos.close();
// System.out.println(bos.toString());
StaxBuilder builder = new StaxBuilder();
Document doc = builder.build(new StringReader(bos.toString()));
testWrite(doc);
}
use of org.jdom.Document in project cxf by apache.
the class StaxBuilder method buildInternal.
private Document buildInternal(XMLStreamReader r) throws XMLStreamException {
/*
* Should we do sanity checking to see that r is positioned at
* beginning in the non-mid-stream case?
*/
JDOMFactory f = factory;
if (f == null) {
f = new UncheckedJDOMFactory();
}
Document doc = f.document(null);
buildTree(f, r, doc);
return doc;
}
use of org.jdom.Document in project cas by apereo.
the class GoogleAccountsServiceFactory method createService.
@Override
public GoogleAccountsService createService(final HttpServletRequest request) {
final String relayState = request.getParameter(SamlProtocolConstants.PARAMETER_SAML_RELAY_STATE);
final String xmlRequest = this.googleSaml20ObjectBuilder.decodeSamlAuthnRequest(request.getParameter(SamlProtocolConstants.PARAMETER_SAML_REQUEST));
if (StringUtils.isBlank(xmlRequest)) {
LOGGER.trace("SAML AuthN request not found in the request");
return null;
}
final Document document = this.googleSaml20ObjectBuilder.constructDocumentFromXml(xmlRequest);
if (document == null) {
return null;
}
final Element root = document.getRootElement();
final String assertionConsumerServiceUrl = root.getAttributeValue("AssertionConsumerServiceURL");
final String requestId = root.getAttributeValue("ID");
final GoogleAccountsService s = new GoogleAccountsService(assertionConsumerServiceUrl, relayState, requestId);
s.setLoggedOutAlready(true);
return s;
}
use of org.jdom.Document in project vcell by virtualcell.
the class TMLPanel method processComparisonResult.
// process events for loading the model displayed in the comparison panel
public VCDocument processComparisonResult() throws Exception {
try {
NodeInfo root = (NodeInfo) getTree().getModel().getRoot();
// if (!isNormal(root)) {
// displayMessage(this, "Please resolve all tagged elements/attributes before proceeding.");
// }
String xmlStr = root.toXmlString();
// System.out.println(xmlStr);
Element rootElement = (XmlUtil.stringToXML(xmlStr, null)).getRootElement();
// ?
XmlReader reader = new XmlReader(true);
String rootName = rootElement.getName();
Document doc = rootElement.getDocument();
VCDocument vcDoc = null;
if (rootName.equals(XMLTags.BioModelTag)) {
String docSoftwareVersion = rootElement.getAttributeValue(XMLTags.SoftwareVersionAttrTag);
vcDoc = reader.getBioModel(rootElement, (docSoftwareVersion == null ? null : VCellSoftwareVersion.fromString(docSoftwareVersion)));
} else if (rootName.equals(XMLTags.MathModelTag)) {
vcDoc = reader.getMathModel(rootElement);
} else if (rootName.equals(XMLTags.GeometryTag)) {
vcDoc = reader.getGeometry(rootElement);
} else {
throw new Exception("Invalid root for the tree");
}
return vcDoc;
} catch (java.lang.Exception ivjExc) {
handleException(ivjExc);
throw ivjExc;
}
}
use of org.jdom.Document in project vcell by virtualcell.
the class DocumentCompiler method readTemplateFile.
private DocumentPage readTemplateFile(File file) throws XmlParseException {
Document doc = XmlUtil.readXML(file);
Element root = doc.getRootElement();
if (!root.getName().equals(VCellDocTags.VCellDoc_tag)) {
throw new RuntimeException("expecting ...");
}
Element pageElement = root.getChild(VCellDocTags.page_tag);
if (pageElement != null) {
String title = pageElement.getAttributeValue(VCellDocTags.page_title_attr);
DocSection appearance = getSection(pageElement, VCellDocTags.appearance_tag, file);
DocSection introduction = getSection(pageElement, VCellDocTags.introduction_tag, file);
DocSection operations = getSection(pageElement, VCellDocTags.operations_tag, file);
DocumentPage documentTemplate = new DocumentPage(file, title, introduction, appearance, operations);
return documentTemplate;
}
return null;
}
Aggregations