Question: I have a problem with creating GlobalVariables for my webform app.
I am creating a webform app with Visual Studio 2015, VB.net, ASP.net
I followed the instruction that I found on this and other sites but with no successs.
I did the folowwing:

1 Create the module file: Module1.vb
With this scripts:

Public Module GlobalVariables2
 Public ModuleEMAIL As String = "ModuleEMAIL@zzzzzzzz"
End Module

Public Class GlobalVariables
 Public Shared Property clasEMAIL As String = "clasEMAIL@zzzzzzzz"
End Class

2. But when ever I try to call the variables a compiler error occur.

Function fnBtnText()
 Button1.Text = GlobalVariables.clasEMAIL
' generate: Compiler Error Message: BC30451: 'GlobalVariables' is not declared. It may be inaccessible due to its protection level.

```
          Button2.Text = ModuleEMAIL

```

'generate: Compiler Error Message: BC30451: 'ModuleEMAIL' is not declared. It may be inaccessible due to its protection level.
 End Function

What meas “protection level” in this case?
When the scripts are moved tot another spacename area the same happens.
What am I doing wrong? Did I missed something?
I hope someone van help me out.
Many greatigs, Ton Daamen

Answer: 
Using SimpleXML, you can build up the hierarchy of the XML document using...

```
    $data = 'Rajeet Singh|email@gmail.com|0123456789|Delhi  
    Abhishek|email2@gmail.com|0123456987|Pune';

    $lines = explode(PHP_EOL, $data);
    $xml = new SimpleXMLElement('<user />');
    $root = $xml->user;
    foreach($lines as $line){
        $data = explode("|",$line);
        $user = $xml->addChild('item');
        $user->addChild('name', $data[0]);
        $user->addChild('email', $data[1]);
        $user->addChild('mobile', $data[2]);
        $user->addChild('address', $data[3]);
    }

    echo $xml->asXML();

```

One thing which I don't do is create elements with a numeric postfix, you wouldn't normally (in XML) have elements `item0`, `item1` as this means they are different element types. You wold simply have them all as `item`. If you needed an index, you could create them with `item id="0"` so the id becomes the identifier (for example the unique ID of a database).
For example, you can write as follows.

```
<?php

$string = <<<EOM
Rajeet Singh|email@gmail.com|0123456789|Delhi
Abhishek|email2@gmail.com|0123456987|Pune
EOM;

$line = explode(PHP_EOL, $string);

$tags = ['name', 'email', 'mobile', 'address'];

$xml = '';

$xml .= "<user>" . PHP_EOL;
foreach($line as $key => $row){
    $elements = explode("|",$row);
    $xml .= "<item{$key}>" . PHP_EOL;
    $boxes = array_map(NULL, $elements, $tags);
    foreach($boxes as $box){
        $xml .= "<{$box[1]}>{$box[0]}</{$box[1]}>" . PHP_EOL;
    }
    $xml .= "</item{$key}>" . PHP_EOL;
}
$xml .= "</user>" . PHP_EOL;

echo $xml;

```

**EDIT**

If you want to format the array from `Text file`.

```
$string = <<<EOM
Rajeet Singh|email@gmail.com|0123456789|Delhi
Abhishek|email2@gmail.com|0123456987|Pune
EOM;

$tags = ['name','email','mobile','address'];

$users_array = array_map(function($n) use($tags){
    $elements = explode('|', $n);
    return array_combine($tags, $elements);
},explode(PHP_EOL, $string));

var_dump($users_array);

```

Result...

```
array(2) {
  [0] =>
  array(4) {
    'name' =>
    string(12) "Rajeet Singh"
    'email' =>
    string(15) "email@gmail.com"
    'mobile' =>
    string(10) "0123456789"
    'address' =>
    string(5) "Delhi"
  }
  [1] =>
  array(4) {
    'name' =>
    string(8) "Abhishek"
    'email' =>
    string(16) "email2@gmail.com"
    'mobile' =>
    string(10) "0123456987"
    'address' =>
    string(4) "Pune"
  }
}

```