Java Doc for NamePool.java in  » XML » saxonb » net » sf » saxon » om » 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 » XML » saxonb » net.sf.saxon.om 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sf.saxon.om.NamePool

NamePool
public class NamePool implements Serializable(Code)
An object representing a collection of XML names, each containing a Namespace URI, a Namespace prefix, and a local name; plus a collection of namespaces, each consisting of a prefix/URI pair.

The equivalence betweem names depends only on the URI and the local name. The prefix is retained for documentary purposes only: it is useful when reconstructing a document to use prefixes that the user is familiar with.

The NamePool eliminates duplicate names if they have the same prefix, uri, and local part. It retains duplicates if they have different prefixes


author:
   Michael H. Kay

Inner Class :public static class NamePoolLimitException extends RuntimeException

Field Summary
final public static  intFP_MASK
     FP_MASK is a mask used to obtain a fingerprint from a nameCode.
 NameEntry[]hashslots
    
 String[]prefixes
    
 String[]prefixesForUri
    
 shortprefixesUsed
    
 String[]uris
    
 shorturisUsed
    

Constructor Summary
public  NamePool()
    

Method Summary
public synchronized  intallocate(String prefix, String uri, String localName)
     Allocate a name from the pool, or a new Name if there is not a matching one there
Parameters:
  prefix -
Parameters:
  uri - - the namespace URI.
public synchronized  intallocate(String prefix, short uriCode, String localName)
    
public  intallocateClarkName(String expandedName)
    
public synchronized  shortallocateCodeForURI(String uri)
    
public  intallocateLexicalQName(CharSequence qname, boolean useDefault, NamespaceResolver resolver, NameChecker checker)
     Get the nameCode for a lexical QName, given a namespace resolver.
Parameters:
  qname - the lexical QName.
Parameters:
  useDefault - if true, an absent prefix is resolved by the NamespaceResolverto the namespace URI assigned to the prefix "".
public synchronized  intallocateNamespaceCode(String prefix, String uri)
     Allocate the namespace code for a namespace prefix/URI pair. Create it if not already present
Parameters:
  prefix - the namespace prefix
Parameters:
  uri - the namespace URI an integer code identifying the namespace.
public synchronized  intallocateNamespaceCode(int namecode)
     Allocate a namespace code for the prefix/URI of a given namecode
Parameters:
  namecode - a code identifying an expanded QName, e.g.
public synchronized  voiddiagnosticDump()
     Diagnostic print of the namepool contents.
public  StringgetClarkName(int nameCode)
     Get the Clark form of a name, given its name code or fingerprint the local name if the name is in the null namespace, or "{uri}local"otherwise.
public  ObjectgetClientData(Class key)
    
public  shortgetCodeForPrefix(String prefix)
    
public  shortgetCodeForURI(String uri)
    
public static  NamePoolgetDefaultNamePool()
    
public  StringgetDisplayName(int nameCode)
    
public  intgetFingerprint(String uri, String localName)
     Get a fingerprint for the name with a given uri and local name. These must be present in the NamePool. The fingerprint has the property that if two fingerprint are the same, the names are the same (ie.
public  intgetFingerprintForExpandedName(String expandedName)
    
public  StringgetLocalName(int nameCode)
    
public  intgetNamespaceCode(String prefix, String uri)
     Get the existing namespace code for a namespace prefix/URI pair.
public  intgetNamespaceCode(int namecode)
     Allocate a namespace code for a given namecode
Parameters:
  namecode - a code identifying an expanded QName, e.g.
public  StringgetPrefix(int nameCode)
    
public  StringgetPrefixFromNamespaceCode(int code)
     Get the namespace prefix from a namespace code.
public  StringgetPrefixWithIndex(short uriCode, int index)
    
final public  TypeHierarchygetTypeHierarchy()
    
public  StringgetURI(int nameCode)
    
public  shortgetURICode(int nameCode)
    
public  StringgetURIFromNamespaceCode(int code)
     Get the namespace URI from a namespace code.
public  StringgetURIFromURICode(short code)
     Get the namespace URI from a URI code.
public static  String[]parseClarkName(String expandedName)
    
public  voidsetClientData(Class key, Object value)
    
public static  voidsetDefaultNamePool(NamePool pool)
    
public synchronized  voidstatistics()
     Statistics summarizing the namepool contents.
public  StringsuggestPrefixForURI(String URI)
     Suggest a prefix for a given URI.

Field Detail
FP_MASK
final public static int FP_MASK(Code)
FP_MASK is a mask used to obtain a fingerprint from a nameCode. Given a nameCode nc, the fingerprint is nc & NamePool.FP_MASK. (In practice, Saxon code often uses the literal constant 0xfffff.) The difference between a nameCode is that a nameCode contains information about the prefix of a name, the fingerprint depends only on the namespace URI and local name. Note that the "null" nameCode (-1) does not produce the "null" fingerprint (also -1) when this mask is applied.



hashslots
NameEntry[] hashslots(Code)



prefixes
String[] prefixes(Code)



prefixesForUri
String[] prefixesForUri(Code)



prefixesUsed
short prefixesUsed(Code)



uris
String[] uris(Code)



urisUsed
short urisUsed(Code)




Constructor Detail
NamePool
public NamePool()(Code)




Method Detail
allocate
public synchronized int allocate(String prefix, String uri, String localName)(Code)
Allocate a name from the pool, or a new Name if there is not a matching one there
Parameters:
  prefix -
Parameters:
  uri - - the namespace URI. The null URI is represented as an empty string.
Parameters:
  localName - an integer (the "namecode") identifying the name within the namepool.The Name itself may be retrieved using the getName(int) method



allocate
public synchronized int allocate(String prefix, short uriCode, String localName)(Code)
Allocate a name from the pool, or a new Name if there is not a matching one there
Parameters:
  prefix - - the namespace prefix
Parameters:
  uriCode - - the code of the URI
Parameters:
  localName - - the local part of the QName an integer (the "namecode") identifying the name within the namepool.



allocateClarkName
public int allocateClarkName(String expandedName)(Code)
Allocate a fingerprint given a Clark Name



allocateCodeForURI
public synchronized short allocateCodeForURI(String uri)(Code)
Allocate the uri code for a given URI; create one if not found



allocateLexicalQName
public int allocateLexicalQName(CharSequence qname, boolean useDefault, NamespaceResolver resolver, NameChecker checker) throws DynamicError(Code)
Get the nameCode for a lexical QName, given a namespace resolver.
Parameters:
  qname - the lexical QName.
Parameters:
  useDefault - if true, an absent prefix is resolved by the NamespaceResolverto the namespace URI assigned to the prefix "". If false, an absent prefix isinterpreted as meaning the name is in no namespace.
Parameters:
  checker - NameChecker used to check names against the XML 1.0 or 1.1 specification the corresponding nameCode
throws:
  net.sf.saxon.trans.DynamicError - if the string is not a valid lexical QName orif the namespace prefix has not been declared*



allocateNamespaceCode
public synchronized int allocateNamespaceCode(String prefix, String uri)(Code)
Allocate the namespace code for a namespace prefix/URI pair. Create it if not already present
Parameters:
  prefix - the namespace prefix
Parameters:
  uri - the namespace URI an integer code identifying the namespace. The namespace codeidentifies both the prefix and the URI.



allocateNamespaceCode
public synchronized int allocateNamespaceCode(int namecode)(Code)
Allocate a namespace code for the prefix/URI of a given namecode
Parameters:
  namecode - a code identifying an expanded QName, e.g. of an element or attribute a code identifying the namespace used in the given name. The namespace codeidentifies both the prefix and the URI.



diagnosticDump
public synchronized void diagnosticDump()(Code)
Diagnostic print of the namepool contents.



getClarkName
public String getClarkName(int nameCode)(Code)
Get the Clark form of a name, given its name code or fingerprint the local name if the name is in the null namespace, or "{uri}local"otherwise. The name is always interned.



getClientData
public Object getClientData(Class key)(Code)
Retrieve client data on behalf of a user of the namepool



getCodeForPrefix
public short getCodeForPrefix(String prefix)(Code)
Get the prefix code for a given Prefix -1 if not found



getCodeForURI
public short getCodeForURI(String uri)(Code)
Get the uri code for a given URI -1 if not present in the name pool



getDefaultNamePool
public static NamePool getDefaultNamePool()(Code)
Get the singular default NamePool



getDisplayName
public String getDisplayName(int nameCode)(Code)
Get the display form of a name (the QName), given its name code or fingerprint



getFingerprint
public int getFingerprint(String uri, String localName)(Code)
Get a fingerprint for the name with a given uri and local name. These must be present in the NamePool. The fingerprint has the property that if two fingerprint are the same, the names are the same (ie. same local name and same URI). -1 if not found



getFingerprintForExpandedName
public int getFingerprintForExpandedName(String expandedName)(Code)
Get fingerprint for expanded name in {uri}local format



getLocalName
public String getLocalName(int nameCode)(Code)
Get the local part of a name, given its name code or fingerprint



getNamespaceCode
public int getNamespaceCode(String prefix, String uri)(Code)
Get the existing namespace code for a namespace prefix/URI pair. -1 if there is none present



getNamespaceCode
public int getNamespaceCode(int namecode)(Code)
Allocate a namespace code for a given namecode
Parameters:
  namecode - a code identifying an expanded QName, e.g. of an element or attribute a code identifying the namespace used in the given name. The namespace codeidentifies both the prefix and the URI. Return -1 if no namespace code has been allocated(in this case the caller should call allocateNamespaceCode() to get one).



getPrefix
public String getPrefix(int nameCode)(Code)
Get the prefix part of a name, given its name code or fingerprint



getPrefixFromNamespaceCode
public String getPrefixFromNamespaceCode(int code)(Code)
Get the namespace prefix from a namespace code.



getPrefixWithIndex
public String getPrefixWithIndex(short uriCode, int index)(Code)
Get a prefix among all the prefixes used with a given URI, given its index null if not found



getTypeHierarchy
final public TypeHierarchy getTypeHierarchy()(Code)
Get the TypeHierarchy



getURI
public String getURI(int nameCode)(Code)
Get the namespace-URI of a name, given its name code or fingerprint



getURICode
public short getURICode(int nameCode)(Code)
Get the URI code of a name, given its name code or fingerprint



getURIFromNamespaceCode
public String getURIFromNamespaceCode(int code)(Code)
Get the namespace URI from a namespace code.



getURIFromURICode
public String getURIFromURICode(short code)(Code)
Get the namespace URI from a URI code.



parseClarkName
public static String[] parseClarkName(String expandedName)(Code)
Parse a Clark-format expanded name, returning the URI and local name



setClientData
public void setClientData(Class key, Object value)(Code)
Save client data on behalf of a user of the namepool



setDefaultNamePool
public static void setDefaultNamePool(NamePool pool)(Code)
Set the default NamePool (used after loading a compiled stylesheet)



statistics
public synchronized void statistics()(Code)
Statistics summarizing the namepool contents. This method outputs summary statistical information to System.err



suggestPrefixForURI
public String suggestPrefixForURI(String URI)(Code)
Suggest a prefix for a given URI. If there are several, it's undefined which one is returned. If there are no prefixes registered for this URI, return null.



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.