本文整理汇总了Java中org.jdom2.output.DOMOutputter类的典型用法代码示例。如果您正苦于以下问题:Java DOMOutputter类的具体用法?Java DOMOutputter怎么用?Java DOMOutputter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DOMOutputter类属于org.jdom2.output包,在下文中一共展示了DOMOutputter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convert
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
/**
* Convert a JDOM Document to a DOM Document
*
* @param node
*
* @return
*/
public static org.w3c.dom.Document convert(org.jdom2.Document node) throws JDOMException
{
if (node == null)
return null; // Convert null->null
try
{
DOMOutputter outputter = new DOMOutputter();
return outputter.output(node);
}
catch (JDOMException e)
{
throw new RuntimeException("Error converting JDOM to DOM: " + e.getMessage(), e);
}
}
开发者ID:petergeneric,项目名称:stdlib,代码行数:24,代码来源:JDOMUtils.java
示例2: addRule
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
private void addRule(MCREditorSession session, String baseXPath, String... attributes) throws JDOMException {
Element rule = new Element("validation-rule");
for (int i = 0; i < attributes.length;) {
rule.setAttribute(attributes[i++], attributes[i++]);
}
new Document(rule);
org.w3c.dom.Element ruleAsDOMElement = new DOMOutputter().output(rule);
session.getValidator().addRule(baseXPath, ruleAsDOMElement);
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:10,代码来源:MCRXEditorValidatorTest.java
示例3: buildExtentPagesNodeSet
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public static NodeSet buildExtentPagesNodeSet(String input) throws JDOMException {
Element extent = buildExtentPages(input);
org.w3c.dom.Element domElement = new DOMOutputter().output(extent);
NodeSet nodeSet = new NodeSet();
nodeSet.addNode(domElement);
return nodeSet;
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:8,代码来源:MCRMODSPagesHelper.java
示例4: getMessage
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public static org.w3c.dom.Document getMessage() throws JDOMException, IOException {
Element config = getConfiguration();
if (config == null) {
return new DOMOutputter().output(new Document());
} else {
Element messageElem = config.getChild("message");
Document message = new Document(messageElem.clone());
return new DOMOutputter().output(message);
}
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:11,代码来源:MCRWebsiteWriteProtection.java
示例5: document
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public static Node document(String uri) throws JDOMException, IOException, SAXException, TransformerException {
MCRSourceContent sourceContent = MCRSourceContent.getInstance(uri);
if (sourceContent == null) {
throw new TransformerException("Could not load document: " + uri);
}
DOMOutputter out = new DOMOutputter();
return out.output(sourceContent.asXML());
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:9,代码来源:MCRXMLFunctions.java
示例6: resolve
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
/**
* @param uri the uri to resolve
*/
public static NodeList resolve(String uri) throws JDOMException {
org.jdom2.Element element = MCRURIResolver.instance().resolve(uri);
element.detach();
org.jdom2.Document document = new org.jdom2.Document(element);
return new DOMOutputter().output(document).getDocumentElement().getChildNodes();
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:10,代码来源:MCRXMLFunctions.java
示例7: readBlueprints
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public Blueprints readBlueprints(InputStream stream, String fileName) throws IOException, JAXBException, JDOMException {
String streamText = TextUtilities.decodeText(stream, fileName).text;
streamText = xmlDeclPtn.matcher(streamText).replaceFirst("");
streamText = "<blueprints>"+ streamText +"</blueprints>";
StringBuilder sb = new StringBuilder(streamText);
String ptn; Pattern p; Matcher m;
if ("blueprints.xml".equals(fileName)) {
// blueprints.xml: LONG_ELITE_MED shipBlueprint (FTL 1.03.1)
// blueprints.xml: LONG_ELITE_HARD shipBlueprint (FTL 1.03.1)
streamText = streamText.replaceAll(" img=\"rebel_long_hard\"", " img=\"rebel_long_elite\"");
}
if ("blueprints.xml".equals(fileName)) {
// blueprints.xml: SYSTEM_CASING augBlueprint (FTL 1.02.6)
ptn = "";
ptn += "\\s*<title>Reinforced System Casing</title>"; // Extra title.
ptn += "(\\s*<title>Titanium System Casing</title>)";
p = Pattern.compile(ptn);
m = p.matcher(sb);
if (m.find()) {
sb.replace(m.start(), m.end(), m.group(1));
m.reset();
}
}
Document doc = TextUtilities.parseStrictOrSloppyXML(sb.toString(), fileName);
DOMOutputter domOutputter = new DOMOutputter();
JAXBContext jc = JAXBContext.newInstance(Blueprints.class);
Unmarshaller u = jc.createUnmarshaller();
Blueprints bps = (Blueprints)u.unmarshal(domOutputter.output(doc));
return bps;
}
开发者ID:Niels-NTG,项目名称:FTLAV,代码行数:38,代码来源:DatParser.java
示例8: readChassis
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public ShipChassis readChassis(InputStream stream, String fileName) throws IOException, JAXBException, JDOMException {
String streamText = TextUtilities.decodeText(stream, fileName).text;
streamText = xmlDeclPtn.matcher(streamText).replaceFirst("");
streamText = "<shipChassis>"+ streamText +"</shipChassis>";
Document doc = TextUtilities.parseStrictOrSloppyXML(streamText, fileName);
DOMOutputter domOutputter = new DOMOutputter();
JAXBContext jc = JAXBContext.newInstance(ShipChassis.class);
Unmarshaller u = jc.createUnmarshaller();
ShipChassis sch = (ShipChassis)u.unmarshal(domOutputter.output(doc));
return sch;
}
开发者ID:Niels-NTG,项目名称:FTLAV,代码行数:15,代码来源:DatParser.java
示例9: readCrewNames
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public List<CrewNameList> readCrewNames(InputStream stream, String fileName) throws IOException, JAXBException, JDOMException {
String streamText = TextUtilities.decodeText(stream, fileName).text;
streamText = xmlDeclPtn.matcher(streamText).replaceFirst("");
streamText = "<nameLists>"+ streamText +"</nameLists>";
Document doc = TextUtilities.parseStrictOrSloppyXML(streamText, fileName);
DOMOutputter domOutputter = new DOMOutputter();
JAXBContext jc = JAXBContext.newInstance(CrewNameLists.class);
Unmarshaller u = jc.createUnmarshaller();
CrewNameLists cnl = (CrewNameLists)u.unmarshal(domOutputter.output(doc));
return cnl.getCrewNameLists();
}
开发者ID:Niels-NTG,项目名称:FTLAV,代码行数:15,代码来源:DatParser.java
示例10: readSectorData
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public SectorData readSectorData(InputStream stream, String fileName) throws IOException, JAXBException, JDOMException {
String streamText = TextUtilities.decodeText(stream, fileName).text;
streamText = xmlDeclPtn.matcher(streamText).replaceFirst("");
streamText = "<sectorData>"+ streamText +"</sectorData>";
Document doc = TextUtilities.parseStrictOrSloppyXML(streamText, fileName);
DOMOutputter domOutputter = new DOMOutputter();
JAXBContext jc = JAXBContext.newInstance(SectorData.class);
Unmarshaller u = jc.createUnmarshaller();
SectorData sectorData = (SectorData)u.unmarshal(domOutputter.output(doc));
return sectorData;
}
开发者ID:Niels-NTG,项目名称:FTLAV,代码行数:15,代码来源:DatParser.java
示例11: readEvents
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public Encounters readEvents(InputStream stream, String fileName) throws IOException, JAXBException, JDOMException {
String streamText = TextUtilities.decodeText(stream, fileName).text;
streamText = xmlDeclPtn.matcher(streamText).replaceFirst("");
streamText = "<events>"+ streamText +"</events>";
Document doc = TextUtilities.parseStrictOrSloppyXML(streamText, fileName);
DOMOutputter domOutputter = new DOMOutputter();
JAXBContext jc = JAXBContext.newInstance(Encounters.class);
Unmarshaller u = jc.createUnmarshaller();
Encounters evts = (Encounters)u.unmarshal(domOutputter.output(doc));
return evts;
}
开发者ID:Niels-NTG,项目名称:FTLAV,代码行数:15,代码来源:DatParser.java
示例12: readShipEvents
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public List<ShipEvent> readShipEvents(InputStream stream, String fileName) throws IOException, JAXBException, JDOMException {
String streamText = TextUtilities.decodeText(stream, fileName).text;
streamText = xmlDeclPtn.matcher(streamText).replaceFirst("");
streamText = "<shipEvents>"+ streamText +"</shipEvents>";
Document doc = TextUtilities.parseStrictOrSloppyXML(streamText, fileName);
DOMOutputter domOutputter = new DOMOutputter();
JAXBContext jc = JAXBContext.newInstance(ShipEvents.class);
Unmarshaller u = jc.createUnmarshaller();
ShipEvents shvts = (ShipEvents)u.unmarshal(domOutputter.output(doc));
return shvts.getShipEvents();
}
开发者ID:Niels-NTG,项目名称:FTLAV,代码行数:15,代码来源:DatParser.java
示例13: PrepareDocumentToBeSign
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public String PrepareDocumentToBeSign(Element element)
{
try{
//extract the Document to sign and transform it in a valid XML DOM
Element rootElement = new Element(element.getName());
rootElement.setContent(element.cloneContent());
//convert the Element in a JDOM Document
Document xdoc = new Document( rootElement );
//create a DOMOutputter to write the content of the JDOM document in a DOM document
DOMOutputter outputter = new DOMOutputter();
org.w3c.dom.Document Doctosign = outputter.output(xdoc);
// Show the document before being sign
System.out.println("xml to Sign:");
XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
sortie.output(xdoc, System.out);
//Transform the XML DOM in a String using the xml transformer
DOMSource domSource = new DOMSource(Doctosign);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.transform(domSource, result);
String StringTobeSign = writer.toString();
return StringTobeSign;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
开发者ID:yawlfoundation,项目名称:yawl,代码行数:36,代码来源:DigitalSignature.java
示例14: validate
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public void validate(BPMNProcess process, ValidationResult validationResult)
throws ValidationException {
LOGGER.info("Validating {}", process.getBaseURI());
try {
// EXT.002 checks whether there are ID duplicates - as ID
// duplicates in a single file are already detected during XSD
// validation this is only relevant if other processes are imported
if(!process.getChildren().isEmpty()) {
ext002Checker.checkConstraint002(process, validationResult);
}
org.jdom2.Document documentToCheck = preProcessor.preProcess(process);
DOMOutputter domOutputter = new DOMOutputter();
Document w3cDoc = domOutputter
.output(documentToCheck);
DOMSource domSource = new DOMSource(w3cDoc);
for(ISchematronResource schematronFile : schemaToCheck) {
SchematronOutputType schematronOutputType = schematronFile
.applySchematronValidationToSVRL(domSource);
schematronOutputType.getActivePatternAndFiredRuleAndFailedAssert().stream()
.filter(obj -> obj instanceof FailedAssert)
.forEach(obj -> handleSchematronErrors(process, validationResult, (FailedAssert) obj));
}
} catch (Exception e) { // NOPMD
LOGGER.debug("exception during schematron validation. Cause: {}", e);
throw new ValidationException(
"Something went wrong during schematron validation!");
}
LOGGER.info("Validating process successfully done, file is valid: {}",
validationResult.isValid());
}
开发者ID:uniba-dsg,项目名称:BPMNspector,代码行数:36,代码来源:SchematronBPMNValidator.java
示例15: getPIServiceInformation
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
/**
* Gets all available services which are configured.
* e.g.
* <ul>
* <li><service id="service1" inscribed="false" permission="true" type="urn" /></li>
* <li><service id="service2" inscribed="true" permission="false"type="doi" /></li>
* </ul>
*
* @param objectID the object
* @return a Nodelist
* @throws JDOMException
*/
public static NodeList getPIServiceInformation(String objectID) throws JDOMException {
Element e = new Element("list");
MCRBase obj = MCRMetadataManager.retrieve(MCRObjectID.getInstance(objectID));
MCRConfiguration.instance().getPropertiesMap("MCR.PI.Registration.")
.keySet()
.stream()
.map(s -> s.substring("MCR.PI.Registration.".length()))
.filter(id -> !id.contains("."))
.map((serviceID) -> MCRPIRegistrationServiceManager.getInstance().getRegistrationService(serviceID))
.map((rs -> {
Element service = new Element("service");
service.setAttribute("id", rs.getRegistrationServiceID());
// Check if the inscriber of this service can read a PI
try {
if (rs.getMetadataManager().getIdentifier(obj, "").isPresent()) {
service.setAttribute("inscribed", "true");
} else {
service.setAttribute("inscribed", "false");
}
} catch (MCRPersistentIdentifierException e1) {
LOGGER.warn("Error happened while try to read PI from object: {}", objectID, e1);
service.setAttribute("inscribed", "false");
}
// rights
String permission = "register-" + rs.getRegistrationServiceID();
Boolean canRegister = MCRAccessManager.checkPermission(objectID, "writedb") &&
MCRAccessManager.checkPermission(obj.getId(), permission);
service.setAttribute("permission", canRegister.toString().toLowerCase(Locale.ROOT));
// add the type
service.setAttribute("type", rs.getType());
return service;
}))
.forEach(e::addContent);
return new DOMOutputter().output(e).getElementsByTagName("service");
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:55,代码来源:MCRIdentifierXSLUtils.java
示例16: getPersonalNavigation
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
public static org.w3c.dom.Document getPersonalNavigation() throws JDOMException, XPathExpressionException {
Document navi = getNavi();
DOMOutputter accessCleaner = new DOMOutputter(new AccessCleaningDOMOutputProcessor());
org.w3c.dom.Document personalNavi = accessCleaner.output(navi);
XPath xpath = javax.xml.xpath.XPathFactory.newInstance().newXPath();
NodeList emptyGroups = (NodeList) xpath.evaluate("/navigation/menu/group[not(item)]", personalNavi,
XPathConstants.NODESET);
for (int i = 0; i < emptyGroups.getLength(); ++i) {
org.w3c.dom.Element group = (org.w3c.dom.Element) emptyGroups.item(i);
group.getParentNode().removeChild(group);
}
NodeList emptyMenu = (NodeList) xpath.evaluate("/navigation/menu[not(item or group)]", personalNavi,
XPathConstants.NODESET);
for (int i = 0; i < emptyMenu.getLength(); ++i) {
org.w3c.dom.Element menu = (org.w3c.dom.Element) emptyMenu.item(i);
menu.getParentNode().removeChild(menu);
}
NodeList emptyNodes = (NodeList) xpath.evaluate("//text()[normalize-space(.) = '']", personalNavi,
XPathConstants.NODESET);
for (int i = 0; i < emptyNodes.getLength(); ++i) {
Node emptyTextNode = emptyNodes.item(i);
emptyTextNode.getParentNode().removeChild(emptyTextNode);
}
personalNavi.normalizeDocument();
if (LOGGER.isDebugEnabled()) {
try {
String encoding = "UTF-8";
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
ByteArrayOutputStream bout = new ByteArrayOutputStream();
transformer.transform(new DOMSource(personalNavi), new StreamResult(bout));
LOGGER.debug("personal navigation: {}", bout.toString(encoding));
} catch (IllegalArgumentException | TransformerFactoryConfigurationError | TransformerException
| UnsupportedEncodingException e) {
LOGGER.warn("Error while getting debug information.", e);
}
}
return personalNavi;
}
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:46,代码来源:MCRLayoutUtilities.java
示例17: asInputW3cDocument
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
private org.w3c.dom.Document asInputW3cDocument(final List<QuickObject> items) throws JDOMException {
final Document jdomDoc = asInputDocument(items);
final DOMOutputter domOutputter = new DOMOutputter();
return domOutputter.output(jdomDoc);
}
开发者ID:isisaddons-legacy,项目名称:isis-app-quickstart,代码行数:7,代码来源:ExportToWordMenu.java
示例18: asInputW3cDocument
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
private org.w3c.dom.Document asInputW3cDocument(final List<ToDoItem> items) throws JDOMException {
final Document jdomDoc = asInputDocument(items);
final DOMOutputter domOutputter = new DOMOutputter();
return domOutputter.output(jdomDoc);
}
开发者ID:isisaddons,项目名称:isis-app-todoapp,代码行数:7,代码来源:ExportToWordService.java
示例19: outputW3CDom
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
/**
* Creates a W3C DOM document for the given WireFeed.
* <p>
* This method does not use the feed encoding property.
* <p>
* NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'.
* <p>
* @param feed Abstract feed to create W3C DOM document from. The type of the WireFeed must match
* the type given to the FeedOuptut constructor.
* @return the W3C DOM document for the given WireFeed.
* @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match.
* @throws FeedException thrown if the W3C DOM document for the feed could not be created.
*
*/
public org.w3c.dom.Document outputW3CDom(WireFeed feed) throws IllegalArgumentException,FeedException {
Document doc = outputJDom(feed);
DOMOutputter outputter = new DOMOutputter();
try {
return outputter.output(doc);
}
catch (JDOMException jdomEx) {
throw new FeedException("Could not create DOM",jdomEx);
}
}
开发者ID:apache,项目名称:marmotta,代码行数:25,代码来源:WireFeedOutput.java
示例20: outputW3CDom
import org.jdom2.output.DOMOutputter; //导入依赖的package包/类
/**
* Creates a W3C DOM document for the given WireFeed.
* <p>
* This method does not use the feed encoding property.
* <p>
* NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'.
* <p>
*
* @param feed Abstract feed to create W3C DOM document from. The type of the WireFeed must
* match the type given to the FeedOuptut constructor.
* @return the W3C DOM document for the given WireFeed.
* @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed
* don't match.
* @throws FeedException thrown if the W3C DOM document for the feed could not be created.
*
*/
public org.w3c.dom.Document outputW3CDom(final WireFeed feed) throws IllegalArgumentException, FeedException {
final Document doc = outputJDom(feed);
final DOMOutputter outputter = new DOMOutputter();
try {
return outputter.output(doc);
} catch (final JDOMException jdomEx) {
throw new FeedException("Could not create DOM", jdomEx);
}
}
开发者ID:rometools,项目名称:rome,代码行数:26,代码来源:WireFeedOutput.java
注:本文中的org.jdom2.output.DOMOutputter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论