Java Code Examples for org.jdom2.Namespace#getNamespace()

The following examples show how to use org.jdom2.Namespace#getNamespace() . 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: N2oModuleAccessPointPersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oModuleAccessPoint menuItem, Namespace namespaceElement) {
    Namespace namespace = Namespace.getNamespace(namespacePrefix, namespaceUri);
    Element rootElement = new Element(getElementName(), namespace);
    setAttribute(rootElement, "modules", menuItem.getModule());
    return rootElement;
}
 
Example 2
Source File: ActionAndClosePersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oActionAndClose actionAndClose, Namespace namespaceElement) {
    Namespace namespace = Namespace.getNamespace(namespacePrefix, namespaceUri);
    Element root = new Element(getElementName(), namespace);
    setAttribute(root, "action-id", actionAndClose.getOperationId());
    setAttribute(root, "confirmation", actionAndClose.getConfirmation());
    return root;
}
 
Example 3
Source File: N2oInputIntervalPersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oInputInterval field, Namespace namespace) {
    Element element = new Element(getElementName(), Namespace.getNamespace(namespacePrefix, namespaceUri));
    setControl(element, field);
    setField(element, field);
    setDefaultModel(element, field);
    setAttribute(element, "max", field.getMax());
    setAttribute(element, "min", field.getMin());
    setAttribute(element, "step", field.getStep());
    return element;
}
 
Example 4
Source File: N2oTimePersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oTime entity,Namespace namespace) {
    Element time = new Element(getElementName(), Namespace.getNamespace(namespacePrefix, namespaceUri));
    setControl(time, entity);
    setField(time, entity);
    return time;
}
 
Example 5
Source File: ShowModalFromClassifierPersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(ShowModalPageFromClassifier showModal, Namespace namespaceElement) {
    Namespace namespace = Namespace.getNamespace(namespacePrefix, namespaceUri);
    Element root = new Element(getElementName(), namespace);
    persistShowModalFromClassifier(showModal, root, namespace);
    super.persistShowModalPage(showModal, root, namespace);
    return root;
}
 
Example 6
Source File: GPXFileWriter.java    From BackPackTrackII with GNU General Public License v3.0 5 votes vote down vote up
public static void writeGeonames(List<Geonames.Geoname> names, File target, Context context) throws IOException {
    Document doc = new Document();
    Element gpx = new Element("gpx", NS);
    Namespace xsi = Namespace.getNamespace("xsi", XSI);
    gpx.addNamespaceDeclaration(xsi);
    Namespace bpt2 = Namespace.getNamespace("bpt2", BPT);
    gpx.addNamespaceDeclaration(bpt2);
    gpx.setAttribute("schemaLocation", XSD, xsi);
    gpx.setAttribute(new Attribute("version", "1.1"));
    gpx.setAttribute(new Attribute("creator", CREATOR));

    Collection<Element> wpts = new ArrayList<>();
    for (Geonames.Geoname name : names) {
        Element wpt = new Element("wpt", NS);
        wpt.setAttribute(new Attribute("lat", Double.toString(name.location.getLatitude())));
        wpt.setAttribute(new Attribute("lon", Double.toString(name.location.getLongitude())));
        wpt.addContent(new Element("name", NS).addContent(name.name));
        wpts.add(wpt);
    }
    gpx.addContent(wpts);

    doc.setRootElement(gpx);

    FileWriter fw = null;
    try {
        fw = new FileWriter(target);
        XMLOutputter xout = new XMLOutputter(Format.getPrettyFormat());
        xout.output(doc, fw);
        fw.flush();
    } finally {
        if (fw != null)
            fw.close();
    }
}
 
Example 7
Source File: N2oColumnAccessPointPersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oColumnAccessPoint entity, Namespace namespaceElement) {
    Namespace namespace = Namespace.getNamespace(namespacePrefix, namespaceUri);
    Element rootElement = new Element(getElementName(), namespace);
    setAttribute(rootElement, "page-id", entity.getPageId());
    setAttribute(rootElement, "container-id", entity.getContainerId());
    setAttribute(rootElement, "columns", entity.getPageId());
    return rootElement;
}
 
Example 8
Source File: N2oPageAccessPointPersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oPageAccessPoint page, Namespace namespaceElement) {
    Namespace namespace = Namespace.getNamespace(namespacePrefix, namespaceUri);
    Element rootElement = new Element(getElementName(), namespace);
    setAttribute(rootElement, "pages", page.getPage());
    return rootElement;
}
 
Example 9
Source File: ShowModalFormPersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oShowModalForm showModal, Namespace namespaceElement) {
    Namespace namespace = Namespace.getNamespace(namespacePrefix, namespaceUri);
    Element root = new Element(getElementName(), namespace);
    persistShowModalForm(showModal, root);
    super.persistShowModalPage(showModal, root, namespace);
    return root;
}
 
Example 10
Source File: OpenPagePersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oOpenPage openPage, Namespace namespaceElement) {
    Namespace namespace = Namespace.getNamespace(namespacePrefix, namespaceUri);
    Element root = new Element(getElementName(), namespace);
    persistOpenPage(openPage, root, namespace);
    super.persistShowModalPage(openPage, root, namespace);
    return root;
}
 
Example 11
Source File: N2oUrlAccessPointPersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oUrlAccessPoint url, Namespace namespaceElement) {
    Namespace namespace = Namespace.getNamespace(namespacePrefix, namespaceUri);
    Element rootElement = new Element(getElementName(), namespace);
    setAttribute(rootElement, "pattern", url.getPattern());
    return rootElement;
}
 
Example 12
Source File: N2oCustomCellXmlPersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oCustomCell custom, Namespace namespaceElemnt) {
    Namespace namespace = Namespace.getNamespace(namespacePrefix, namespaceUri);
    Element element = new Element(getElementName(), namespace);
    setAttribute(element, "src", custom.getSrc());
    element.addContent(new PropertiesPersister(namespace).persist(custom.getProperties(),namespace));
    return element;
}
 
Example 13
Source File: N2oFilterAccessPointPersister.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public Element persist(N2oFilterAccessPoint entity, Namespace namespaceElement) {
    Namespace namespace = Namespace.getNamespace(namespacePrefix, namespaceUri);
    Element rootElement = new Element(getElementName(), namespace);
    setAttribute(rootElement, "query-id", entity.getQueryId());
    setAttribute(rootElement, "filters", entity.getFilterId());
    return rootElement;
}
 
Example 14
Source File: MCRURIResolver.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Source resolve(String href, String base) throws TransformerException {
    String includePart = href.substring(href.indexOf(":") + 1);
    Namespace xslNamespace = Namespace.getNamespace("xsl", "http://www.w3.org/1999/XSL/Transform");

    Element root = new Element("stylesheet", xslNamespace);
    root.setAttribute("version", "1.0");

    // get the parameters from mycore.properties
    String propertyName = "MCR.URIResolver.xslIncludes." + includePart;
    List<String> propValue;
    if (includePart.startsWith("class.")) {
        MCRXslIncludeHrefs incHrefClass = MCRConfiguration2
            .getOrThrow(propertyName, MCRConfiguration2::instantiateClass);
        propValue = incHrefClass.getHrefs();
    } else {
        propValue = MCRConfiguration2.getString(propertyName)
            .map(MCRConfiguration2::splitValue)
            .map(s -> s.collect(Collectors.toList()))
            .orElseGet(Collections::emptyList);
    }

    for (String include : propValue) {
        // create a new include element
        Element includeElement = new Element("include", xslNamespace);
        includeElement.setAttribute("href", include);
        root.addContent(includeElement);
        LOGGER.debug("Resolved XSL include: {}", include);
    }
    return new JDOMSource(root);
}
 
Example 15
Source File: BasePageElementIOv2.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
public void setRegionDefaultNamespace(String regionDefaultNamespace) {
    this.regionDefaultNamespace = Namespace.getNamespace(regionDefaultNamespace);
}
 
Example 16
Source File: HolidayEndpoint.java    From spring-boot-samples with Apache License 2.0 4 votes vote down vote up
@Autowired
public HolidayEndpoint(HumanResourceService humanResourceService){
	
	this.humanResourceService = humanResourceService;
	
	Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
	XPathFactory xPathFactory = XPathFactory.instance();
	
	startDateExpression =xPathFactory.compile("//hr:StartDate", Filters.element(), null,namespace);
	
	endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(), null,namespace);
	
	nameExpression = xPathFactory.compile(
			"concat(//hr:FirstName,' ',//hr:LastName)",
			Filters.fstring(), null,namespace);		
}
 
Example 17
Source File: GoPluginManifest.java    From gocd with Apache License 2.0 4 votes vote down vote up
public Namespace getPluginNamespace() {
    return Namespace.getNamespace(getPluginNamespacePrefix(), getPluginNamespaceUri());
}
 
Example 18
Source File: RSS20wNSParser.java    From rome with Apache License 2.0 4 votes vote down vote up
@Override
protected Namespace getRSSNamespace() {
    return Namespace.getNamespace(RSS20_URI);
}
 
Example 19
Source File: BaseRegionIOv1.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
public void setDataProviderDefaultNamespace(String widgetDefaultNamespace) {
    this.widgetDefaultNamespace = Namespace.getNamespace(widgetDefaultNamespace);
}
 
Example 20
Source File: KMLFileWriter.java    From BackPackTrackII with GNU General Public License v3.0 4 votes vote down vote up
public static void writeKMLFile(File target, String trackName, boolean extensions, Cursor cTrackPoints, Cursor cWayPoints, Context context)
        throws IOException {

    // https://developers.google.com/kml/documentation/kmlreference
    Document doc = new Document();

    Element kml = new Element("kml", NS);
    Namespace gx = Namespace.getNamespace("gx", "http://www.google.com/kml/ext/2.2");
    kml.addNamespaceDeclaration(gx);
    Namespace atom = Namespace.getNamespace("atom", "http://www.w3.org/2005/Atom");
    kml.addNamespaceDeclaration(atom);

    Element document = new Element("Document", NS);

    Element name = new Element("name", NS);
    name.addContent(trackName);
    document.addContent(name);

    Element author = new Element("author", atom);
    Element authorName = new Element("name", atom);
    authorName.addContent("BackPackTrackII");
    author.addContent(authorName);
    document.addContent(author);

    Element style = new Element("Style", NS);
    style.setAttribute(new Attribute("id", "style"));
    Element linestyle = new Element("LineStyle", NS);
    Element color = new Element("color", NS);
    color.addContent("ffff0000");
    linestyle.addContent(color);
    Element width = new Element("width", NS);
    width.addContent("5");
    linestyle.addContent(width);
    style.addContent(linestyle);
    document.addContent(style);

    Collection<Element> placemarks = new ArrayList<>();
    placemarks.add(getTrackpoints(trackName, extensions, cTrackPoints, gx, context));
    placemarks.addAll(getWayPoints(extensions, cWayPoints, gx, context));
    document.addContent(placemarks);
    kml.addContent(document);
    doc.setRootElement(kml);

    FileWriter fw = null;
    try {
        fw = new FileWriter(target);
        XMLOutputter xout = new XMLOutputter(Format.getPrettyFormat());
        xout.output(doc, fw);
        fw.flush();
    } finally {
        if (fw != null)
            fw.close();
    }

    // https://developers.google.com/kml/schema/kml22gx.xsd
    // xmllint --noout --schema kml22gx.xsd BackPackTrack.kml
}