List of usage examples for org.jdom2 Namespace getNamespace
public static Namespace getNamespace(final String prefix, final String uri)
Namespace
for the supplied prefix and uri. From source file:com.init.octo.schema.XSDSchema.java
License:Open Source License
public Document getDocument() { if (targetNamespace != null) { Element e = buildDocument.getRootElement(); Namespace ns = Namespace.getNamespace("tns", targetNamespace); e.setNamespace(ns);// ww w . j ava 2s .com buildDocument.setBaseURI(targetNamespace); } return (buildDocument); }
From source file:com.kixeye.kixmpp.jdom.StAXElementBuilder.java
License:Apache License
/** * Gets the namespace.//from w w w. jav a 2 s . c o m * * @param prefix * @param uri * @return */ private Namespace getNamespace(String prefix, String uri) { Namespace namespace = null; try { namespace = Namespace.getNamespace(prefix, uri); } catch (Exception e) { if (!ignoreInvalidNamespaces) { throw e; } } return namespace; }
From source file:com.mycompany.hr.ws.HolidayEndpoint.java
License:Apache License
@Autowired public HolidayEndpoint(HumanResourceService humanResourceService) throws JDOMException { 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); firstNameExpression = xPathFactory.compile("//hr:FirstName", Filters.element(), null, namespace); lastNameExpression = xPathFactory.compile("//hr:LastName", Filters.element(), null, namespace); }
From source file:com.novell.ldapchai.impl.edir.NmasResponseSet.java
License:Open Source License
private static String readDisplayString(final Element questionElement, final Locale locale) { final Namespace XML_NAMESPACE = Namespace.getNamespace("xml", "http://www.w3.org/XML/1998/namespace"); // someday ResoureBundle won't suck and this will be a 5 line method. // see if the node has any localized displays. final List displayChildren = questionElement.getChildren("display"); // if no locale specified, or if no localized text is available, just use the default. if (locale == null || displayChildren == null || displayChildren.size() < 1) { return questionElement.getText(); }/*from ww w .j a v a 2 s . c o m*/ // convert the xml 'display' elements to a map of locales/strings final Map<Locale, String> localizedStringMap = new HashMap<Locale, String>(); for (final Object aDisplayChildren : displayChildren) { final Element loopDisplay = (Element) aDisplayChildren; final Attribute localeAttr = loopDisplay.getAttribute("lang", XML_NAMESPACE); if (localeAttr != null) { final String localeStr = localeAttr.getValue(); final String displayStr = loopDisplay.getText(); final Locale localeKey = parseLocaleString(localeStr); localizedStringMap.put(localeKey, displayStr); } } final Locale matchedLocale = localeResolver(locale, localizedStringMap.keySet()); if (matchedLocale != null) { return localizedStringMap.get(matchedLocale); } // none found, so just return the default string. return questionElement.getText(); }
From source file:com.tactfactory.harmony.generator.androidxml.AttrsFile.java
License:Open Source License
@Override protected Element getDefaultRoot() { Element rootElement = new Element(ELEMENT_ROOT); rootElement.addNamespaceDeclaration( Namespace.getNamespace("android", "http://schemas.android.com/apk/res/android")); return rootElement; }
From source file:com.tactfactory.harmony.generator.androidxml.ManifestUpdater.java
License:Open Source License
@Override protected Element getDefaultRoot() { Namespace androidNs = Namespace.getNamespace("android", "http://schemas.android.com/apk/res/android"); Element rootElement = new Element("manifest"); rootElement.addNamespaceDeclaration(androidNs); rootElement.setAttribute("package", ApplicationMetadata.INSTANCE.getProjectNameSpace()); rootElement.setAttribute("versionCode", "1", androidNs); rootElement.setAttribute("versionName", "@string/app_version", androidNs); return rootElement; }
From source file:com.thoughtworks.go.config.MagicalGoConfigXmlWriter.java
License:Apache License
private Document createEmptyCruiseConfigDocument() { Element root = new Element("cruise"); Namespace xsiNamespace = Namespace.getNamespace("xsi", XML_NS); root.addNamespaceDeclaration(xsiNamespace); registry.registerNamespacesInto(root); root.setAttribute("noNamespaceSchemaLocation", "cruise-config.xsd", xsiNamespace); String xsds = registry.xsds(); if (!xsds.isEmpty()) { root.setAttribute("schemaLocation", xsds, xsiNamespace); }//from w ww . j a v a 2 s .co m root.setAttribute("schemaVersion", Integer.toString(GoConstants.CONFIG_SCHEMA_VERSION)); return new Document(root); }
From source file:com.thoughtworks.go.config.MagicalGoConfigXmlWriter.java
License:Apache License
private static Namespace namespaceFor(ConfigTag annotation) { return Namespace.getNamespace(annotation.namespacePrefix(), annotation.namespaceURI()); }
From source file:com.thoughtworks.go.config.MagicalGoConfigXmlWriter.java
License:Apache License
private static Namespace namespaceFor(AttributeAwareConfigTag annotation) { return Namespace.getNamespace(annotation.namespacePrefix(), annotation.namespaceURI()); }
From source file:com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry.java
License:Apache License
public void registerNamespacesInto(Element element) { for (PluginNamespace namespace : xsdsFor.values()) { element.addNamespaceDeclaration(Namespace.getNamespace(namespace.prefix, namespace.uri)); }// w ww. ja va2 s . c o m }