Methods Summary |
---|
public void | addElement(java.lang.String type, java.lang.String value)
sb.append(xmlFullTag(type, replaceXMLCharacters(value)));
|
public void | addElement(java.lang.String type, int value)
addElement(type, String.valueOf(value));
|
public void | addElement(java.lang.String type, boolean value)
addElement(type, String.valueOf(value));
|
public void | closeHeadingElement(java.lang.String type)
sb.append(xmlClose(type));
|
public void | openHeadingElement(java.lang.String type, int value)
openHeadingElement(type, String.valueOf(value));
|
public void | openHeadingElement(java.lang.String type, java.lang.String value)
if (value.length() == 0)
{
sb.append(xmlOpen(type));
}
else
{
sb.append(xmlOpenHeading(type, replaceXMLCharacters(value)));
}
|
public void | openHeadingElement(java.lang.String type, boolean value)
openHeadingElement(type, String.valueOf(value));
|
public static java.lang.String | replaceXMLCharacters(java.lang.String xmlData)Replace any special xml characters with the appropiate escape sequences
required to be done for the actual element names
StringBuffer sb = new StringBuffer();
StringCharacterIterator sCI = new StringCharacterIterator(xmlData);
for (char c = sCI.first(); c != CharacterIterator.DONE; c = sCI.next())
{
switch (c)
{
case'&":
sb.append("&");
break;
case'<":
sb.append("<");
break;
case'>":
sb.append(">");
break;
case'"":
sb.append(""");
break;
case'\'":
sb.append("'");
break;
default:
sb.append(c);
}
}
return sb.toString();
|
public java.lang.String | toString()
return sb.toString();
|
public static java.lang.String | xmlCData(java.lang.String xmlData)Return CDATA tag around xml data e.g
We also need to deal with special chars
char tempChar;
StringBuffer replacedString = new StringBuffer();
for (int i = 0; i < xmlData.length(); i++)
{
tempChar = xmlData.charAt(i);
if ((Character.isLetterOrDigit(tempChar)) || (Character.isSpaceChar(tempChar)))
{
replacedString.append(tempChar);
}
else
{
replacedString.append("#x").append(Character.digit(tempChar, 16));
}
}
return xmlCDataTagOpen + replacedString + xmlCDataTagClose;
|
public static java.lang.String | xmlClose(java.lang.String xmlName)Return xml close tag around a string e.g
return xmlCloseStart + xmlName + xmlCloseEnd;
|
public static java.lang.String | xmlFullTag(java.lang.String xmlName, java.lang.String data)
return xmlOpen(xmlName) + xmlCData(data) + xmlClose(xmlName);
|
public static java.lang.String | xmlOpen(java.lang.String xmlName)Return xml open tag round a string e.g
return xmlOpenStart + xmlName + xmlOpenEnd;
|
public static java.lang.String | xmlOpenHeading(java.lang.String name, java.lang.String data)
return (xmlOpen(name + " id=\"" + data + "\""));
|
public static java.lang.String | xmlSingleTag(java.lang.String data)
return xmlOpenStart + data + xmlSingleTagClose;
|