List of usage examples for org.jdom2 Element getNamespace
public Namespace getNamespace()
From source file:es.upm.dit.xsdinferencer.extraction.extractorImpl.JSONTypesExtractorImpl.java
License:Apache License
/** * This method undoes what addPrefixToJSONKeysEndingsRecursive method did at the original JSON: It looks * for elements whose name ends at a desired key ending preceeded by a prefix to remove and removes it. * @param rootElement the root element.//w ww .j av a 2 s .c o m * @param desiredKeyEnding the desired ending. * @param prefixToRemove the prefix to remove. */ private void removePrefixToElementNameEndings(Element rootElement, String desiredKeyEnding, String prefixToRemove) { String keyToSearch = prefixToRemove + desiredKeyEnding; for (Element element : rootElement.getDescendants(Filters.element())) { if (!(element.getName().endsWith(keyToSearch) && element.getNamespace().equals(Namespace.NO_NAMESPACE))) { continue; } String name = element.getName(); String newName = name.replaceAll(Pattern.quote(keyToSearch) + "$", desiredKeyEnding); element.setName(newName); } }
From source file:eu.himeros.cophi.ocr.proofreader.controller.pojo.HocrDocumentBuilder.java
License:Open Source License
/** * Builds the hocr document, extracting the header from the old hocr document. * @param the old hocrDocument//from w w w . j ava 2 s . co m * @return the new ohocrDocument */ public Document build(Document hocrDocument) { Element root = hocrDocument.getRootElement(); xmlns = root.getNamespace(); Element bodyEl = root.getChildren().get(1); Element ocrPageEl = bodyEl.getChildren().get(0).detach(); String pageId = ocrPageEl.getAttributeValue("id"); ocrPageEl = new Element("div", xmlns); ocrPageEl.setAttribute("class", "ocr_page"); ocrPageEl.setAttribute("id", pageId); for (OcrLine ocrLine : ocrPage.getOcrLines()) { ocrPageEl.addContent(makeOcrLineEl(ocrLine)); ocrPageEl.addContent(new Element("br", xmlns)); } bodyEl.addContent(ocrPageEl); return hocrDocument; }
From source file:eu.himeros.cophi.ocr.proofreader.controller.pojo.OcrPageParser.java
License:Open Source License
/** * Parses an hocrDocuemnt, creating an ocrPage. * @param hocrDocument/*ww w . j a v a 2 s . c o m*/ * @return the ocrPage. * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException */ public OcrPage parse(Document hocrDocument) throws ClassNotFoundException, InstantiationException, IllegalAccessException { ocrPage.setHocrDocument(hocrDocument); Element root = hocrDocument.getRootElement(); Namespace xmlns = root.getNamespace(); String scanId = root.getChildren().get(1).getChildren().get(0).getAttributeValue("id"); ocrPage.setScan(new PageScan<>(scanId)); List<OcrLine> ocrLines = new ArrayList<>(); for (Element ocrLineEl : root.getChildren().get(1).getChildren().get(0).getChildren("span", xmlns)) { //cycle on /html/body/span[@class='ocr_page']/span[@class='ocr_line'] ocrLines.add(parseOcrLine(ocrLineEl)); } ocrPage.setOcrLines(ocrLines); return ocrPage; }
From source file:eu.himeros.hocr.FlatXml.java
License:Open Source License
private void init(File inFile, File outFile) throws Exception { SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(inFile); Element root = doc.getRootElement(); Namespace oldns = root.getNamespace(); Element newRoot = new Element("html", "http://www.w3.org/1999/xhtml"); Namespace xmlns = newRoot.getNamespace(); Element head = root.getChild("head", oldns); head.setNamespace(xmlns);/*w w w. ja v a 2 s.c o m*/ for (Element child : head.getChildren()) child.setNamespace(xmlns); Element title = new Element("title", xmlns); title.addContent("ocr"); if (head != null) head.addContent(title); Element body = root.getChild("body", oldns); body.setNamespace(xmlns); /*Element oldPage; try{ oldPage=body.getChild("div",xmlns); }catch(Exception ex){ oldPage=new Element("div",xmlns); }*/ Element page = new Element("div", xmlns); page.setAttribute("class", "ocr_page"); page.setAttribute("id", "i" + inFile.getName().substring(1).replace(".html", ".png")); XPathExpression<Element> xpath = XPathFactory.instance().compile("//*[@class='ocr_carea']", Filters.element(), null, Namespace.getNamespace("ns", "http://www.w3.org/1999/xhtml")); List<Element> careaElL = xpath.evaluate(body); for (Element careaEl : careaElL) { page.addContent(new Comment("<div class=\"" + careaEl.getAttributeValue("class") + "\" title=\"" + careaEl.getAttributeValue("title") + "\">")); for (Element pEl : careaEl.getChildren()) { page.addContent(new Comment("<p>")); for (Element lineEl : pEl.getChildren()) { lineEl.removeAttribute("id"); lineEl.setNamespace(xmlns); for (Element child : lineEl.getChildren()) { child.removeAttribute("id"); child.removeAttribute("lang"); child.removeAttribute("lang", xmlns); child.setNamespace(xmlns); } page.addContent(lineEl.clone()); } page.addContent(new Comment("</p>")); } page.addContent(new Comment("</div>")); } //oldPage.detach(); if (body != null) { body.removeContent(); body.addContent(page); } newRoot.addContent(root.removeContent()); doc.detachRootElement(); doc.setRootElement(newRoot); XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat()); xmlOutputter.output(doc, new BufferedWriter(new FileWriter(outFile))); }
From source file:eu.himeros.hocr.GrcContextFilterMananger.java
License:Open Source License
@Override public void adjustPreviousSuitableElement() { Element prevEl = queue.poll(); Element currEl = queue.peek(); Element nextEl = queue.get(1); try {//from w w w.j a va 2s . c o m Element prevInfo = prevEl.getChild("span", prevEl.getNamespace()); Element currInfo = currEl.getChild("span", currEl.getNamespace()); Element nextInfo = nextEl.getChild("span", nextEl.getNamespace()); if (currInfo != null && "UCWORD".equals(currInfo.getAttributeValue("class"))) { String suggestions = ""; try { suggestions = filterSuggestions(currInfo.getText(), prevInfo.getText(), nextInfo.getText(), currInfo.getAttributeValue("title")); } catch (NullPointerException npex) { // } if (suggestions.trim().contains(" ")) { currInfo.setAttribute("title", suggestions); } else if (suggestions.length() > 0) { currInfo.setAttribute("class", "CORRWORD"); currInfo.setAttribute("title", currInfo.getText()); currInfo.setText(suggestions); } } } catch (Exception ex) { ex.printStackTrace(System.err); } }
From source file:fr.amap.lidar.amapvox.gui.viewer3d.Viewer3DFrameController.java
/** * Initializes the controller class./*from w w w. j a v a2s. c o m*/ */ @Override public void initialize(URL url, ResourceBundle rb) { treeviewSceneObjects .setCellFactory(new Callback<TreeView<SceneObjectWrapper>, TreeCell<SceneObjectWrapper>>() { @Override public TreeCell<SceneObjectWrapper> call(TreeView<SceneObjectWrapper> param) { return new SceneObjectTreeCell(); } }); root = new TreeItem<>(); root.setExpanded(true); treeviewSceneObjects.setRoot(root); checkMenuItemPerspective.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { checkMenuItemOrthographic.setSelected(!newValue); } }); checkMenuItemOrthographic.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { checkMenuItemPerspective.setSelected(!newValue); } }); checkMenuItemOrthographic.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { try { float near = Float.valueOf(textfieldCameraNear.getText()); float far = Float.valueOf(textfieldCameraFar.getText()); viewer3D.getJoglContext().getScene().getCamera().setViewToOrthographic(near, far, far, far, near, far); viewer3D.getJoglContext().updateCamera(); viewer3D.getJoglContext().refresh(); } catch (Exception e) { } } } }); checkMenuItemPerspective.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { try { float fov = Float.valueOf(textFieldPerspective.getText()); float near = Float.valueOf(textfieldCameraNear.getText()); float far = Float.valueOf(textfieldCameraFar.getText()); viewer3D.getJoglContext().getScene().getCamera().setViewToPerspective(fov, near, far); viewer3D.getJoglContext().updateCamera(); viewer3D.getJoglContext().refresh(); } catch (Exception e) { } } } }); textFieldPerspective.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { try { float fov = Float.valueOf(newValue); TrackballCamera camera = viewer3D.getJoglContext().getScene().getCamera(); viewer3D.getJoglContext().getScene().getCamera().setPerspective(fov, camera.getAspect(), camera.getNearPersp(), camera.getFarPersp()); viewer3D.getJoglContext().refresh(); } catch (Exception e) { } } }); tableColumnName.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<Viewer3DFrameController.Attribut, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(TableColumn.CellDataFeatures<Attribut, String> param) { return new SimpleStringProperty(param.getValue().getName()); } }); tableColumnValue.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<Viewer3DFrameController.Attribut, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(TableColumn.CellDataFeatures<Attribut, String> param) { return new SimpleStringProperty(String.valueOf(param.getValue().getValue())); } }); comboboxGradient.getItems().addAll(Util.AVAILABLE_GRADIENT_COLOR_NAMES); comboboxGradient.getSelectionModel().select("HEAT"); isHidden = false; colorPickerBackgroundColor.valueProperty().addListener(new ChangeListener<javafx.scene.paint.Color>() { @Override public void changed(ObservableValue<? extends javafx.scene.paint.Color> observable, javafx.scene.paint.Color oldValue, javafx.scene.paint.Color newValue) { try { //read sgv file URL resource = Viewer3DFrameController.class.getResource("/fxml/icons/pinceau.svg"); SAXBuilder sxb = new SAXBuilder(); Document document = sxb.build(resource); final Element root = document.getRootElement(); //edit svg file final List<Element> graphicElements = root.getChildren("g", root.getNamespace()); String hexColor = null; for (Element element : graphicElements) { String attributeValue = element.getAttributeValue("label", Namespace.getNamespace("http://www.inkscape.org/namespaces/inkscape")); if (attributeValue != null && attributeValue.equals("ciel")) { final Element ellipse = element.getChild("ellipse", root.getNamespace()); String style = ellipse.getAttributeValue("style"); int indexOf = style.indexOf("fill:#"); hexColor = Integer.toHexString((int) (newValue.getRed() * 255)) + Integer.toHexString((int) (newValue.getGreen() * 255)) + Integer.toHexString((int) (newValue.getBlue() * 255)); style = style.substring(0, indexOf + 6) + hexColor + style.substring(indexOf + 12); ellipse.setAttribute("style", style); } else if (attributeValue != null && attributeValue.equals("peinture")) { final Element path = element.getChild("path", root.getNamespace()); String style = path.getAttributeValue("style"); int indexOf = style.indexOf("fill:#"); DecimalFormat df = new DecimalFormat("##"); hexColor = Integer.toHexString((int) (newValue.getRed() * 255)) + Integer.toHexString((int) (newValue.getGreen() * 255)) + Integer.toHexString((int) (newValue.getBlue() * 255)); style = style.substring(0, indexOf + 6) + hexColor + style.substring(indexOf + 12); path.setAttribute("style", style); } } if (hexColor != null) { SVGConverter conv = new SVGConverter(); conv.setWidth(32.0f); conv.setHeight(32.0f); conv.setMediaType("image/png"); File tmpSVGFile = File.createTempFile("skycolor", ".svg"); File tmpPNGFile = File.createTempFile("skycolor", ".png"); //convert svg to png conv.setSources(new String[] { tmpSVGFile.toURI().toURL().toString() }); conv.setDst(tmpPNGFile); XMLOutputter output = new XMLOutputter(Format.getPrettyFormat()); output.output(document, new BufferedOutputStream(new FileOutputStream(tmpSVGFile))); conv.execute(); //change sky icon Image image = new Image(tmpPNGFile.toURI().toURL().toString()); imageviewSkyColor.setImage(image); } } catch (Exception ex) { java.util.logging.Logger.getLogger(Viewer3DFrameController.class.getName()).log(Level.SEVERE, null, ex); } if (viewer3D != null) { viewer3D.getJoglContext().setWorldColor(new Vec3F((float) newValue.getRed(), (float) newValue.getGreen(), (float) newValue.getBlue())); viewer3D.getJoglContext().refresh(); } } }); comboboxGradient.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { String gradient = newValue; Color[] gradientColor = ColorGradient.GRADIENT_RAINBOW; for (int i = 0; i < Util.AVAILABLE_GRADIENT_COLORS.size(); i++) { if (Util.AVAILABLE_GRADIENT_COLOR_NAMES.get(i).equals(gradient)) { gradientColor = Util.AVAILABLE_GRADIENT_COLORS.get(i); i = Util.AVAILABLE_GRADIENT_COLOR_NAMES.size() - 1; } } //recalculate voxel color with the new gradient voxelSpace.updateColorValue(gradientColor); //update instance color buffer to gpu voxelSpace.updateInstanceColorBuffer(); viewer3D.getJoglContext().refresh(); } }); colorPickerBackgroundColor.setValue(new javafx.scene.paint.Color(0.8, 0.8, 0.8, 1)); colorpickerLightingAmbientColor.setValue(new javafx.scene.paint.Color(1.0, 1.0, 1.0, 1)); colorpickerLightingDiffuseColor.setValue(new javafx.scene.paint.Color(1.0, 1.0, 1.0, 1)); colorpickerLightingSpecularColor.setValue(new javafx.scene.paint.Color(1.0, 1.0, 1.0, 1)); colorpickerLightingAmbientColor.valueProperty().addListener(new ChangeListener<javafx.scene.paint.Color>() { @Override public void changed(ObservableValue<? extends javafx.scene.paint.Color> observable, javafx.scene.paint.Color oldValue, javafx.scene.paint.Color newValue) { viewer3D.getJoglContext().getScene().setLightAmbientValue(new Vec3F((float) newValue.getRed(), (float) newValue.getGreen(), (float) newValue.getBlue())); viewer3D.getJoglContext().refresh(); } }); colorpickerLightingDiffuseColor.valueProperty().addListener(new ChangeListener<javafx.scene.paint.Color>() { @Override public void changed(ObservableValue<? extends javafx.scene.paint.Color> observable, javafx.scene.paint.Color oldValue, javafx.scene.paint.Color newValue) { viewer3D.getJoglContext().getScene().setLightDiffuseValue(new Vec3F((float) newValue.getRed(), (float) newValue.getGreen(), (float) newValue.getBlue())); viewer3D.getJoglContext().refresh(); } }); colorpickerLightingSpecularColor.valueProperty() .addListener(new ChangeListener<javafx.scene.paint.Color>() { @Override public void changed(ObservableValue<? extends javafx.scene.paint.Color> observable, javafx.scene.paint.Color oldValue, javafx.scene.paint.Color newValue) { viewer3D.getJoglContext().getScene() .setLightSpecularValue(new Vec3F((float) newValue.getRed(), (float) newValue.getGreen(), (float) newValue.getBlue())); viewer3D.getJoglContext().refresh(); } }); comboBoxAttributeToShow.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { try { voxelSpace.resetAttributValueRange(); voxelSpace.changeCurrentAttribut(newValue); voxelSpace.updateVao(); voxelSpace.updateInstanceColorBuffer(); viewer3D.getJoglContext().refresh(); textFieldMinValue.getEditor() .setText(String.valueOf(voxelSpace.getRealAttributValueMin())); textFieldMaxValue.getEditor() .setText(String.valueOf(voxelSpace.getRealAttributValueMax())); } catch (Exception e) { } } }); final InstanceLightedShader ils = new InstanceLightedShader(); final InstanceShader is = new InstanceShader(); checkMenuItemEnableLighting.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { voxelSpace.setShader(ils); } else { voxelSpace.setShader(is); } viewer3D.getJoglContext().refresh(); } }); /*textFieldFilterValues.setOnKeyReleased(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { if(event.getCode() == KeyCode.ENTER){ updateValuesFilter(); } } });*/ checkboxStretched.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { voxelSpace.setStretched(true); voxelSpace.updateValue(); voxelSpace.updateInstanceColorBuffer(); viewer3D.getJoglContext().refresh(); } else { voxelSpace.setStretched(false); voxelSpace.updateValue(); voxelSpace.updateInstanceColorBuffer(); viewer3D.getJoglContext().refresh(); } } }); /* textfieldCameraNear.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { try{ float near = Float.valueOf(newValue); TrackballCamera camera = joglContext.getScene().getCamera(); if(radiobuttonOrthographicCamera.isSelected()){ joglContext.getScene().getCamera().setOrthographic(camera.getLeft(), camera.getRight(), camera.getTop(), camera.getBottom(), near, camera.getFarOrtho()); joglContext.updateCamera(); joglContext.refresh(); }else{ joglContext.getScene().getCamera().setPerspective(camera.getFovy(), camera.getAspect(), near, camera.getFarPersp()); joglContext.updateCamera(); joglContext.refresh(); } joglContext.refresh(); }catch(Exception e){} } }); textfieldCameraFar.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { try{ float far = Float.valueOf(newValue); TrackballCamera camera = joglContext.getScene().getCamera(); if(radiobuttonOrthographicCamera.isSelected()){ camera.setOrthographic(camera.getLeft(), camera.getRight(), camera.getTop(), camera.getBottom(), camera.getNearOrtho(), far); joglContext.updateCamera(); joglContext.refresh(); }else{ camera.setPerspective(camera.getFovy(), camera.getAspect(), camera.getNearPersp(), far); joglContext.updateCamera(); joglContext.refresh(); } joglContext.refresh(); }catch(Exception e){} } }); */ comboBoxScalarField.setItems(comboBoxAttributeToShow.getItems()); comboBoxScalarField.getItems().addListener(new ListChangeListener<String>() { @Override public void onChanged(ListChangeListener.Change<? extends String> c) { if (c.getList().size() > 0) { comboBoxScalarField.getSelectionModel().selectFirst(); } } }); checkMenuItemShowColorScale.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { viewer3D.getScene().getSceneObject("color scale").setVisible(newValue); viewer3D.getJoglContext().refresh(); } }); ToggleGroup group = new ToggleGroup(); radiobuttonDisplay.setToggleGroup(group); radiobuttonDontDisplay.setToggleGroup(group); CombinedFilter combFilter1 = new CombinedFilter(new Filter("x", 0.0f, Filter.EQUAL), null, CombinedFilter.AND); CombinedFilter combFilter2 = new CombinedFilter(new Filter("x", Float.NaN, Filter.EQUAL), null, CombinedFilter.AND); listviewFilters.getItems().add(new CombinedFilterItem("PadBVTotal", false, combFilter1.getFilter1(), combFilter1.getFilter2(), combFilter1.getType())); listviewFilters.getItems().add(new CombinedFilterItem("PadBVTotal", false, combFilter2.getFilter1(), combFilter2.getFilter2(), combFilter2.getType())); }
From source file:fr.d4delta.launcher.Launcher.java
License:Open Source License
private void downloadDependency(Dependency dependency) { dependency.downloadPom();//from w w w . j a va2 s .c o m Element pomRoot; try { pomRoot = new SAXBuilder().build(dependency.pom).getRootElement(); } catch (JDOMException | IOException ex) { callback.pomLoadError(dependency, ex); Utils.purge(dependency.folder); return; } Namespace namespace = pomRoot.getNamespace(); loadProperties(pomRoot, namespace); registerRepositories(pomRoot, namespace); for (DependencyType t : types) { if (t.download(dependency, pomRoot, callback)) { dependency.updatePreferedRepoFile(); isLoaded.put(dependency.groupId + dependency.artifactId + dependency.version, Boolean.TRUE); loadReferences(pomRoot, namespace); return; } } }
From source file:io.smartspaces.workbench.project.jdom.JdomProjectGroupTemplateSpecificationReader.java
License:Apache License
/** * Create a project group from a given element. * * @param rootElement// www . j a v a2 s . c o m * input element * * @return new specification */ private GroupProjectTemplateSpecification makeFromElement(Element rootElement) { Namespace namespace = rootElement.getNamespace(); GroupProjectTemplateSpecification groupProjectTemplateSpecification = new GroupProjectTemplateSpecification(); List<Element> children = getChildren(rootElement); for (Element child : children) { addElementToSpec(groupProjectTemplateSpecification, namespace, child); } return groupProjectTemplateSpecification; }
From source file:io.smartspaces.workbench.project.jdom.JdomProjectReader.java
License:Apache License
/** * Process an element and return a new project. * * @param projectElement/*w ww.j a va 2s.co m*/ * element to process * * @return project representing the element */ Project makeProjectFromElement(Element projectElement) { Namespace projectNamespace = projectElement.getNamespace(); if (!PROJECT_ELEMENT_NAME_PROJECT.equals(projectElement.getName())) { throw new SimpleSmartSpacesException("Invalid project root element name " + projectElement.getName()); } // When an xi:include statement is used, the included elements do not pick // up the default namespace. if (!Namespace.NO_NAMESPACE.equals(projectNamespace)) { getLog().info(String.format("Applying default namespace '%s' to project element tree", projectNamespace.getURI())); applyDefaultNamespaceRecursively(projectElement, projectNamespace, true); } String projectType = getProjectType(projectElement); Project project = getWorkbench().getProjectTypeRegistry().newProject(projectType); project.setPlatform(getProjectPlatform(projectElement)); processPrototypeChain(project, projectNamespace, projectElement); configureProjectFromElement(project, projectNamespace, projectElement); if (project.getSmartSpacesVersionRange() == null) { getLog().warn("Did not specify a range of needed Smart Spaces versions. Setting default to " + SMARTSPACES_VERSION_RANGE_DEFAULT); project.setSmartSpacesVersionRange(SMARTSPACES_VERSION_RANGE_DEFAULT); } if (failure) { throw new SimpleSmartSpacesException("Project specification had errors"); } return project; }
From source file:io.smartspaces.workbench.project.jdom.JdomProjectReader.java
License:Apache License
/** * Recursively apply a default namespace to an element tree. This will log * instances that are changed at the root of a tree (but not elements * underneath that root).// w ww . jav a 2s . co m * * @param element * target root element * @param namespace * namespace to apply as default * @param shouldLog * {@code true} if logging should be applied to any matches */ void applyDefaultNamespaceRecursively(Element element, Namespace namespace, boolean shouldLog) { if (Namespace.NO_NAMESPACE.equals(element.getNamespace())) { if (shouldLog) { getLog().info( String.format("Applying default namespace to element tree root '%s'", element.getName())); shouldLog = false; } element.setNamespace(namespace); } for (Element child : element.getChildren()) { applyDefaultNamespaceRecursively(child, namespace, shouldLog); } }