Java Doc for DigestReader.java in  » Scripting » Pnuts » pnuts » xml » 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 » Scripting » Pnuts » pnuts.xml 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


pnuts.xml.DigestHandler
   pnuts.xml.DigestReader

DigestReader
public class DigestReader extends DigestHandler (Code)
DigestReader is used to retrieve useful information, for the application, from a XML document.

XML documents are processed based on user-defined 'rules', which consists of [Action, Path, Key].

Action
A DigestAction object, or the associated name of the action.
Path
Qualified Names separated by slash (/). Wildcard (*) can be used instead of actual names. When Path starts with '//', it is used to match sub-elements. (e.g., /a/b/c, /a/ * /c, //b/c, // *)
Key
the key to access the intermediate result. If omitted, the relative path to the nearest ancestor node is implicitly defined.

Those rules can be defined with the setRules() method or addRule() method.

User can define the action names with setAlias() method, passing a Map of String->DigestAction.

One of parse() methods processes a XML document based on the rules.

An example:

 import pnuts.xml.*;
 import pnuts.xml.action.*;
 DigestReader dr = new DigestReader();
 DigestAction text = new TextAction();
 DigestAction list = new ListAction();
 DigestAction map = new MapAction();
 Object[][] rules = {{text, "/rss/channel/title", "title"},
 {text, "/rss/channel/link", "link"},
 {text, "/rss/channel/description", "description"},
 {list, "/rss/channel/item", "item"},
 {text, "/rss/channel/item/title"},
 {text, "/rss/channel/item/link"},
 {text, "/rss/channel/item/description"}};
 dr.setRules(rules);
 Map doc = (Map)dr.parse(new FileInputStream("rss.xml"));
 

Inner Class :static class NullInputStream extends InputStream


Constructor Summary
public  DigestReader()
    
public  DigestReader(Object[][] defs)
    
public  DigestReader(SAXParser parser)
    
public  DigestReader(SAXParser parser, Object[][] defs)
    

Method Summary
public  MapgetAliases()
    
static  SAXParsergetDefaultParser()
    
public  Objectparse(InputSource input, Object value)
     Processes a XML document with the registered rules, and return the result.
public  Objectparse(InputStream input, Object value)
     Processes a XML document with the registered rules, and return the result.
public  Objectparse(InputSource input)
     Processes a XML document with the registered rules, and return the result.
public  Objectparse(InputStream input)
     Processes a XML document with the registered rules, and return the result.
public  InputSourceresolveEntity(String publicId, String systemId)
    
public  voidsetAliases(Map map)
    
public  voidsetRules(Object[][] defs)
    


Constructor Detail
DigestReader
public DigestReader()(Code)
Constructor



DigestReader
public DigestReader(Object[][] defs)(Code)
Constructor
Parameters:
  defs - the rules that consist of 'Action', 'Path', and optional 'Key'.
Action
A DigestAction object, or the associated name of the action.
Path
A path identifier, which is a '/'-separated qualified names
Key
the key to access the intermediate result.



DigestReader
public DigestReader(SAXParser parser)(Code)
Constructor
Parameters:
  parser - a SAX parser



DigestReader
public DigestReader(SAXParser parser, Object[][] defs)(Code)
Constructor
Parameters:
  parser - a SAX parser
Parameters:
  defs - the rules that consist of 'Action', 'Path', and optional 'Key'.
Action
A DigestAction object, or the associated name of the action.
Path
A path identifier, which is a '/'-separated qualified names
Key
the key to access the intermediate result.




Method Detail
getAliases
public Map getAliases()(Code)
Retrieves the alias map the alias map; ActionName -> DigestAction



getDefaultParser
static SAXParser getDefaultParser()(Code)



parse
public Object parse(InputSource input, Object value) throws org.xml.sax.SAXException, IOException(Code)
Processes a XML document with the registered rules, and return the result.
Parameters:
  input - an input source
Parameters:
  value - an initial value passed to the digest handler the object specified to value



parse
public Object parse(InputStream input, Object value) throws org.xml.sax.SAXException, IOException(Code)
Processes a XML document with the registered rules, and return the result.
Parameters:
  input - an input stream
Parameters:
  value - an initial value passed to the digest handler the object specified to value



parse
public Object parse(InputSource input) throws org.xml.sax.SAXException, IOException(Code)
Processes a XML document with the registered rules, and return the result.
Parameters:
  input - an input source a Map object implicitly given.



parse
public Object parse(InputStream input) throws org.xml.sax.SAXException, IOException(Code)
Processes a XML document with the registered rules, and return the result.
Parameters:
  input - an input stream a Map object implicitly given.



resolveEntity
public InputSource resolveEntity(String publicId, String systemId) throws org.xml.sax.SAXException(Code)



setAliases
public void setAliases(Map map)(Code)
Defines the alias map; ActionName -> DigestAction
Parameters:
  map - the alias map



setRules
public void setRules(Object[][] defs)(Code)
Sets the rules
Parameters:
  defs - the rules that consist of 'Action', 'Path', and optional 'Key'.
Action
A DigestAction object, or the associated name of the action.
Path
A path identifier, which is a '/'-separated qualified names
Key
the key to access the intermediate result.



Fields inherited from pnuts.xml.DigestHandler
Stack listPaths(Code)(Java Doc)
Stack listValues(Code)(Java Doc)

Methods inherited from pnuts.xml.DigestHandler
public void addRule(DigestAction action, String path)(Code)(Java Doc)
public void addRule(DigestAction action, String path, String keyword)(Code)(Java Doc)
public void characters(char ch, int start, int length) throws org.xml.sax.SAXException(Code)(Java Doc)
public Object currentListValue()(Code)(Java Doc)
public void endElement(String uri, String localName, String qName) throws org.xml.sax.SAXException(Code)(Java Doc)
String getKey(String path)(Code)(Java Doc)
String getStackTopPath()(Code)(Java Doc)
Object getStackTopValue()(Code)(Java Doc)
public Object getValue()(Code)(Java Doc)
void initialize()(Code)(Java Doc)
public boolean isUseLocalNames()(Code)(Java Doc)
public boolean listAlive(String path)(Code)(Java Doc)
Object popValue()(Code)(Java Doc)
void pushValue(String path, Object value)(Code)(Java Doc)
public synchronized void registerListPath(String path, Object list)(Code)(Java Doc)
static boolean sameBranch(String longer, String shorter)(Code)(Java Doc)
void setRuleSet(RuleSet ruleSet)(Code)(Java Doc)
public void setUseLocalNames(boolean useLocalNames)(Code)(Java Doc)
public void setValue(Object value)(Code)(Java Doc)
public void startDocument() throws org.xml.sax.SAXException(Code)(Java Doc)
public void startElement(String uri, String localName, String qName, Attributes attributes) throws org.xml.sax.SAXException(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.