Changeset 2527
- Timestamp:
- 10/17/08 16:41:08 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plugins/converter/edu.iu.nwb.converter.nwbgraphml/src/edu/iu/nwb/converter/nwbgraphml/NWBToGraphMLbyStax.java
r2519 r2527 98 98 //write </graph></graphml> 99 99 try { 100 xtw.writeEndElement(); 101 xtw.writeEndElement(); 100 xtw.writeEndElement(); 101 xtw.writeCharacters("\r\n"); 102 xtw.writeEndElement(); 102 103 } catch (Exception e) { 103 104 e.printStackTrace(); … … 127 128 private void writeGraphMLHeader (XMLStreamWriter xtw) throws XMLStreamException{ 128 129 129 xtw.writeStartDocument("UTF-8","1.0"); 130 xtw.writeStartDocument("UTF-8","1.0"); 131 xtw.writeCharacters("\r\n"); 130 132 xtw.writeComment("This file is generated by XMLStreamWriter"); 133 xtw.writeCharacters("\r\n"); 131 134 xtw.writeStartElement("graphml"); 132 135 xtw.writeNamespace("", "http://graphml.graphdrawing.org/xmlns"); … … 136 139 "schemaLocation", 137 140 "http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"); 141 xtw.writeCharacters("\r\n"); 138 142 139 143 } … … 156 160 xtw.writeAttribute("attr.name", attr.getAttrName()); 157 161 xtw.writeAttribute("attr.type", getGraphmlType(attr)); 158 xtw.writeEndElement(); 162 xtw.writeEndElement(); 163 xtw.writeCharacters("\r\n"); 159 164 } 160 165 … … 175 180 xtw.writeAttribute("attr.name", attr.getAttrName()); 176 181 xtw.writeAttribute("attr.type", getGraphmlType(attr)); 177 xtw.writeEndElement(); 182 xtw.writeEndElement(); 183 xtw.writeCharacters("\r\n"); 178 184 179 185 } … … 198 204 xtw.writeAttribute("attr.type", attr.getDataType()); 199 205 xtw.writeEndElement(); 206 xtw.writeCharacters("\r\n"); 200 207 } 201 208 xtw.writeStartElement("graph"); 202 209 xtw.writeAttribute("edgedefault", "undirected"); 210 xtw.writeCharacters("\r\n"); 203 211 } 204 212 else if (validator.isDirectedGraph() && validator.isUndirectedGraph()){ … … 282 290 xtw.writeStartElement("node"); 283 291 xtw.writeAttribute("id", "n" + columns[0]); 292 xtw.writeCharacters("\r\n"); 284 293 285 294 for(int i = 1; i<nodeAttrList.size(); i++){ … … 300 309 xtw.writeStartElement("data"); 301 310 xtw.writeAttribute("key", attr.getAttrName().toLowerCase()); 302 xtw.writeCharacters(value); 303 xtw.writeEndElement(); 311 xtw.writeCharacters(value); 312 xtw.writeEndElement(); 313 xtw.writeCharacters("\r\n"); 304 314 305 315 } else { … … 315 325 //write </node> 316 326 xtw.writeEndElement(); 327 xtw.writeCharacters("\r\n"); 317 328 318 329 } … … 351 362 xtw.writeAttribute("source", "n" + columns[sourceColumnNumber]); 352 363 xtw.writeAttribute("target", "n" + columns[targetColumnNumber]); 364 xtw.writeCharacters("\r\n"); 353 365 354 366 for(int i = 0; i<edgeAttrList.size(); i++){ … … 373 385 xtw.writeStartElement("data"); 374 386 xtw.writeAttribute("key", attr.getAttrName().toLowerCase()); 375 xtw.writeCharacters(value); 387 xtw.writeCharacters(value); 376 388 xtw.writeEndElement(); 389 xtw.writeCharacters("\r\n"); 377 390 } else { 378 391 /* … … 386 399 } 387 400 } 388 //write </edge> 401 //write </edge> 389 402 xtw.writeEndElement(); 403 xtw.writeCharacters("\r\n"); 404 390 405 }else{ 391 406 //out.println("<edge id=\""+edgeID+"\" source=\""+columns[sourceColumnNumber]+ … … 396 411 xtw.writeAttribute("target", "n" + columns[targetColumnNumber]); 397 412 xtw.writeEndElement(); 413 xtw.writeCharacters("\r\n"); 414 398 415 } 399 416 } … … 407 424 xtw.writeAttribute("source", "n" + columns[sourceColumnNumber]); 408 425 xtw.writeAttribute("target", "n" + columns[targetColumnNumber]); 426 xtw.writeCharacters("\r\n"); 409 427 410 428 for(int i = 0; i<edgeAttrList.size(); i++){ … … 421 439 xtw.writeStartElement("data"); 422 440 xtw.writeAttribute("key", attr.getAttrName().toLowerCase()); 423 xtw.writeCharacters(columns[i]); 441 xtw.writeCharacters(columns[i]); 424 442 xtw.writeEndElement(); 443 xtw.writeCharacters("\r\n"); 444 425 445 } else { 426 446 /* … … 436 456 //out.println("</edge>"); 437 457 xtw.writeEndElement(); 458 438 459 } 439 460 else{ … … 446 467 xtw.writeAttribute("target", "n" + columns[targetColumnNumber]); 447 468 xtw.writeEndElement(); 469 xtw.writeCharacters("\r\n"); 470 448 471 } 449 472 }
