Project

General

Profile

« Previous | Next » 

Revision 33000

copies the ns prefix as well

View differences:

modules/cnr-misc-utils/trunk/src/test/java/eu/dnetlib/miscutils/iterators/xml/IterableXmlParserTest.java
62 62
	}
63 63

  
64 64
	@Test
65
	public void testOaiRecord() throws Exception {
66
		int count = doTest(new ClassPathResource("eu/dnetlib/miscutils/iterators/xml/oaiRecord.xml").getInputStream(), "record");
67
		assertTrue(count == 1);
68
	}
69

  
70
	@Test
65 71
	public void testWeird() throws Exception {
66 72
		int count = doTest(new ClassPathResource("eu/dnetlib/miscutils/iterators/xml/weirdRecords.xml").getInputStream(), "record");
67 73
		assertTrue(count == 3);
modules/cnr-misc-utils/trunk/src/test/resources/eu/dnetlib/miscutils/iterators/xml/oaiRecord.xml
1
<?xml version="1.0"?>
2
<cappello>
3
	<oai:record xmlns:dc="http://purl.org/dc/elements/1.1/"
4
		xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:dri="http://www.driver-repository.eu/namespace/dri"
5
		xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai="http://www.openarchives.org/OAI/2.0/"
6
		xmlns:prov="http://www.openarchives.org/OAI/2.0/provenance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7
		<oai:header>
8
			<dri:objIdentifier>webcrawl____::6469a2bd0de26af9612c1869d19edd18</dri:objIdentifier>
9
			<dri:recordIdentifier>webcrawl____::6469a2bd0de26af9612c1869d19edd18</dri:recordIdentifier>
10
			<dri:dateOfCollection />
11
			<dri:repositoryId />
12
			<oaf:datasourceprefix>webcrawl____</oaf:datasourceprefix>
13
		</oai:header>
14
		<oai:metadata>
15
			<dc:title>Independent Associations of Glucose Status and Arterial
16
				Stiffness With Left Ventricular Diastolic Dysfunction An 8-year
17
				follow-up of the Hoorn Study</dc:title>
18
			<oaf:dateAccepted>2012-01-01</oaf:dateAccepted>
19
			<dc:publisher>AMER DIABETES ASSOC</dc:publisher>
20
			<dc:language>eng</dc:language>
21
			<oaf:journal issn="0149-5992">DIABETES CARE</oaf:journal>
22
			<dc:subject />
23
			<dc:description />
24
			<dc:source />
25
			<collectedfrom id="openaire____::081b82f96300b6a6e3d282bad31cb6e2"
26
				name="Crossref" />
27
			<oaf:identifier identifierType="doi">10.2337/dc11-1336</oaf:identifier>
28
			<oaf:identifier identifierType="oai">webcrawl____::6469a2bd0de26af9612c1869d19edd18</oaf:identifier>
29
			<oaf:accessrights>CLOSED</oaf:accessrights>
30
			<dr:CobjCategory>0001</dr:CobjCategory>
31
			<hostedby id="openaire____::55045bd2a65019fd8e6741a755395c8c"
32
				name="Unknown Repository" />
33
			<dc:identifier>http://dx.doi.org/10.2337/dc11-1336</dc:identifier>
34
		</oai:metadata>
35
	</oai:record>
36
</cappello>
modules/cnr-misc-utils/trunk/src/main/java/eu/dnetlib/miscutils/iterators/xml/XMLIterator.java
100 100
		try {
101 101
			final XMLEventWriter writer = outputFactory.get().createXMLEventWriter(result);
102 102
			final StartElement start = current.asStartElement();
103
			final StartElement newRecord = eventFactory.get().createStartElement("", null, element, start.getAttributes(), start.getNamespaces());
103
			final StartElement newRecord = eventFactory.get().createStartElement(start.getName(), start.getAttributes(), start.getNamespaces());
104 104

  
105 105
			// new root record
106 106
			writer.add(newRecord);

Also available in: Unified diff