Java Doc for XMLFragment.java in  » GIS » deegree » org » deegree » framework » 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 » GIS » deegree » org.deegree.framework.xml 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.deegree.framework.xml.XMLFragment

All known Subclasses:   org.deegree.ogcbase.OGCDocument,  org.deegree.ogcwebservices.wass.wss.operation.WSSGetCapabilitiesDocument,  org.deegree.model.metadata.iso19115.ISO19115Document,  org.deegree.framework.xml.schema.XSDocument,  org.deegree.io.IODocument,  org.deegree.security.AuthenticationDocument,  org.deegree.owscommon_1_1_0.operations.GetCapabilitiesDocument,  org.deegree.ogcwebservices.wass.common.AuthenticationDocument,  org.deegree.ogcwebservices.wps.describeprocess.ProcessDescriptionDocument,  org.deegree.ogcwebservices.wcts.operation.WCTSRequestBaseDocument,  org.deegree.framework.xml.XSLTDocument,  org.deegree.ogcwebservices.csw.discovery.GetRecordsResultDocument,  org.deegree.owscommon_new.OWSCommonCapabilitiesDocument,  org.deegree.ogcwebservices.wass.was.operation.WASGetCapabilitiesDocument,  org.deegree.ogcwebservices.ExceptionDocument,  org.deegree.ogcwebservices.csw.manager.TransactionResultDocument,  org.deegree.ogcbase.GMLDocument,  org.deegree.model.filterencoding.capabilities.FilterCapabilities100Fragment,  org.deegree.ogcwebservices.wass.wss.operation.DoServiceDocument,  org.deegree.ogcwebservices.wass.was.operation.DescribeUserResponse,  org.deegree.ogcwebservices.csw.discovery.GetRecordByIdResultDocument,  org.deegree.model.filterencoding.capabilities.FilterCapabilities110Fragment,  org.deegree.ogcwebservices.wass.saml.SAMLDocument,  org.deegree.framework.trigger.TriggerConfigurationDocument,  org.deegree.owscommon_1_1_0.CommonsDocument,  org.deegree.owscommon_1_1_0.operations.GetResourceByIDDocument,
XMLFragment
public class XMLFragment implements Serializable(Code)
An instance of XMLFragment encapsulates an underlying Element which acts as the root element of the document (which may be a fragment or a whole document).

Basically, XMLFragment provides easy loading and proper saving (automatically generated CDATA-elements for text nodes that need to be escaped) and acts as base class for all XML parsers in deegree. TODO: automatically generated CDATA-elements are not implemented yet

Additionally, XMLFragment tries to make the handling of relative paths inside the document's content as painless as possible. This means that after initialization of the XMLFragment with the correct SystemID (i.e. the URL of the document):

  • external parsed entities (in the DOCTYPE part) can use relative URLs; e.g. <!ENTITY local SYSTEM "conf/wfs/wfs.cfg">
  • application specific documents which extend XMLFragment can resolve relative URLs during parsing by calling the resolve() method

author:
   Torsten Friebe
author:
   Markus Schneider
author:
   last edited by: $Author: rbezema $
version:
   $Revision: 10106 $, $Date: 2008-02-18 04:58:04 -0800 (Mon, 18 Feb 2008) $
See Also:   org.deegree.framework.xml.XMLTools


Field Summary
final public static  StringDEFAULT_URL
    
final protected static  URIXLNNS
    
protected static  NamespaceContextnsContext
    

Constructor Summary
public  XMLFragment()
     Creates a new XMLFragment which is not initialized.
public  XMLFragment(URL url)
     Creates a new XMLFragment which is loaded from the given URL.
public  XMLFragment(File file)
     Creates a new XMLFragment which is loaded from the given File.
public  XMLFragment(Reader reader, String systemId)
     Creates a new XMLFragment which is loaded from the given Reader.
Parameters:
  reader -
Parameters:
  systemId - this string should represent a URL that is related to the passed reader.
public  XMLFragment(Document doc, String systemId)
     Creates a new XMLFragment instance based on the submitted Document.
Parameters:
  doc -
Parameters:
  systemId - this string should represent a URL that is the source of the passed doc.
public  XMLFragment(Element element)
     Creates a new XMLFragment instance based on the submitted Element.
public  XMLFragment(QualifiedName elementName)
     Constructs an empty document with the given QualifiedName as root node.

Method Summary
public  StringgetAsPrettyString()
     Returns a string representation of the XML Document, pretty printed.
public  StringgetAsString()
    
public  Map<URI, URL>getAttachedSchemas()
     Determines the namespace URIs and the bound schema URLs from the 'xsi:schemaLocation' attribute of the document element.
protected  QualifiedNamegetQualifiedName(Element element)
     Returns the qualified name of the given element.
public  ElementgetRootElement()
    
public  URLgetSystemId()
     Returns the systemId (the URL of the XMLFragment).
public  booleanhasSchema()
     Returns whether the document has a schema reference.
public  voidload(URL url)
     Initializes the XMLFragment with the content from the given URL.
public  voidload(InputStream istream, String systemId)
     Initializes the XMLFragment with the content from the given InputStream.
public  voidload(Reader reader, String systemId)
     Initializes the XMLFragment with the content from the given Reader.
public static  QualifiedNameparseQualifiedName(Node node)
     Parses the value of the submitted Node as a QualifiedName.
protected  SimpleLinkparseSimpleLink(Element element)
     Parses the submitted Element as a SimpleLink.
public  voidprettyPrint(OutputStream os)
     Writes the XMLFragment instance to the given OutputStream using indentation so it may be read easily.
public  voidprettyPrint(Writer writer)
     Writes the XMLFragment instance to the given Writer using indentation so it may be read easily.
public  URLresolve(String url)
     Resolves the given URL (which may be relative) against the SystemID of the XMLFragment into a URL (which is always absolute).
public  voidsetRootElement(Element rootElement)
    
public  voidsetSystemId(String systemId)
    
public  voidsetSystemId(URL systemId)
    
public  StringtoString()
     Returns a string representation of the object.
public  voidwrite(Writer writer)
     Writes the XMLFragment instance to the given Writer using the default system encoding and adding CDATA-sections in for text-nodes where needed.
public  voidwrite(Writer writer, Properties outputProperties)
     Writes the XMLFragment instance to the given Writer using the specified OutputKeys.
public  voidwrite(OutputStream os)
     Writes the XMLFragment instance to the given OutputStream using the default system encoding and adding CDATA-sections in for text-nodes where needed.
public  voidwrite(OutputStream os, Properties outputProperties)
     Writes the XMLFragment instance to the given OutputStream using the specified OutputKeys which allow complete control of the generated output.

Field Detail
DEFAULT_URL
final public static String DEFAULT_URL(Code)
Use this URL as SystemID only if an XMLFragment cannot be pinpointed to a URL - in this case it may not use any relative references!



XLNNS
final protected static URI XLNNS(Code)



nsContext
protected static NamespaceContext nsContext(Code)




Constructor Detail
XMLFragment
public XMLFragment()(Code)
Creates a new XMLFragment which is not initialized.



XMLFragment
public XMLFragment(URL url) throws IOException, SAXException(Code)
Creates a new XMLFragment which is loaded from the given URL.
Parameters:
  url -
throws:
  IOException -
throws:
  SAXException -



XMLFragment
public XMLFragment(File file) throws MalformedURLException, IOException, SAXException(Code)
Creates a new XMLFragment which is loaded from the given File.
Parameters:
  file - the file to load from
throws:
  SAXException - if the document could not be parsed
throws:
  IOException - if the document could not be read
throws:
  MalformedURLException - if the file cannot be transposed to a valid url



XMLFragment
public XMLFragment(Reader reader, String systemId) throws SAXException, IOException(Code)
Creates a new XMLFragment which is loaded from the given Reader.
Parameters:
  reader -
Parameters:
  systemId - this string should represent a URL that is related to the passed reader. If thisURL is not available or unknown, the string should contain the value ofXMLFragment.DEFAULT_URL
throws:
  SAXException -
throws:
  IOException -



XMLFragment
public XMLFragment(Document doc, String systemId) throws MalformedURLException(Code)
Creates a new XMLFragment instance based on the submitted Document.
Parameters:
  doc -
Parameters:
  systemId - this string should represent a URL that is the source of the passed doc. If thisURL is not available or unknown, the string should contain the value ofXMLFragment.DEFAULT_URL
throws:
  MalformedURLException - if systemId is no valid and absolute URL



XMLFragment
public XMLFragment(Element element)(Code)
Creates a new XMLFragment instance based on the submitted Element.
Parameters:
  element -



XMLFragment
public XMLFragment(QualifiedName elementName)(Code)
Constructs an empty document with the given QualifiedName as root node.
Parameters:
  elementName - if the name's namespace is set, the prefix should be set as well.




Method Detail
getAsPrettyString
public String getAsPrettyString()(Code)
Returns a string representation of the XML Document, pretty printed. Note that pretty printing can mess up XML documents in some cases (GML, for instance). the string



getAsString
public String getAsString()(Code)
Returns a string representation of the XML Document the string



getAttachedSchemas
public Map<URI, URL> getAttachedSchemas() throws XMLParsingException(Code)
Determines the namespace URIs and the bound schema URLs from the 'xsi:schemaLocation' attribute of the document element. keys are URIs (namespaces), values are URLs (schema locations)
throws:
  XMLParsingException -



getQualifiedName
protected QualifiedName getQualifiedName(Element element) throws XMLParsingException(Code)
Returns the qualified name of the given element.
Parameters:
  element - the qualified name of the given element.
throws:
  XMLParsingException -



getRootElement
public Element getRootElement()(Code)
the element



getSystemId
public URL getSystemId()(Code)
Returns the systemId (the URL of the XMLFragment). the systemId



hasSchema
public boolean hasSchema()(Code)
Returns whether the document has a schema reference. true, if the document has a schema reference, false otherwise



load
public void load(URL url) throws IOException, SAXException(Code)
Initializes the XMLFragment with the content from the given URL. Sets the SystemId, too.
Parameters:
  url -
throws:
  IOException -
throws:
  SAXException -



load
public void load(InputStream istream, String systemId) throws SAXException, IOException, XMLException(Code)
Initializes the XMLFragment with the content from the given InputStream. Sets the SystemId, too.
Parameters:
  istream -
Parameters:
  systemId - cannot be null. This string should represent a URL that is related to the passedistream. If this URL is not available or unknown, the string should contain thevalue of XMLFragment.DEFAULT_URL
throws:
  SAXException -
throws:
  IOException -
throws:
  XMLException -
throws:
  NullPointerException -



load
public void load(Reader reader, String systemId) throws SAXException, IOException(Code)
Initializes the XMLFragment with the content from the given Reader. Sets the SystemId, too.
Parameters:
  reader -
Parameters:
  systemId - can not be null. This string should represent a URL that is related to the passedreader. If this URL is not available or unknown, the string should contain thevalue of XMLFragment.DEFAULT_URL
throws:
  SAXException -
throws:
  IOException -
throws:
  NullPointerException -



parseQualifiedName
public static QualifiedName parseQualifiedName(Node node) throws XMLParsingException(Code)
Parses the value of the submitted Node as a QualifiedName.

To parse the text contents of an Element node, the actual text node must be given, not the Element node itself.


Parameters:
  node - object representation of the element
throws:
  XMLParsingException -



parseSimpleLink
protected SimpleLink parseSimpleLink(Element element) throws XMLParsingException(Code)
Parses the submitted Element as a SimpleLink.

Possible escaping of the attributes "xlink:href", "xlink:role" and "xlink:arcrole" is performed automatically.


Parameters:
  element - the object representation of the element
throws:
  XMLParsingException -



prettyPrint
public void prettyPrint(OutputStream os) throws TransformerException(Code)
Writes the XMLFragment instance to the given OutputStream using indentation so it may be read easily.
Parameters:
  os -
throws:
  TransformerException -



prettyPrint
public void prettyPrint(Writer writer) throws TransformerException(Code)
Writes the XMLFragment instance to the given Writer using indentation so it may be read easily.
Parameters:
  writer -
throws:
  TransformerException -



resolve
public URL resolve(String url) throws MalformedURLException(Code)
Resolves the given URL (which may be relative) against the SystemID of the XMLFragment into a URL (which is always absolute).
Parameters:
  url - the resolved URL object
throws:
  MalformedURLException -



setRootElement
public void setRootElement(Element rootElement)(Code)

Parameters:
  rootElement -



setSystemId
public void setSystemId(String systemId) throws MalformedURLException(Code)

Parameters:
  systemId - The systemId (physical location) to set (may be null).
throws:
  MalformedURLException -



setSystemId
public void setSystemId(URL systemId)(Code)

Parameters:
  systemId - The systemId (physical location) to set.



toString
public String toString()(Code)
Returns a string representation of the object. a string representation of the object.



write
public void write(Writer writer)(Code)
Writes the XMLFragment instance to the given Writer using the default system encoding and adding CDATA-sections in for text-nodes where needed. TODO: Add code for CDATA safety.
Parameters:
  writer -



write
public void write(Writer writer, Properties outputProperties)(Code)
Writes the XMLFragment instance to the given Writer using the specified OutputKeys.
Parameters:
  writer - cannot be null
Parameters:
  outputProperties - output properties for the Transformer that is used to serialize thedocumentsee javax.xml.OutputKeys



write
public void write(OutputStream os)(Code)
Writes the XMLFragment instance to the given OutputStream using the default system encoding and adding CDATA-sections in for text-nodes where needed. TODO: Add code for CDATA safety.
Parameters:
  os -



write
public void write(OutputStream os, Properties outputProperties)(Code)
Writes the XMLFragment instance to the given OutputStream using the specified OutputKeys which allow complete control of the generated output.
Parameters:
  os - cannot be null
Parameters:
  outputProperties - output properties for the Transformer used to serialize thedocument
See Also:   javax.xml.transform.OutputKeys



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.