private void collectMarkInHeading(HashSet<String> marks, Element node) { String sName = node.getAttribute(XMLString.TEXT_NAME); if (sName != null && sName.length() > 0) { Element par = getParagraph(node); if (XMLString.TEXT_H.equals(par.getTagName())) { marks.add(sName); } } }
private void loadContentFromDOM(Document contentDOM) { // Get the office:body element NodeList list = contentDOM.getElementsByTagName(XMLString.OFFICE_BODY); if (list.getLength() > 0) { // There may be several bodies, but the first one is the main body Element body = (Element) list.item(0); // Now get the content and identify the type of document content = Misc.getChildByTagName(body, XMLString.OFFICE_TEXT); if (content != null) { // OpenDocument Text bOpenDocument = true; bText = true; } else { content = Misc.getChildByTagName(body, XMLString.OFFICE_SPREADSHEET); if (content != null) { // OpenDocument Spreadsheet bOpenDocument = true; bSpreadsheet = true; } else { content = Misc.getChildByTagName(body, XMLString.OFFICE_PRESENTATION); if (content != null) { // OpenDocument Presentation bOpenDocument = true; bPresentation = true; } else { content = body; // OOo 1.x file format - look through content to determine genre bSpreadsheet = true; bPresentation = false; Node child = body.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { String sName = child.getNodeName(); if (XMLString.TEXT_P.equals(sName)) { bSpreadsheet = false; } else if (XMLString.TEXT_H.equals(sName)) { bSpreadsheet = false; } else if (XMLString.TEXT_ORDERED_LIST.equals(sName)) { bSpreadsheet = false; } else if (XMLString.TEXT_ORDERED_LIST.equals(sName)) { bSpreadsheet = false; } else if (XMLString.TEXT_SECTION.equals(sName)) { bSpreadsheet = false; } else if (XMLString.DRAW_PAGE.equals(sName)) { bPresentation = true; bSpreadsheet = false; } else if (XMLString.DRAW_PAGE.equals(sName)) { bSpreadsheet = false; } } child = child.getNextSibling(); } bText = !bSpreadsheet && !bPresentation; } } } traverseContent(body); if (sAutoFigureSequenceName != null) { addFigureSequenceName(sAutoFigureSequenceName); } if (sAutoTableSequenceName != null) { addTableSequenceName(sAutoTableSequenceName); } } /*if (firstMasterPage==null) { firstMasterPage = getMasterPage(sFirstMasterPageName); }*/ }