Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-4762

XMLLoader issue when the parent and child tags starts with the same name(See Description).

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • piggybank
    • None

    Description

      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>)

      Attachments

        Activity

          People

            Unassigned Unassigned
            mshylesh Shylesh Monica
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: