Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners XML remove tags
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Varsha Yadav
XML remove tags
3 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners


when i remove a tag from xml, it create blank spaces or next line. how i protect it to updae in my xml


Advertisement
View Answers

August 19, 2013 at 4:45 PM


Hello Varsha,

DOM objects always bahave a emty line when you are going to remove a XML Node.

USE the below option to remove empty line

print("try{
        Scanner scanner = new Scanner(new File(filepath));
        PrintStream out = new PrintStream(new File("outfile.xml"));
        while(scanner.hasNextLine()){
            String line = scanner.nextLine();
            String ol = line;
            line = line.trim();
            if(line.length() > 0)
                out.println(ol);
        }
        out.close();
        scanner.close();
        ret = "Empty lines removed....";
    }catch(Exception e){}");


August 19, 2013 at 4:45 PM


Hello Varsha,

DOM objects always bahave a emty line when you are going to remove a XML Node.

USE the below option to remove empty line

print("try{
        Scanner scanner = new Scanner(new File(filepath));
        PrintStream out = new PrintStream(new File("outfile.xml"));
        while(scanner.hasNextLine()){
            String line = scanner.nextLine();
            String ol = line;
            line = line.trim();
            if(line.length() > 0)
                out.println(ol);
        }
        out.close();
        scanner.close();
        ret = "Empty lines removed....";
    }catch(Exception e){}");


August 19, 2013 at 4:45 PM


Hello Varsha,

DOM objects always bahave a emty line when you are going to remove a XML Node.

USE the below option to remove empty line

print("try{
        Scanner scanner = new Scanner(new File(filepath));
        PrintStream out = new PrintStream(new File("outfile.xml"));
        while(scanner.hasNextLine()){
            String line = scanner.nextLine();
            String ol = line;
            line = line.trim();
            if(line.length() > 0)
                out.println(ol);
        }
        out.close();
        scanner.close();
        ret = "Empty lines removed....";
    }catch(Exception e){}");


Related Tutorials/Questions & Answers:
XML remove tags
XML remove tags  how i update a tag from xml file
XML remove tags
XML remove tags  when i remove a tag from xml, it create blank spaces or next line. how i protect it to updae in my xml
Advertisements
Tags in XML - XML
Tags in XML  What are the Tags of XML  In XML there is no predefined tag. Every user can write their own tags at the time of creating it or later. You can define as many tag as you want according to your requirement
tags in xml - XML
tags in xml  Can I use : (colon )in xml tag? For ex. Is this valid?  Hi Friend, You can use colon(:) in XML tag.But is not valid. Thanks
Regular Expression for removing XML Tags
Regular Expression for removing XML Tags  Hi, Good Afternoon.I want a Regular expression in java which is removing the XML Tags in the specified... after applying regular expression is only "How are you".Need to remove all XML
how to remove tags in HTML without functionalities? - Java Beginners
how to remove tags in HTML without functionalities?  hi to all, I create an application for converting html to ppt in java. And in this i convert the text from html to ppt and i able to remove the HTML tags from .html code
Use of Core XML tags in JSP
Use of Core XML tags in JSP   ... Tags: Core XML tags provides access to XML data and used to parse these data. There are three tags in this Core XML tag set. 1. <x:out> : This tag
JSTL XML Tags
JSTL XML Tags No one can have any second opinion about the elegance of xml... and such terms, and it may have been none too easy to learn. But the xml tags... to study them. Making our study even easier, many of the xml tags in JSTL
i want to remove specific node in xml file
i want to remove specific node in xml file   <A> <B>hi <C>by <A> <B>hellow <C>how r u ? i want to delet node which is == hellow using java program please help me . tanks in advance
Remove Element from XML Document
Remove Element from XML Document       In this section, you will learn to remove any element from a given  XML document. Whenever you remove the xml element from the xml document
Solution to get vaues for xml tags fform sql database in java
Solution to get vaues for xml tags fform sql database in java  hi I have written a code in java to get these xml tags < company comp:loc=" "/>...(" "). how do i get these values.. already connected database and created xml tags
Want solution to get values for xml namespace tags from database in java
Want solution to get values for xml namespace tags from database in java  hi I have written a code in java to get these xml tags < company comp... xml tags in separate file. please provide me solution to get values for xml tags
solution to get values for xml namespace tags from sqldatabase in java
solution to get values for xml namespace tags from sqldatabase in java  hi I have written a code in java to get these xml tags < company comp:loc... tags in separate file. please provide me solution to get values for xml tags
JDOM Element Example, How to remove attribute of xml element in java.
JDOM Element Example, How to remove attribute of xml element in java. In this tutorial, we will see how to remove attribute of xml element in java with the help of JDOM library. It is a java tool kit for xml parsing. With the help
XML
XML  please tell me how i remove one tag out of all similar type of tags in xml
JDOM Element Example, How to add and remove child from xml file.
JDOM Element Example, How to add and remove child from xml file. In this tutorial, we will see how to add and remove child node in an xml Document tree. We can add child any where in xml document tree with the help of JDOM API
Need solution to get values for XML namespace tags from SQL database in Java
Need solution to get values for XML namespace tags from SQL database in Java  hi I have written a code in java to get these xml tags < company... and created xml tags in separate file. please provide me solution to get values for xml
JSTL XML Tags
JSTL XML Tags       PART-4 - JSTL  &  SQL-TAGS   Tutorial Home | Part 1... on JSTL,the author deals with the 'sql' tags in JSTL  and shows how
JSTL XML Tags
in this tutorial you will learn JSTL XML examples
JDOM Element Example, How to remove child of an element from xml file in java.
JDOM Element Example, How to remove child of an element from xml file in java. In this tutorial, we will see how to remove child of an element from xml file... for manipulating, creating and serializing  xml file. With the help of this java
JSP custom tags
JSP custom tags       JSP custom tags are the user-defined following a special XML syntax to which JavaBean tags (useBean getProperty and setProperty) uses. When Servlet container
JSTL XML Tags Part 2
In this tutorial you will learn some more example about JSTL XML
XML
XML  How i remove a tag from xml and update it in my xml
xml
xml  how can i remove white space and next line when i copy stream to xml file
Remove history
Remove history  how to remove history in struts2 after clicking on logout link
html tags
html tags  html tags   Java Struts HTML Tags
XML - XML
language much like HTML used to describe data. In XML, tags are not predefined. A user defines his own tags and XML document structure like Document Type...XML  What is specific definatio of XML? Tell us about marits
JSP Tags
JSP Tags  Defined JSP Tags?   Tags are a vital concept in Java Server Pages (JSP). Below is a list of tags used in JSP. This section... and explanations for both. List of the tags Declaration tag Expression tag
struts tags
struts tags  I want develop web pages using struts tags please help me,but i searched many sites but that sites doesn't give correct information. examples of struts tags are   Hi Friend, Please visit the following
JSP Tags
JSP Tags In this section we will learn about the JSP tags. This section describes you about the various aspects of JSP tags such as what is JSP tag, list of JSP tags, JSP custom tags and many more things. What is JSP Tags ? Tags
tags in struts2
tags in struts2  Hello I am using simple tags in struts2. Like this <%@ page language="java" contentType="text/html; charset=ISO-8859-1...-tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN
Advertisements
 

 

 

DMCA.com