private void populateDoctypeValues() { fDocumentTypeIds = new ArrayList(); // add none first fDocumentTypeCombo.add(SELECT_NONE); fDocumentTypeIds.add(null); HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance(); Enumeration e = reg.getEntries(); while (e.hasMoreElements()) { HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement(); String publicId = entry.getPublicId(); String displayName = entry.getDisplayName(); displayName = displayName != null ? displayName : publicId; fDocumentTypeCombo.add(displayName); fDocumentTypeIds.add(publicId); if (displayName.length() > maxLengthStringInHTMLDocumentTypeRegistry.length()) { maxLengthStringInHTMLDocumentTypeRegistry = displayName; } if (entry.getSystemId() == null) continue; // if HTML entry if (entry.getSystemId().length() > maxLengthStringInHTMLDocumentTypeRegistry.length()) maxLengthStringInHTMLDocumentTypeRegistry = entry.getSystemId(); } }
private String getSystemIdFrom(String publicId) { if (publicId == null || publicId.length() == 0) return null; HTMLDocumentTypeRegistry reg = HTMLDocumentTypeRegistry.getInstance(); Enumeration e = reg.getEntries(); while (e.hasMoreElements()) { HTMLDocumentTypeEntry entry = (HTMLDocumentTypeEntry) e.nextElement(); if (entry.getPublicId().equals(publicId)) return entry.getSystemId(); } return null; }