Java Code Examples for org.jdom2.Namespace#XML_NAMESPACE

The following examples show how to use org.jdom2.Namespace#XML_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: MCRXPathBuilderTest.java    From mycore with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void testXPath() {
    Element root = new Element("root");
    Element title1 = new Element("title");
    Element title2 = new Element("title");
    Element author = new Element("contributor");
    Attribute role = new Attribute("role", "author");
    Attribute lang = new Attribute("lang", "de", Namespace.XML_NAMESPACE);
    author.setAttribute(role);
    author.setAttribute(lang);
    root.addContent(title1);
    root.addContent(author);
    root.addContent(title2);
    new Document(root);

    assertEquals("/root", MCRXPathBuilder.buildXPath(root));
    assertEquals("/root/contributor", MCRXPathBuilder.buildXPath(author));
    assertEquals("/root/title", MCRXPathBuilder.buildXPath(title1));
    assertEquals("/root/title[2]", MCRXPathBuilder.buildXPath(title2));
    assertEquals("/root/contributor/@role", MCRXPathBuilder.buildXPath(role));
    assertEquals("/root/contributor/@xml:lang", MCRXPathBuilder.buildXPath(lang));

    root.detach();
    assertEquals("root", MCRXPathBuilder.buildXPath(root));
    assertEquals("root/contributor", MCRXPathBuilder.buildXPath(author));
}
 
Example 2
Source File: Sort.java    From rome with Apache License 2.0 5 votes vote down vote up
/**
 * @param namespace Namespace of the element
 * @param element Name of the element
 * @param dataType data-type of the element
 * @param label Label for the sort
 * @param defaultOrder indicates if this is the defaul order of the feed.
 */
public Sort(final Namespace namespace, final String element, final String dataType, final String label, final boolean defaultOrder) {
    super();
    this.namespace = namespace == null ? Namespace.XML_NAMESPACE : namespace;
    this.element = element;
    this.dataType = dataType;
    this.label = label;
    this.defaultOrder = defaultOrder;
}
 
Example 3
Source File: NumberValue.java    From rome with Apache License 2.0 4 votes vote down vote up
public void setNamespace(final Namespace namespace) {
    this.namespace = namespace == null ? Namespace.XML_NAMESPACE : namespace;
}
 
Example 4
Source File: StringValue.java    From rome with Apache License 2.0 4 votes vote down vote up
public void setNamespace(final Namespace namespace) {
    this.namespace = namespace == null ? Namespace.XML_NAMESPACE : namespace;
}
 
Example 5
Source File: Group.java    From rome with Apache License 2.0 4 votes vote down vote up
/**
 * @param namespace Namespace of the element
 * @param element Name of the element
 * @param label Label for the grouping.
 */
public Group(final Namespace namespace, final String element, final String label) {
    this.namespace = namespace == null ? Namespace.XML_NAMESPACE : namespace;
    this.element = element;
    this.label = label;
}
 
Example 6
Source File: DateValue.java    From rome with Apache License 2.0 4 votes vote down vote up
public void setNamespace(final Namespace namespace) {
    this.namespace = namespace == null ? Namespace.XML_NAMESPACE : namespace;
}