public abstract class XmlInstanceDOM
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private org.w3c.dom.Document |
_document |
private java.io.File |
_instanceFile |
private XmlSchemaDOM |
_schema |
Modifier | Constructor and Description |
---|---|
protected |
XmlInstanceDOM(java.lang.String comment,
java.lang.String instancePath,
java.lang.String schemaPath)
Constructs this instance with empty qualified root element, and with reference to schema
found in
schemaPath ; the root element tag is deduced from the schema. |
protected |
XmlInstanceDOM(java.lang.String comment,
java.lang.String instancePath,
java.lang.String schemaPath,
java.lang.String rootTag)
FIXME: test
|
private |
XmlInstanceDOM(java.lang.String comment,
java.lang.String instancePath,
java.lang.String schemaPath,
XmlSchemaDOM schema,
java.lang.String rootTag) |
protected |
XmlInstanceDOM(java.lang.String comment,
java.lang.String instancePath,
XmlSchemaDOM schema)
Constructs this instance with empty qualified root element, and with
schema ,
which potentially does not have the file representation (e.g., it may have been created from
XML text, and does not exist as a file); the root element tag is deduced from the schema. |
protected |
XmlInstanceDOM(java.lang.String comment,
java.lang.String instancePath,
XmlSchemaDOM schema,
java.lang.String rootTag)
FIXME: test
|
Modifier and Type | Method and Description |
---|---|
org.w3c.dom.Element |
addCDATA(org.w3c.dom.Element el,
java.lang.String cdata)
Adds CDATA section to
el and returns modified el . |
org.w3c.dom.Element |
addSubElement(org.w3c.dom.Element el,
java.lang.String qname)
Adds sub-element to
el and returns modified el . |
org.w3c.dom.Element |
createSubElement(org.w3c.dom.Element el,
java.lang.String name)
Creates new element (by qualifying its
name with the target namespace prefix),
adds it under el and returns that new element. |
org.w3c.dom.Element |
createSubElementUnderRoot(java.lang.String name)
Creates new element (by qualifying its
name with the target namespace prefix),
adds it under document root and returns that new element. |
protected org.w3c.dom.Document |
getDocument() |
java.io.File |
getInstanceFile() |
java.lang.String |
getPrettyXml() |
org.w3c.dom.Element |
getRoot() |
XmlSchemaDOM |
getSchema() |
XmlNs |
getTargetNs() |
java.lang.String |
qname(java.lang.String name) |
void |
save() |
SaxErrorData |
validate()
If initialised with an external schema, validates this instance document against that schema.
|
private final java.io.File _instanceFile
private final XmlSchemaDOM _schema
private final org.w3c.dom.Document _document
protected XmlInstanceDOM(java.lang.String comment, java.lang.String instancePath, java.lang.String schemaPath, java.lang.String rootTag) throws XmlParsingException
Constructs this instance with empty qualified root element, and with reference to schema
found in schemaPath
.
comment
- (potentially null or empty) document comment.instancePath
- path where this document can be saved as file.schemaPath
- path where the schema can be found as file.rootTag
- root element nameXmlParsingException
protected XmlInstanceDOM(java.lang.String comment, java.lang.String instancePath, java.lang.String schemaPath) throws XmlParsingException
schemaPath
; the root element tag is deduced from the schema.comment
- (potentially null or empty) document comment.instancePath
- path where this document can be saved as file.schemaPath
- path where the schema can be found as file.XmlParsingException
protected XmlInstanceDOM(java.lang.String comment, java.lang.String instancePath, XmlSchemaDOM schema, java.lang.String rootTag) throws XmlParsingException
Constructs this instance with empty qualified root element, and with schema
,
which potentially does not have the file representation (e.g., it may have been created from
XML text, and does not exist as a file). This one is useful for testing.
comment
- instancePath
- schema
- rootTag
- XmlParsingException
protected XmlInstanceDOM(java.lang.String comment, java.lang.String instancePath, XmlSchemaDOM schema) throws XmlParsingException
schema
,
which potentially does not have the file representation (e.g., it may have been created from
XML text, and does not exist as a file); the root element tag is deduced from the schema.
This one is useful for testing.comment
- instancePath
- schema
- XmlParsingException
private XmlInstanceDOM(java.lang.String comment, java.lang.String instancePath, java.lang.String schemaPath, XmlSchemaDOM schema, java.lang.String rootTag) throws XmlParsingException
XmlParsingException
public SaxErrorData validate()
XmlParsingException
public final void save()
public final java.lang.String qname(java.lang.String name)
public final java.lang.String getPrettyXml()
public java.io.File getInstanceFile()
public XmlSchemaDOM getSchema()
public XmlNs getTargetNs()
public org.w3c.dom.Element getRoot()
protected org.w3c.dom.Document getDocument()
public org.w3c.dom.Element createSubElementUnderRoot(java.lang.String name)
name
with the target namespace prefix),
adds it under document root and returns that new element.public org.w3c.dom.Element createSubElement(org.w3c.dom.Element el, java.lang.String name)
name
with the target namespace prefix),
adds it under el
and returns that new element.public org.w3c.dom.Element addSubElement(org.w3c.dom.Element el, java.lang.String qname)
el
and returns modified el
.public org.w3c.dom.Element addCDATA(org.w3c.dom.Element el, java.lang.String cdata)
el
and returns modified el
.Copyright 2009-2015 Tatjana (Tanja) Kostic