gate.sgml
Class Sgml2Xml
java.lang.Object
|
+--gate.sgml.Sgml2Xml
- public class Sgml2Xml
- extends Object
Not so fast...
This class is not a realy Sgml2Xml convertor.
It takes an SGML document and tries to prepare it for an XML parser
For a true conversion we need an Java SGML parser...
If you know one let me know....
What does it do:
- If it finds something like this : <element attribute = value>
it will produce: <element attribute = "value">
- If it finds something like this : <element something
attribute2=value>it will produce : <element
defaultAttribute="something" attribute2="value">
- If it finds : <element att1='value1 value2' att2="value2
value3"> it will produce: <element att1="value1 value2"
att2="value2 value3">
- If it finds : <element1> <elem>text </element1>
will produce: <element1> <elem>text<elem>
</element1>
- If it find : <element1> <elem>[white spaces]
</element1>,
it will produce:<element1> <elem/>[white spaces]<
/element1>
What doesn't:
- Doesn't expand the entities. So the entities from the SGML document
must be resolved by the XML parser
- Doesn't replace internal entities with their corresponding value
Method Summary |
String |
convert()
This method is responsable with document conversion |
Sgml2Xml
public Sgml2Xml(String SgmlDoc)
- The constructor initialises some member fields
- Parameters:
SgmlDoc
- the content of the Sgml document that will be modified
Sgml2Xml
public Sgml2Xml(Document doc)
- The other constructor
- Parameters:
doc
- The Gate document that will be transformed to XML
convert
public String convert()
throws IOException,
MalformedURLException
- This method is responsable with document conversion