org.autoplot.pds.DocumentUtil
Document and XML utilities.
DocumentUtil( )
cleanDescriptionString
cleanDescriptionString( String desc ) → String
remove whitespace intended to format nicely with fixed-with fonts and replace
with <br>.
Parameters
desc - a String
Returns:
a String
[search for examples]
[view on GitHub]
[view on old javadoc]
cleanJSONArray
cleanJSONArray( JSONArray jo ) → JSONArray
remove whitespace intended to format nicely with fixed-with fonts and replace
with <br>.
Parameters
jo - a JSONArray
Returns:
a JSONArray
[search for examples]
[view on GitHub]
[view on old javadoc]
cleanJSONObject
cleanJSONObject( JSONObject jo ) → JSONObject
remove whitespace intended to format nicely with fixed-with fonts and replace
with <br>.
Parameters
jo - a JSONObject
Returns:
a JSONObject
[search for examples]
[view on GitHub]
[view on old javadoc]
cleanString
cleanString( String desc ) → String
Parameters
desc - a String
Returns:
java.lang.String
[search for examples]
[view on GitHub]
[view on old javadoc]
convertDocumentToMap
convertDocumentToMap( org.w3c.dom.Node root ) → java.util.Map
Create map from the document so that it can be used as metadata. Note
this looks for the DESCRIPTION (or description) node and will remove
extra whitespace which was used to format assuming a fixed-width font.
Parameters
root - the document.
Returns:
a map representing the document.
[search for examples]
[view on GitHub]
[view on old javadoc]
createTitleFrom
createTitleFrom( String desc ) → String
Misguided attempt to create a title assuming the first sentence
is a summary. For example:
RTN normal component of the magnetic field component in nT. The normal component (N) completes the right handed ...
becomes
RTN normal component of the magnetic field component in nT.
In this day of ChatGPT, this seems quite silly, but what else can be done?
Parameters
desc - a longer description.
Returns:
a title
[search for examples]
[view on GitHub]
[view on old javadoc]
dumpToXML
dumpToXML( org.w3c.dom.Document doc, java.io.File f ) → void
dump the document to an XML file
Parameters
doc - a Document
f - a File
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
isLeaf
isLeaf( org.w3c.dom.Node node ) → boolean
return true if the node has no children other than the text node.
Parameters
node - the node
Returns:
a boolean
[search for examples]
[view on GitHub]
[view on old javadoc]
readXML
readXML( java.io.File f ) → org.w3c.dom.Document
Read the XML file into a document.
Parameters
f - the file
Returns:
the document object
[search for examples]
[view on GitHub]
[view on old javadoc]