Java Doc for XmlField.java in  » Database-ORM » MMBase » org » mmbase » util » transformers » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » MMBase » org.mmbase.util.transformers 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.mmbase.util.transformers.StringTransformer
      org.mmbase.util.transformers.ConfigurableStringTransformer
         org.mmbase.util.transformers.XmlField

XmlField
public class XmlField extends ConfigurableStringTransformer implements CharTransformer(Code)
XMLFields in MMBase. This class can encode such a field to several other formats.
author:
   Michiel Meeuwissen
version:
   $Id: XmlField.java,v 1.51 2007/08/04 08:09:14 michiel Exp $

Inner Class :protected static class FormatException extends java.lang.Exception
Inner Class :static class ErrorHandler implements org.xml.sax.ErrorHandler

Field Summary
final public static  intASCII
    
final public static  intHTML_BLOCK
    
final public static  intHTML_BLOCK_BR
    
final public static  intHTML_BLOCK_BR_NOSURROUNDINGP
    
final public static  intHTML_BLOCK_LIST
    
final public static  intHTML_BLOCK_LIST_BR
    
final public static  intHTML_BLOCK_LIST_BR_NOSURROUNDINGP
    
final public static  intHTML_BLOCK_LIST_NOSURROUNDINGP
    
final public static  intHTML_BLOCK_NOSURROUNDINGP
    
final public static  intHTML_INLINE
    
final protected static  booleanLEAVE_NEWLINES
    
final protected static  booleanLISTS_INSIDE_P
    
final protected static  booleanLISTS_OUTSIDE_P
    
final protected static  booleanNO_SECTIONS
    
final protected static  booleanNO_SURROUNDING_P
    
final public static  intPOORBODY
    
final protected static  booleanREMOVE_NEWLINES
    
final public static  intRICHBODY
    
final protected static  booleanSECTIONS
    
final protected static  booleanSURROUNDING_P
    
final public static  intXHTML
    

Constructor Summary
public  XmlField()
    
public  XmlField(int to)
    

Method Summary
protected static  StringXSLTransform(String xslFile, String data)
     Base function for XSL conversions.
static  voidcleanupText(StringObject obj)
     Removes all new lines and space which are too much.
public  StringgetEncoding()
    
static  voidhandleEmph(StringObject obj, char ch, String tag)
     If you want to add a _ in your text, that should be possible too... Should be done last, because no tags can appear in
Parameters:
  ch - This is '_' or e.g.
protected static  voidhandleFormat(StringObject obj, boolean format)
     Only escape, clean up.
static  voidhandleHeaders(StringObject obj)
     Some paragraphs are are really \sections.
static  voidhandleList(StringObject obj)
    
static  voidhandleNewlines(StringObject obj)
    
static  voidhandleParagraphs(StringObject obj, boolean leaveExtraNewLines, boolean surroundingP)
     Make

tags.
Parameters:
  leaveExtraNewLines - (defaults to false) if false, 2 or more newlines starts a new p.
static  voidhandleParagraphs(StringObject obj, boolean leaveExtraNewLines, boolean surroundingP, boolean placeListsInsideP)
     Make <p> </p> tags. Note that if placeListsInsideP is false, the code generated with lists becomes akin to: <p>...</p><ul>...</ul><p>...</p> If placeListsInsideP is true, the code becomes: <p>...<ul>...</ul>...</p> If there is no content in front of the first list, or after the last list, those paragraphs are empty and may not be added.
Parameters:
  leaveExtraNewLines - (defaults to false) if false, 2 or more newlines starts a new p.
protected static  voidhandleRich(StringObject obj, boolean sections, boolean leaveExtraNewLines, boolean surroundingP)
    
protected static  voidhandleRich(StringObject obj, boolean sections, boolean leaveExtraNewLines, boolean surroundingP, boolean placeListsInsideP)
    
static  voidhandleTables(StringObject obj)
     Wikipedia syntax for tables.
public static  StringpoorToHTMLInline(String data)
     So poor, that it actually generates pieces of XHTML 1.1 inlines (so, no use of section, br, p).
public static  StringpoorToXML(String data, boolean format, boolean placeListsInsideP)
     As richToXML but a little less rich.
public static  StringpoorToXML(String data, boolean format)
    
public static  StringpoorToXML(String data)
    
protected static  StringObjectprepareData(String data)
    
protected static  StringprepareDataString(String data)
    
public static  StringrichToHTMLBlock(String data, boolean multipibleBrs, boolean surroundingP, boolean placeListsInsideP)
     So poor, that it actually generates pieces of XHTML 1.1 blocks (so, no use of sections).
public static  StringrichToHTMLBlock(String data)
    
public static  StringrichToHTMLBlock(String data, boolean multipibleBrs, boolean surroundingP)
    
public static  StringrichToXML(String data, boolean format, boolean placeListsInsideP)
     Defines a kind of 'rich' text format.
public static  StringrichToXML(String data, boolean format)
    
public static  StringrichToXML(String data)
    
public  Stringtransform(String data)
    
public  StringtransformBack(String r)
    
public  Map<String, Config>transformers()
    
protected static  voidvalidate(String incoming)
    
public static  StringwikiToXML(String data, boolean placeListsInsideP)
    
public static  StringwikiToXML(String data)
    

Field Detail
ASCII
final public static int ASCII(Code)



HTML_BLOCK
final public static int HTML_BLOCK(Code)



HTML_BLOCK_BR
final public static int HTML_BLOCK_BR(Code)



HTML_BLOCK_BR_NOSURROUNDINGP
final public static int HTML_BLOCK_BR_NOSURROUNDINGP(Code)



HTML_BLOCK_LIST
final public static int HTML_BLOCK_LIST(Code)



HTML_BLOCK_LIST_BR
final public static int HTML_BLOCK_LIST_BR(Code)



HTML_BLOCK_LIST_BR_NOSURROUNDINGP
final public static int HTML_BLOCK_LIST_BR_NOSURROUNDINGP(Code)



HTML_BLOCK_LIST_NOSURROUNDINGP
final public static int HTML_BLOCK_LIST_NOSURROUNDINGP(Code)



HTML_BLOCK_NOSURROUNDINGP
final public static int HTML_BLOCK_NOSURROUNDINGP(Code)



HTML_INLINE
final public static int HTML_INLINE(Code)



LEAVE_NEWLINES
final protected static boolean LEAVE_NEWLINES(Code)



LISTS_INSIDE_P
final protected static boolean LISTS_INSIDE_P(Code)



LISTS_OUTSIDE_P
final protected static boolean LISTS_OUTSIDE_P(Code)



NO_SECTIONS
final protected static boolean NO_SECTIONS(Code)



NO_SURROUNDING_P
final protected static boolean NO_SURROUNDING_P(Code)



POORBODY
final public static int POORBODY(Code)



REMOVE_NEWLINES
final protected static boolean REMOVE_NEWLINES(Code)



RICHBODY
final public static int RICHBODY(Code)



SECTIONS
final protected static boolean SECTIONS(Code)
Constant for use as argument of XmlField.handleRich
since:
   MMBase-1.9



SURROUNDING_P
final protected static boolean SURROUNDING_P(Code)



XHTML
final public static int XHTML(Code)




Constructor Detail
XmlField
public XmlField()(Code)



XmlField
public XmlField(int to)(Code)




Method Detail
XSLTransform
protected static String XSLTransform(String xslFile, String data)(Code)
Base function for XSL conversions.



cleanupText
static void cleanupText(StringObject obj)(Code)
Removes all new lines and space which are too much.



getEncoding
public String getEncoding()(Code)



handleEmph
static void handleEmph(StringObject obj, char ch, String tag)(Code)
If you want to add a _ in your text, that should be possible too... Should be done last, because no tags can appear in
Parameters:
  ch - This is '_' or e.g. '*'
Parameters:
  tag - The tag to produce, e.g. "em" or "strong"



handleFormat
protected static void handleFormat(StringObject obj, boolean format)(Code)
Only escape, clean up.
since:
   MMBase-1.7



handleHeaders
static void handleHeaders(StringObject obj)(Code)
Some paragraphs are are really \sections. So this handler can be done after handleParagraphs. It will search the paragraphs which are really headers, and changes them. A header, in our 'rich' text format, is a paragraph starting with one or more $. If there are more then one, the resulting
tags are going to be nested.



handleList
static void handleList(StringObject obj)(Code)
Takes a string object, finds list structures and changes those to XML



handleNewlines
static void handleNewlines(StringObject obj)(Code)



handleParagraphs
static void handleParagraphs(StringObject obj, boolean leaveExtraNewLines, boolean surroundingP)(Code)
Make

tags.
Parameters:
  leaveExtraNewLines - (defaults to false) if false, 2 or more newlines starts a new p. If true, every 2 newlines starts new p, and every extra new line simply stays (inside the p).
Parameters:
  surroundingP - (defaults to true) wether the surrounding <p> should be included too.



handleParagraphs
static void handleParagraphs(StringObject obj, boolean leaveExtraNewLines, boolean surroundingP, boolean placeListsInsideP)(Code)
Make <p> </p> tags. Note that if placeListsInsideP is false, the code generated with lists becomes akin to: <p>...</p><ul>...</ul><p>...</p> If placeListsInsideP is true, the code becomes: <p>...<ul>...</ul>...</p> If there is no content in front of the first list, or after the last list, those paragraphs are empty and may not be added.
Parameters:
  leaveExtraNewLines - (defaults to false) if false, 2 or more newlines starts a new p. If true, every 2 newlines starts new p, and every extra new line simply stays (inside the p).
Parameters:
  surroundingP - (defaults to true) wether the surrounding <p> should be included too.
Parameters:
  placeListsInsideP - (defaults to false) wether a list should be placed inside a <p> (as allowed by xhtml2).



handleRich
protected static void handleRich(StringObject obj, boolean sections, boolean leaveExtraNewLines, boolean surroundingP)(Code)



handleRich
protected static void handleRich(StringObject obj, boolean sections, boolean leaveExtraNewLines, boolean surroundingP, boolean placeListsInsideP)(Code)



handleTables
static void handleTables(StringObject obj)(Code)
Wikipedia syntax for tables. (simplified)
 {|
 | a || b || c
 |-
 | d || e || f
 |}
 
or e.g.
 {|-
 |+ caption
 ! A !! B !! C
 |-
 | d
 | e
 | f
 |}
 

since:
   MMBase 1.8



poorToHTMLInline
public static String poorToHTMLInline(String data)(Code)
So poor, that it actually generates pieces of XHTML 1.1 inlines (so, no use of section, br, p).
since:
   MMBase-1.7



poorToXML
public static String poorToXML(String data, boolean format, boolean placeListsInsideP)(Code)
As richToXML but a little less rich. Which means that only one new line is non significant.
See Also:   XmlField.richToXML



poorToXML
public static String poorToXML(String data, boolean format)(Code)



poorToXML
public static String poorToXML(String data)(Code)



prepareData
protected static StringObject prepareData(String data)(Code)



prepareDataString
protected static String prepareDataString(String data)(Code)



richToHTMLBlock
public static String richToHTMLBlock(String data, boolean multipibleBrs, boolean surroundingP, boolean placeListsInsideP)(Code)
So poor, that it actually generates pieces of XHTML 1.1 blocks (so, no use of sections).
See Also:   XmlField.richToXML
since:
   MMBase-1.7



richToHTMLBlock
public static String richToHTMLBlock(String data)(Code)



richToHTMLBlock
public static String richToHTMLBlock(String data, boolean multipibleBrs, boolean surroundingP)(Code)



richToXML
public static String richToXML(String data, boolean format, boolean placeListsInsideP)(Code)
Defines a kind of 'rich' text format. This is a way to easily type structured text in XML. The XML tags which can be produced by this are all HTML as well. This is a generalisation of the MMBase html() functions which does similar duties, but hopefully this one is better, and more powerfull too. The following things are recognized:
  • Firstly, XMLEscape is called.
  • A line starting with an asterix (*) will start an unnumberd list. The first new line not starting with a space or an other asterix will end the list
  • Underscores are translated to the emphasize HTML-tag
  • You can create a header tag by by starting a line with a dollar signs
  • A paragraph can be begun (and ended) with an empty line.
Test with commandline: java org.mmbase.util.Encode RICH_TEXT (reads from STDIN)
Parameters:
  data - text to convert
Parameters:
  format - if the resulting XML must be nicely formatted (default: false) the converted text



richToXML
public static String richToXML(String data, boolean format)(Code)



richToXML
public static String richToXML(String data)(Code)



transform
public String transform(String data)(Code)



transformBack
public String transformBack(String r)(Code)



transformers
public Map<String, Config> transformers()(Code)



validate
protected static void validate(String incoming) throws FormatException(Code)



wikiToXML
public static String wikiToXML(String data, boolean placeListsInsideP)(Code)



wikiToXML
public static String wikiToXML(String data)(Code)



Fields inherited from org.mmbase.util.transformers.ConfigurableStringTransformer
protected int to(Code)(Java Doc)

Methods inherited from org.mmbase.util.transformers.ConfigurableStringTransformer
public void configure(int t)(Code)(Java Doc)
abstract public String getEncoding()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
abstract public Map<String, Config> transformers()(Code)(Java Doc)

Methods inherited from org.mmbase.util.transformers.StringTransformer
abstract public String transform(String r)(Code)(Java Doc)
final public Writer transform(Reader r)(Code)(Java Doc)
public Writer transform(Reader r, Writer w)(Code)(Java Doc)
final public Writer transformBack(Reader r)(Code)(Java Doc)
public String transformBack(String r)(Code)(Java Doc)
public Writer transformBack(Reader r, Writer w)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.