|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jcs.xml.JXml
A class for XML documents.
parse()
method. This method internally uses the Java(tm) Project X
Technology Release 1.
See the
Project X web site.
Field Summary | |
protected java.lang.String |
xmlText
The character text of the XML document contained in the JXml object. |
Constructor Summary | |
JXml(java.lang.String xmlTextArg)
Constructs a JXml instance from the argument text. |
Method Summary | |
org.w3c.dom.Document |
parse()
Parses the XML document and returns the resulting Document object. |
org.w3c.dom.Document |
parse(boolean validate)
Parses the XML document and returns the resulting Document object. |
java.lang.String |
resolveExternal(java.lang.String publicId,
java.lang.String systemId)
A dummy resolveExternal method. |
java.lang.String |
toString()
Return the content of the JXml instance. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected java.lang.String xmlText
For a simple JXml instance, the xmlText is not validated by the JXml constructor. Subclasses of JXml will commonly validate the xmlText in their constructors. This is the reason for making the xmlText field private.
Constructor Detail |
public JXml(java.lang.String xmlTextArg)
JXml
instance from the argument text.
The constructor does no validation of the argument. If it is
not well-formed XML, then a subsequent invocation of the
parse
method will raise exceptions.
All validation of XML documents stored in JXML instances is defined by subclasses of JXml, such as OrderXml or ResultSetXml.
Method Detail |
public java.lang.String toString()
public java.lang.String resolveExternal(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
resolveExternal
method. This method throws an exception
whenever invoked.
Assume that SomeXml
is either the class JXml
or a subclass thereof, and that someXml
is of type
SomeXml
. Consider a call someXml.parse()
.
If the parse
method of JXml has not been overridden,
then it will parse the document contained in someXml
.
Suppose that this document contains one or more external entity references,
such as:
<!DOCTYPE SYSTEM "SomeXmlDoc.dtd">
Normally, an XML parser would look for a file named
SomeXmlDoc.dtd
. However, the parse
method of JXml
does not have access to operating system files, and instead resolves
such external entity references by calling this.resolveExternal(P, S)
,
which returns the definition of the external reference.
In the current example, this call of this.resolveExternal(P, S)
will invoke the resolveExternal
method of the SomeXml
class, which should then return the appropriate DTD for SomeXml documents.
If the call of this.resolveExternal(P, S)
by the JXml
parse
method ever invokes the resolveExternal
method of
JXml
itself, then either the subclass of JXml did not define
a resolveExternal
method, or an instance of JXml is being parsed,
and that instance contained an external entity reference. The JXml
class has no "built-in" or "implicit" DTD or external entity definitions,
so any such external entity reference is undefined, and the
resolveExternal
method of JXml will raise an exception.
For examples of the resolveExternal
methods of subclasses of
JXml
, see
OrderXml.resolveExternal and
ResultSetXml.resolveExternal.
publicId
- the value (if any) specified with the PUBLIC keyword in an
external entity reference, or null.systemId
- the value specified with the SYSTEM keyword in an
external entity reference.public org.w3c.dom.Document parse() throws java.lang.Exception
Document
object.public org.w3c.dom.Document parse(boolean validate) throws java.lang.Exception
Document
object.validate
- a boolean indication of whether (true) or not (false)
the parse should validate
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |