List of usage examples for org.dom4j DocumentFactory setXPathNamespaceURIs
public void setXPathNamespaceURIs(Map<String, String> namespaceURIs)
From source file:com.fonoster.astive.examples.ws.YahooParser.java
License:Apache License
private SAXReader createXmlReader() { Map<String, String> uris = new HashMap<String, String>(); uris.put("yweather", "http://xml.weather.yahoo.com/ns/rss/1.0"); DocumentFactory factory = new DocumentFactory(); factory.setXPathNamespaceURIs(uris); SAXReader xmlReader = new SAXReader(); xmlReader.setDocumentFactory(factory); return xmlReader; }
From source file:com.googlecode.fascinator.common.PythonUtils.java
License:Open Source License
public PythonUtils(JsonSimpleConfig config) throws PluginException { this.config = config; // Security/*from www . ja va2 s .c o m*/ String accessControlType = "accessmanager"; access = PluginManager.getAccessManager(accessControlType); access.init(config.toString()); // XML parsing namespaces = new HashMap<String, String>(); DocumentFactory docFactory = new DocumentFactory(); docFactory.setXPathNamespaceURIs(namespaces); saxReader = new SAXReader(docFactory); // Message Queues String brokerUrl = config.getString(ActiveMQConnectionFactory.DEFAULT_BROKER_BIND_URL, "messaging", "url"); connectionFactory = new ActiveMQConnectionFactory(brokerUrl); try { connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // create single producer for multiple destinations producer = session.createProducer(null); producer.setDeliveryMode(DeliveryMode.PERSISTENT); // cache destinations destinations = new HashMap<String, Destination>(); } catch (JMSException ex) { throw new PluginException(ex); } String access_plugin = config.getString(DEFAULT_ACCESS_PLUGIN, "accesscontrol", "type"); if (access_plugin.indexOf(",") >= 0) { String[] plugin_list = access_plugin.split(","); current_access_plugin = plugin_list[0]; } else { current_access_plugin = access_plugin; } }
From source file:com.googlecode.fascinator.redbox.sru.SRUClient.java
License:Open Source License
/** * <p>/*from w ww . j a va2 s . co m*/ * Simple init for the SAX Reader. * </p> * */ private void saxInit() { namespaces = new HashMap<>(); DocumentFactory docFactory = new DocumentFactory(); docFactory.setXPathNamespaceURIs(namespaces); saxReader = new SAXReader(docFactory); }
From source file:com.mycompany.simple.weather.YahooParser.java
License:Apache License
private SAXReader createXmlReader() { Map<String, String> uris = new HashMap<String, String>(); uris.put("y", "http://xml.weather.yahoo.com/ns/rss/1.0"); DocumentFactory factory = new DocumentFactory(); factory.setXPathNamespaceURIs(uris); SAXReader xmlReader = new SAXReader(); xmlReader.setDocumentFactory(factory); return xmlReader; }
From source file:com.thoughtworks.cruise.utils.DomUtil.java
License:Apache License
private static void registerNamespace() { HashMap<String, String> map = new HashMap<String, String>(); map.put("atom", "http://www.w3.org/2005/Atom"); DocumentFactory instance = DocumentFactory.getInstance(); instance.setXPathNamespaceURIs(map); }
From source file:com.zia.freshdocs.cmis.CMISParser10.java
License:Open Source License
@SuppressWarnings("unchecked") @Override//from w w w. ja v a 2s .c o m public NodeRef[] parseChildren(InputStream is) { NodeRef[] children = null; HashMap<String, String> nsMap = new HashMap<String, String>(); nsMap.put("atom", ATOM_NS); nsMap.put("cmis", CMIS_NS); DocumentFactory factory = new DocumentFactory(); factory.setXPathNamespaceURIs(nsMap); SAXReader reader = new SAXReader(); reader.setDocumentFactory(factory); try { Document document = reader.read(is); List<Element> entries = (List<Element>) document.selectNodes("/atom:feed/atom:entry"); int numEntries = entries.size(); children = new NodeRef[numEntries]; Element entry; NodeRef nodeRef; // Iterate over each entry element and find corresponding attrs for (int i = 0; i < numEntries; i++) { nodeRef = new NodeRef(); children[i] = nodeRef; entry = entries.get(i); // Get either the node uuid or src uri and content type Element id = entry.element("id"); String uuid = id.getTextTrim().replace(URN_UUID, ""); nodeRef.setContent(uuid); Element content = entry.element("content"); String contentType = content.attributeValue("type"); if (contentType != null) { nodeRef.setContentType(contentType); nodeRef.setContent(content.attributeValue("src")); } List<Element> cmisProperties = entry.selectNodes(".//cmis:properties/*"); int numProperties = cmisProperties.size(); Element cmisProperty; // Iterate over each property and populate associated field in NodeRef for (int j = 0; j < numProperties; j++) { cmisProperty = cmisProperties.get(j); String attrValue = cmisProperty.attributeValue("propertyDefinitionId"); if (attrValue == null) { continue; } if (attrValue.equals("cmis:name")) { nodeRef.setName(cmisProperty.elementTextTrim("value")); } if (attrValue.equals("cmis:baseTypeId")) { String typeId = cmisProperty.elementTextTrim("value"); nodeRef.setFolder(typeId != null && typeId.equals("cmis:folder")); } if (attrValue.equals("cmis:lastModificationDate")) { nodeRef.setLastModificationDate(cmisProperty.elementTextTrim("value")); } if (attrValue.equals("cmis:lastModifiedBy")) { nodeRef.setLastModifiedBy(cmisProperty.elementTextTrim("value")); } if (attrValue.equals("cmis:versionLabel")) { nodeRef.setVersion(cmisProperty.elementTextTrim("value")); } if (attrValue.equals("cmis:createdBy")) { nodeRef.setCreateBy(cmisProperty.elementTextTrim("value")); } if (attrValue.equals("cmis:objectId")) { nodeRef.setObjectId(cmisProperty.elementTextTrim("value")); } if (attrValue.equals("cmis:parentId")) { nodeRef.setParentId(cmisProperty.elementTextTrim("value")); } if (attrValue.equals("cmis:contentStreamLength")) { nodeRef.setContentLength(Long.valueOf(cmisProperty.elementTextTrim("value"))); } } } } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } return children; }
From source file:org.jasig.portal.tenants.TemplateDataTenantOperationsListener.java
License:Apache License
@PostConstruct public void setup() throws Exception { templateResources = applicationContext.getResources(TEMPLATE_LOCATION); Map<String, String> nsPrefixes = new HashMap<String, String>(); nsPrefixes.put("dlm", FragmentDefinition.NAMESPACE_URI); DocumentFactory factory = new DocumentFactory(); factory.setXPathNamespaceURIs(nsPrefixes); reader.setDocumentFactory(factory);/*from w w w . ja v a 2s .c o m*/ DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance(); fac.setNamespaceAware(true); domImpl = fac.newDocumentBuilder().getDOMImplementation(); }
From source file:org.jenkins_ci.update_center.Main.java
License:Open Source License
private SAXReader createXmlReader() { DocumentFactory factory = new DocumentFactory(); factory.setXPathNamespaceURIs(Collections.singletonMap("m", "http://maven.apache.org/POM/4.0.0")); return new SAXReader(factory); }
From source file:org.jvnet.hudson.update_center.Pom.java
License:Open Source License
public Pom(InputStream pomFile, Pom parent) throws IOException, DocumentException { this.parent = parent; DocumentFactory factory = new DocumentFactory(); factory.setXPathNamespaceURIs(Collections.singletonMap("m", "http://maven.apache.org/POM/4.0.0")); this.xmlReader = new SAXReader(factory); this.pom = readPOM(pomFile); }
From source file:org.mitre.ace2004.callisto.config.RNGParser.java
License:Open Source License
public RNGParser() { uris = new HashMap(); uris.put("rng", "http://relaxng.org/ns/structure/1.0"); uris.put("aif", "http://callisto.mitre.org/ns/aif/1.0"); DocumentFactory factory = new DocumentFactory(); factory.setXPathNamespaceURIs(uris); reader = new SAXReader(); reader.setDocumentFactory(factory);// ww w. j ava2s. c o m reader.setIncludeExternalDTDDeclarations(false); }