Class XMLwriter
java.lang.Object
org.ampere.base.xml.XMLwriter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildXMLtextValue(String input) build an XML text value by removing any special characters.voidclose()close the XML filevoidcloseDeclaration(boolean newLine) voidclose an element and print an new line.voidcloseElement(boolean newLine) close an elementvoidcloseElement(String element) Close an element, i.e. write in the XML document </element> and print a new line.voidcloseElement(String element, boolean newLine) Close an element, i.e. write in the XML document </element>voidClose an element, i.e. write the the mark ">" and then print a new line.voidcloseMark(boolean newLine) Close an element, i.e. write the the mark ">"voidopenElement(String name) Write a simple elementvoidopenElement(String name, boolean closed) Write a simple element ended by a newlinevoidopenElement(String name, boolean closed, boolean newline) Write a simple elementvoidprintElement(String elementTag, String value) print a one line element with a string valuevoidwriteAttribute(String name, boolean value) write a boolean attributevoidwriteAttribute(String name, double value) Write a double attribute.voidwriteAttribute(String name, int value) Write a integrer attributevoidwriteAttribute(String name, String value) write a string attributevoidwriteCDATA(String code) Write a simple contentvoidwriteDoctype(String doctype) voidwriteHeader(boolean standalone) write the header of the XML fileprotected voidWrite a name with its possible name spacevoidwritenl()Print a new line.voidwritePublicDocType(String type, String resource, String system) Write a public doctype with a DTD referencevoidwriteRootElement(String name, String xsdFile) voidWrite a simple tag, i.e.voidwrite a simple textvoidwriteTextElement(String tag, String text) write a simple text as a tag
-
Field Details
-
DEFAULT_DOUBLE_FORMAT
- See Also:
-
stream
Output stream
-
-
Constructor Details
-
XMLwriter
-
-
Method Details
-
writeName
Write a name with its possible name space- Parameters:
name- name to be written
-
writeTag
Write a simple tag, i.e. <tag>- Parameters:
tag- value of the tag to be written
-
writeHeader
public void writeHeader(boolean standalone) write the header of the XML file- Parameters:
standalone- flag specifying that the XML file is standalone or not
-
writePublicDocType
-
writeDoctype
-
writeRootElement
-
openElement
Write a simple element- Parameters:
name- element nameclosed- flag specifying if the element tag has to be closed or not.newline- flag specifying if the writing is finished by a new line or not.
-
openElement
Write a simple element ended by a newline- Parameters:
name- element nameclosed- flag specifying if the element tag has to be closed or not.
-
openElement
-
closeMark
public void closeMark(boolean newLine) Close an element, i.e. write the the mark ">"- Parameters:
newLine- flag specifying if a new line has to be printed or not
-
closeMark
public void closeMark()Close an element, i.e. write the the mark ">" and then print a new line. -
printElement
-
writenl
public void writenl()Print a new line. -
writeCDATA
-
writeText
write a simple text -
writeTextElement
-
writeAttribute
-
writeAttribute
Write a double attribute. The double format of the writer is used.- Parameters:
name- attribute namevalue- double value
-
writeAttribute
Write a integrer attribute- Parameters:
name- attribute namevalue- integer value
-
writeAttribute
write a boolean attribute -
closeElement
Close an element, i.e. write in the XML document </element>- Parameters:
element- name of the elementnewLine- flag specifying is a new line is printed or not
-
closeElement
Close an element, i.e. write in the XML document </element> and print a new line.- Parameters:
element- name of the element
-
closeDeclaration
public void closeDeclaration(boolean newLine) -
closeElement
public void closeElement(boolean newLine) close an element- Parameters:
newLine- flag specifying if a new line has to be printed or not.
-
closeElement
public void closeElement()close an element and print an new line. -
close
public void close()close the XML file -
buildXMLtextValue
-