Java Doc for Resolver.java in  » 6.0-JDK-Modules » jaxb-xjc » com » sun » xml » dtdparser » 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 » 6.0 JDK Modules » jaxb xjc » com.sun.xml.dtdparser 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.xml.dtdparser.Resolver

Resolver
public class Resolver implements EntityResolver(Code)
This entity resolver class provides a number of utilities which can help managment of external parsed entities in XML. These are commonly used to hold markup declarations that are to be used as part of a Document Type Declaration (DTD), or to hold text marked up with XML.

Features include:

  • Static factory methods are provided for constructing SAX InputSource objects from Files, URLs, or MIME objects. This eliminates a class of error-prone coding in applications.

  • Character encodings for XML documents are correctly supported:

    • The encodings defined in the RFCs for MIME content types (2046 for general MIME, and 2376 for XML in particular), are supported, handling charset=... attributes and accepting content types which are known to be safe for use with XML;

    • The character encoding autodetection algorithm identified in the XML specification is used, and leverages all of the JDK 1.1 (and later) character encoding support.

    • The use of MIME typing may optionally be disabled, forcing the use of autodetection, to support web servers which don't correctly report MIME types for XML. For example, they may report text that is encoded in EUC-JP as being US-ASCII text, leading to fatal errors during parsing.

    • The InputSource objects returned by this class always have a java.io.Reader available as the "character stream" property.

  • Catalog entries can map public identifiers to Java resources or to local URLs. These are used to reduce network dependencies and loads, and will often be used for external DTD components. For example, packages shipping DTD files as resources in JAR files can eliminate network traffic when accessing them, and sites may provide local caches of common DTDs. Note that no particular catalog syntax is supported by this class, only the notion of a set of entries.

Subclasses can perform tasks such as supporting new URI schemes for URIs which are not URLs, such as URNs (see RFC 2396) or for accessing MIME entities which are part of a multipart/related group (see RFC 2387). They may also be used to support particular catalog syntaxes, such as the SGML/Open Catalog (SOCAT) which supports the SGML notion of "Formal Public Identifiers (FPIs).
author:
   David Brownell
author:
   Janet Koenig
version:
   1.3 00/02/24




Constructor Summary
public  Resolver()
     Constructs a resolver.

Method Summary
public static  InputSourcecreateInputSource(String contentType, InputStream stream, boolean checkType, String scheme)
     Returns an input source, using the MIME type information and URL scheme to statically determine the correct character encoding if possible and otherwise autodetecting it.
public static  InputSourcecreateInputSource(URL uri, boolean checkType)
     Creates an input source from a given URI.
public static  InputSourcecreateInputSource(File file)
     Creates an input source from a given file, autodetecting the character encoding.
public  booleanisIgnoringMIME()
     Returns true if this resolver is ignoring MIME types in the documents it returns, to work around bugs in how servers have reported the documents' MIME types.
public  voidregisterCatalogEntry(String publicId, String uri)
     Registers the given public ID as corresponding to a particular URI, typically a local copy.
public  voidregisterCatalogEntry(String publicId, String resourceName, ClassLoader loader)
     Registers a given public ID as corresponding to a particular Java resource in a given class loader, typically distributed with a software package.
public  InputSourceresolveEntity(String name, String uri)
     SAX: Resolve the given entity into an input source.
public  voidsetIgnoringMIME(boolean value)
     Tells the resolver whether to ignore MIME types in the documents it retrieves.


Constructor Detail
Resolver
public Resolver()(Code)
Constructs a resolver.




Method Detail
createInputSource
public static InputSource createInputSource(String contentType, InputStream stream, boolean checkType, String scheme) throws IOException(Code)
Returns an input source, using the MIME type information and URL scheme to statically determine the correct character encoding if possible and otherwise autodetecting it. MIME carefully specifies the character encoding defaults, and how attributes of the content type can change it. XML further specifies two mandatory encodings (UTF-8 and UTF-16), and includes an XML declaration which can be used to internally label most documents encoded using US-ASCII supersets (such as Shift_JIS, EUC-JP, ISO-2022-*, ISO-8859-*, and more).

This method can be used to access XML documents which do not have URIs (such as servlet input streams, or most JavaMail message entities) and to support access methods such as HTTP POST or PUT. (URLs normally return content using the GET method.)

The caller should set the system ID in order for relative URIs found in this document to be interpreted correctly. In some cases, a custom resolver will need to be used; for example, documents may be grouped in a single MIME "multipart/related" bundle, and relative URLs would refer to other documents in that bundle.
Parameters:
  contentType - The MIME content type for the source for whichan InputSource is desired, such as text/xml;charset=utf-8.
Parameters:
  stream - The input byte stream for the input source.
Parameters:
  checkType - If true, this verifies that the content type is knownto support XML documents, such as application/xml.
Parameters:
  scheme - Unless this is "file", unspecified MIME typesdefault to US-ASCII. Files are always autodetected since mostfile systems discard character encoding information.




createInputSource
public static InputSource createInputSource(URL uri, boolean checkType) throws IOException(Code)
Creates an input source from a given URI.
Parameters:
  uri - the URI (system ID) for the entity
Parameters:
  checkType - if true, the MIME content type for the entityis checked for document type and character set encoding.



createInputSource
public static InputSource createInputSource(File file) throws IOException(Code)
Creates an input source from a given file, autodetecting the character encoding.



isIgnoringMIME
public boolean isIgnoringMIME()(Code)
Returns true if this resolver is ignoring MIME types in the documents it returns, to work around bugs in how servers have reported the documents' MIME types.



registerCatalogEntry
public void registerCatalogEntry(String publicId, String uri)(Code)
Registers the given public ID as corresponding to a particular URI, typically a local copy. This URI will be used in preference to ones provided as system IDs in XML entity declarations. This mechanism would most typically be used for Document Type Definitions (DTDs), where the public IDs are formally managed and versioned.
Parameters:
  publicId - The managed public ID being mapped
Parameters:
  uri - The URI of the preferred copy of that entity



registerCatalogEntry
public void registerCatalogEntry(String publicId, String resourceName, ClassLoader loader)(Code)
Registers a given public ID as corresponding to a particular Java resource in a given class loader, typically distributed with a software package. This resource will be preferred over system IDs included in XML documents. This mechanism should most typically be used for Document Type Definitions (DTDs), where the public IDs are formally managed and versioned.

If a mapping to a URI has been provided, that mapping takes precedence over this one.
Parameters:
  publicId - The managed public ID being mapped
Parameters:
  resourceName - The name of the Java resource
Parameters:
  loader - The class loader holding the resource, or null ifit is a system resource.




resolveEntity
public InputSource resolveEntity(String name, String uri) throws IOException(Code)
SAX: Resolve the given entity into an input source. If the name can't be mapped to a preferred form of the entity, the URI is used. To resolve the entity, first a local catalog mapping names to URIs is consulted. If no mapping is found there, a catalog mapping names to java resources is consulted. Finally, if neither mapping found a copy of the entity, the specified URI is used.

When a URI is used, createInputSource is used to correctly deduce the character encoding used by this entity. No MIME type checking is done.
Parameters:
  name - Used to find alternate copies of the entity, whenthis value is non-null; this is the XML "public ID".
Parameters:
  uri - Used when no alternate copy of the entity is found;this is the XML "system ID", normally a URI.




setIgnoringMIME
public void setIgnoringMIME(boolean value)(Code)
Tells the resolver whether to ignore MIME types in the documents it retrieves. Many web servers incorrectly assign text documents a default character encoding, even when that is incorrect. For example, all HTTP text documents default to use ISO-8859-1 (used for Western European languages), and other MIME sources default text documents to use US-ASCII (a seven bit encoding). For XML documents which include text encoding declarations (as most should do), these server bugs can be worked around by ignoring the MIME type entirely.



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.