You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Shylesh Monica (JIRA)" <ji...@apache.org> on 2015/12/15 20:31:46 UTC

[jira] [Created] (PIG-4762) XMLLoader issue when the parent and child tags starts with the same name(See Description).

Shylesh Monica created PIG-4762:
-----------------------------------

             Summary: XMLLoader issue when the parent and child tags starts with the same name(See Description).
                 Key: PIG-4762
                 URL: https://issues.apache.org/jira/browse/PIG-4762
             Project: Pig
          Issue Type: Bug
            Reporter: Shylesh Monica


I'm having issues with loading the XML using Piggybank's XMLLoader. 
The XML does not load correctly when the XML has a child element starting with the same name as the parent (See the Person tag and Person_ID tag).

<Person>
	<FirstName>John</FirstName>
	<MiddleName/> 
	<LastName>Lennon</LastName>
	<Person_ID>JL</Person_ID>
	<Address>	
		<Street1>1 New Street</Street1>
		<Street2/>
		<City>New town</City>
		<State>New State</State>
		<Zip>00001</Zip>
	</Address>
</Person>

A = LOAD 'test.xml'  USING org.apache.pig.piggybank.storage.XMLLoader ('Person') AS(x:chararray);
DUMP a;

OUTPUT
 (<Person_ID/>)



However the XML loads correctly when the child tag doesn't start with the parent tag's name

<Person>
	<FirstName>John</FirstName>
	<MiddleName/> 
	<LastName>Lennon</LastName>
	<ID_Person>JL</ID_Person>
	<Address>	
		<Street1>1 New Street</Street1>
		<Street2/>
		<City>New town</City>
		<State>New State</State>
		<Zip>00001</Zip>
	</Address>
</Person>


A = LOAD 'test.xml'  USING org.apache.pig.piggybank.storage.XMLLoader ('Person') AS(x:chararray);
DUMP a;

 OUTPUT
 
(<Person>       <FirstName>John</FirstName>     <MiddleName/>   <LastName>Lennon</LastName>     <ID_Person>JL<ID_Person/>       <Address>                       <Street1>1 New Street</Street1>             <Street2/>              <City>New town</City>           <State>New State</State>                <Zip>00001</Zip>        </Address>      </Person>)




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)