pmp.xml
Class XMLTools

java.lang.Object
  extended by pmp.xml.XMLTools

public final class XMLTools
extends java.lang.Object

XML support routines.

Title: PMP: Macroprocessor

Description: Java macroprocessor

Copyright: Copyright (c) 2005

Version:
1.0
Author:
Luděk Hlaváček

Field Summary
static java.lang.String ATTR_ENCODING
           
static java.lang.String ATTR_FORMAT
          Common attribute for macro definitions.
static java.lang.String ATTR_NAME
          Common attribute for macro definitions.
static java.lang.String ATTR_OUTPUT_ENCODER
           
static java.lang.String ATTR_READONLY
          Allow any further changes of this macro definitions.
static java.lang.String ELEMENT_CLASS
          Load macro from given class file.
static java.lang.String ELEMENT_DEFINE
          Define macro.
static java.lang.String ELEMENT_IMPORT
          Import another configuration file.
static java.lang.String ELEMENT_LIBRARY
          Load library with class files.
static java.lang.String ELEMENT_ROOT
          Root element of configuration file.
static java.lang.String ELEMENT_UNDEF
           
static java.lang.String NAMESPACE
          Namespace.
static java.lang.String VALUE_BASE64
          Base64 encoding.
static java.lang.String VALUE_PLAIN
          No encoding.
 
Constructor Summary
XMLTools()
           
 
Method Summary
static java.lang.String exportConfig(java.util.Map<java.lang.String,AbstractMacro> macros, java.lang.String fileName)
          Exports list of macros into XML file.
static java.lang.String getElementPCDATA(org.w3c.dom.Element node)
          Returns text data from xml document element.
static java.lang.String xmlEncode(java.lang.String str)
          Encodes string to te be usable as value of element attribute or text element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMESPACE

public static final java.lang.String NAMESPACE
Namespace. Not yet used.

See Also:
Constant Field Values

ELEMENT_ROOT

public static final java.lang.String ELEMENT_ROOT
Root element of configuration file.

See Also:
Constant Field Values

ELEMENT_IMPORT

public static final java.lang.String ELEMENT_IMPORT
Import another configuration file.

See Also:
Constant Field Values

ELEMENT_LIBRARY

public static final java.lang.String ELEMENT_LIBRARY
Load library with class files.

See Also:
Constant Field Values

ELEMENT_DEFINE

public static final java.lang.String ELEMENT_DEFINE
Define macro.

See Also:
Constant Field Values

ELEMENT_CLASS

public static final java.lang.String ELEMENT_CLASS
Load macro from given class file.

See Also:
Constant Field Values

ATTR_NAME

public static final java.lang.String ATTR_NAME
Common attribute for macro definitions.

See Also:
Constant Field Values

ATTR_FORMAT

public static final java.lang.String ATTR_FORMAT
Common attribute for macro definitions. Specifies format of text in current element.

See Also:
Constant Field Values

VALUE_BASE64

public static final java.lang.String VALUE_BASE64
Base64 encoding.

See Also:
ATTR_FORMAT, Constant Field Values

VALUE_PLAIN

public static final java.lang.String VALUE_PLAIN
No encoding.

See Also:
ATTR_FORMAT, Constant Field Values

ATTR_READONLY

public static final java.lang.String ATTR_READONLY
Allow any further changes of this macro definitions.

See Also:
Constant Field Values

ATTR_OUTPUT_ENCODER

public static final java.lang.String ATTR_OUTPUT_ENCODER
See Also:
Constant Field Values

ELEMENT_UNDEF

public static final java.lang.String ELEMENT_UNDEF
See Also:
Constant Field Values

ATTR_ENCODING

public static final java.lang.String ATTR_ENCODING
See Also:
Constant Field Values
Constructor Detail

XMLTools

public XMLTools()
Method Detail

exportConfig

public static java.lang.String exportConfig(java.util.Map<java.lang.String,AbstractMacro> macros,
                                            java.lang.String fileName)
Exports list of macros into XML file.

Parameters:
macros - map with macros
fileName - name of file
Returns:
null if succeeded, otherwise error message

getElementPCDATA

public static java.lang.String getElementPCDATA(org.w3c.dom.Element node)
Returns text data from xml document element.

Parameters:
node - element
Returns:
text data from element

xmlEncode

public static java.lang.String xmlEncode(java.lang.String str)
Encodes string to te be usable as value of element attribute or text element.

Special characters &, &34;, &39;, &qt;, < are converted to XML entities.

Parameters:
str - string to be encoded
Returns:
encoded string.