Java Code Examples for org.jdom2.Namespace#NO_NAMESPACE
The following examples show how to use
org.jdom2.Namespace#NO_NAMESPACE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MCRNodeBuilder.java From mycore with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("unchecked") private Object buildNameStep(NameStep nameStep, String value, Parent parent) throws JaxenException { String name = nameStep.getLocalName(); String prefix = nameStep.getPrefix(); Namespace ns = prefix.isEmpty() ? Namespace.NO_NAMESPACE : MCRConstants.getStandardNamespace(prefix); if (nameStep.getAxis() == Axis.CHILD) { if (parent instanceof Document) { return buildPredicates(nameStep.getPredicates(), ((Document) parent).getRootElement()); } else { return buildPredicates(nameStep.getPredicates(), buildElement(ns, name, value, (Element) parent)); } } else if (nameStep.getAxis() == Axis.ATTRIBUTE) { return buildAttribute(ns, name, value, (Element) parent); } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug("ignoring axis, can not be built: {} {}{}", nameStep.getAxis(), prefix.isEmpty() ? "" : prefix + ":", name); } return null; } }
Example 2
Source File: MCRXEditorTransformer.java From mycore with GNU General Public License v3.0 | 5 votes |
private Element createRootElement(String xPath) throws JaxenException { BaseXPath baseXPath = new BaseXPath(xPath, new DocumentNavigator()); LocationPath lp = (LocationPath) (baseXPath.getRootExpr()); NameStep nameStep = (NameStep) (lp.getSteps().get(0)); String prefix = nameStep.getPrefix(); Namespace ns = prefix.isEmpty() ? Namespace.NO_NAMESPACE : MCRConstants.getStandardNamespace(prefix); return new Element(nameStep.getLocalName(), ns); }
Example 3
Source File: MCRURIResolver.java From mycore with GNU General Public License v3.0 | 5 votes |
private static Namespace getNamespace(String name) { if (!name.contains(":")) { return Namespace.NO_NAMESPACE; } String prefix = name.split(":")[0]; Namespace ns = MCRConstants.getStandardNamespace(prefix); return ns == null ? Namespace.NO_NAMESPACE : ns; }
Example 4
Source File: ModuleGenerator.java From rome with Apache License 2.0 | 4 votes |
/** * Generates and injectts module metadata in a XML node (JDOM element). * <p> * * @param module the module to inject into the XML node (JDOM element). * @param element the XML node to inject the module metadata to. */ @Override public void generate(final Module module, final Element element) { if (!(module instanceof SimpleListExtension)) { return; } final SimpleListExtension sle = (SimpleListExtension) module; addNotNullElement(element, "treatAs", sle.getTreatAs()); final Group[] groups = sle.getGroupFields(); final Element listInfo = new Element("listinfo", ModuleParser.NS); for (int i = 0; groups != null && i < groups.length; i++) { final Element group = new Element("group", ModuleParser.NS); if (groups[i].getNamespace() != Namespace.NO_NAMESPACE) { addNotNullAttribute(group, "ns", groups[i].getNamespace().getURI()); } addNotNullAttribute(group, "element", groups[i].getElement()); addNotNullAttribute(group, "label", groups[i].getLabel()); listInfo.addContent(group); } final Sort[] sorts = sle.getSortFields(); for (int i = 0; sorts != null && i < sorts.length; i++) { final Element sort = new Element("sort", ModuleParser.NS); if (sorts[i].getNamespace() != Namespace.NO_NAMESPACE) { addNotNullAttribute(sort, "ns", sorts[i].getNamespace().getURI()); } addNotNullAttribute(sort, "element", sorts[i].getElement()); addNotNullAttribute(sort, "label", sorts[i].getLabel()); addNotNullAttribute(sort, "data-type", sorts[i].getDataType()); if (sorts[i].getDefaultOrder()) { addNotNullAttribute(sort, "default", "true"); } listInfo.addContent(sort); } if (!listInfo.getChildren().isEmpty()) { element.addContent(listInfo); } }
Example 5
Source File: RSS091UserlandGenerator.java From rome with Apache License 2.0 | 4 votes |
@Override protected Namespace getFeedNamespace() { return Namespace.NO_NAMESPACE; }
Example 6
Source File: NcMLWriter.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * Sets the XML namespace. * * @param namespace the new namespace. {@code null} implies {@link Namespace#NO_NAMESPACE}. */ public void setNamespace(Namespace namespace) { this.namespace = namespace == null ? Namespace.NO_NAMESPACE : namespace; }