bgupta has asked for the wisdom of the Perl Monks concerning the following question:

<BLOCK> - <RECORD> <TAG_1>Value1</TAG_1> <TAG_2/ Containing a slash>Value2</TAG_2/ Containing a slash> </RECORD> </BLOCK>
The above code is giving output as
{ 'RECORD' => { 'TAG_1' => 'Value1', 'content' => ' / Containing a slash>Value2/ Containing a slash> ' }, 'content' => ' - ' };
I am expecting "TAG_2/ Containing a slash" key with value as Value2 but as we can see above it not giving the expected output. Looks like it is considering the slash in the tag as the end of the tag and hence the problem. Can somebody suggest as to how we can get rid of this problem.

Replies are listed 'Best First'.
Re: Problem in parsing XML file with spaces or slashes in a tag
by Corion (Patriarch) on Feb 13, 2009 at 13:38 UTC
Re: Problem in parsing XML file with spaces or slashes in a tag
by toolic (Bishop) on Feb 13, 2009 at 13:42 UTC
Re: Problem in parsing XML file with spaces or slashes in a tag
by ikegami (Patriarch) on Feb 13, 2009 at 14:14 UTC
    Your XML is bad, as you've been told. So how about we explore alternative schemas.
    <BLOCK> <RECORD> <FIELD id="Containing a space">Value1</FIELD> <FIELD id="/Containing a slash/">Value2</FIELD> </RECORD> </BLOCK>
Re: Problem in parsing XML file with spaces or slashes in a tag
by puudeli (Pilgrim) on Feb 13, 2009 at 13:37 UTC
    The above code is giving output as

    What code? All I see is a record structure. What are you trying to do and what modules you are using? Show an example code snippet with input data that produces the incorrect result and someone may be able to help you.

    --
    seek $her, $from, $everywhere if exists $true{love};