()
| 124 | private List<Node> allNodes; |
| 125 | |
| 126 | @Override protected void setUp() throws Exception { |
| 127 | transformer = TransformerFactory.newInstance().newTransformer(); |
| 128 | transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); |
| 129 | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
| 130 | factory.setNamespaceAware(true); |
| 131 | builder = factory.newDocumentBuilder(); |
| 132 | domImplementation = builder.getDOMImplementation(); |
| 133 | document = builder.parse(new InputSource(new StringReader(xml))); |
| 134 | |
| 135 | // doctype nodes |
| 136 | doctype = document.getDoctype(); |
| 137 | if (doctype.getEntities() != null) { |
| 138 | sp = (Entity) doctype.getEntities().item(0); |
| 139 | } |
| 140 | if (doctype.getNotations() != null) { |
| 141 | png = (Notation) doctype.getNotations().item(0); |
| 142 | } |
| 143 | |
| 144 | // document nodes |
| 145 | menu = document.getDocumentElement(); |
| 146 | item = (Element) menu.getChildNodes().item(1); |
| 147 | itemXmlns = item.getAttributeNode("xmlns"); |
| 148 | itemXmlnsA = item.getAttributeNode("xmlns:a"); |
| 149 | name = (Element) item.getChildNodes().item(1); |
| 150 | standard = name.getAttributeNode("a:standard"); |
| 151 | deluxe = name.getAttributeNode("deluxe"); |
| 152 | waffles = (Text) name.getChildNodes().item(0); |
| 153 | description = (Element) item.getChildNodes().item(3); |
| 154 | descriptionText1 = (Text) description.getChildNodes().item(0); |
| 155 | descriptionText2 = (CDATASection) description.getChildNodes().item(1); |
| 156 | descriptionText3 = (Text) description.getChildNodes().item(2); |
| 157 | option1 = (Element) item.getChildNodes().item(5); |
| 158 | option2 = (Element) item.getChildNodes().item(7); |
| 159 | option2Reference = option2.getChildNodes().item(0); |
| 160 | wafflemaker = (ProcessingInstruction) item.getChildNodes().item(9); |
| 161 | nutrition = (Element) item.getChildNodes().item(11); |
| 162 | vitamins = (Element) nutrition.getChildNodes().item(1); |
| 163 | vitaminsXmlnsA = vitamins.getAttributeNode("xmlns:a"); |
| 164 | comment = (Comment) vitamins.getChildNodes().item(1); |
| 165 | vitaminc = (Element) vitamins.getChildNodes().item(3); |
| 166 | vitamincText = (Text) vitaminc.getChildNodes().item(0); |
| 167 | |
| 168 | allNodes = new ArrayList<Node>(); |
| 169 | |
| 170 | if (sp != null) { |
| 171 | allNodes.add(sp); |
| 172 | } |
| 173 | if (png != null) { |
| 174 | allNodes.add(png); |
| 175 | } |
| 176 | |
| 177 | allNodes.addAll(Arrays.asList(document, doctype, menu, item, itemXmlns, |
| 178 | itemXmlnsA, name, standard, deluxe, waffles, description, |
| 179 | descriptionText1, descriptionText2, descriptionText3, option1, |
| 180 | option2, option2Reference, wafflemaker, nutrition, vitamins, |
| 181 | vitaminsXmlnsA, comment, vitaminc, vitamincText)); |
| 182 | } |
| 183 |
no test coverage detected