XML Library



( 0, 191, 255)">ZN>= 2.0.0 )

The XML text document in the ZN Framework and the class that was created to manipulate data on the data. Creation, parsing and other operations can be done.

 

0, 191, 255)"># Methods


0, 187, 208); font-family:consolas,monospace">this version ( 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ version = 169, 185, 50); font-family:consolas,monospace">'1.0' )
0, 187, 208); font-family:consolas,monospace">this encoding ( 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ encoding = 169, 185, 50); font-family:consolas,monospace">'UTF-8' )
0, 187, 208); font-family:consolas,monospace">String build ( 0, 187, 208); font-family:consolas,monospace">Array 252, 155, 155); font-family:consolas,monospace">$ data , 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ version = 230, 42, 90); font-family:consolas,monospace">NULL , 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ encoding = 0, 187, 208); font-family:consolas,monospace">230, 42, 90); font-family:consolas,monospace">NULL )
0, 187, 208); font-family:consolas,monospace">Bool save ( 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ file , 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ data )
0, 187, 208); font-family:consolas,monospace">String load ( 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ file )
0, 187, 208); font-family:consolas,monospace">Mixed parse ( 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ xml , 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ result = 169, 185, 50); font-family:consolas,monospace">'object' )
0, 187, 208); font-family:consolas,monospace">Object parseObject ( 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ data )
0, 187, 208); font-family:consolas,monospace">Array parseArray ( 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ data )
0, 187, 208); font-family:consolas,monospace">String parseJson ( 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ data )
0, 187, 208); font-family:consolas,monospace">Mixed parseSimple ( 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ data )
0, 187, 208); font-family:consolas,monospace">Bool check ( 0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ xml )

 

0, 191, 255)"># Version ( 0, 191, 255)">ZN>= 2.0.0 )


It is used to set the version information of the XML document.

Parameters

0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ version = 169, 185, 50); font-family:consolas,monospace">'1.0' Version of the document.
return 0, 187, 208); font-family:consolas,monospace">this

Use of

0, 187, 208); font-family:consolas,monospace">XML::version(169, 185, 50); font-family:consolas,monospace">'1.1'); 

 

0, 191, 255)"># Encoding ( 0, 191, 255)">ZN>= 2.0.0 )


Used to set the character encoding of the XML document.

Parameters

0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ encoding = 169, 185, 50); font-family:consolas,monospace">'utf-8' Encoding of the document.
return 0, 187, 208); font-family:consolas,monospace">this

Use of

0, 187, 208); font-family:consolas,monospace">XML::version(169, 185, 50); font-family:consolas,monospace">'1.1')->encoding(169, 185, 50); font-family:consolas,monospace">'UTF-8'); 

 

0, 191, 255)"># Build ( 0, 191, 255)">ZN> = 2.0.0 )


Used to create XML data.

Parameters

0, 187, 208); font-family:consolas,monospace">Array 252, 155, 155); font-family:consolas,monospace">$ array It is used to write the XML document to be created in an array form.
0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ version = 0, 187, 208); font-family:consolas,monospace">230, 42, 90); font-family:consolas,monospace">NULL 0, 187, 208); font-family:consolas,monospace">The XML :: version () method can be used instead of this parameter.
0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ encoding = 0, 187, 208); font-family:consolas,monospace">230, 42, 90); font-family:consolas,monospace">NULL 0, 187, 208); font-family:consolas,monospace">The XML :: encoding () method can be used instead of this parameter.
return 0, 187, 208); font-family:consolas,monospace">String

Use of

252, 155, 155); font-family:consolas,monospace">$data = 0, 187, 208); font-family:consolas,monospace">XML::build(
[  
    169, 185, 50); font-family:consolas,monospace">'name'  => 169, 185, 50); font-family:consolas,monospace">'media', 
    169, 185, 50); font-family:consolas,monospace">'attr'  => [169, 185, 50); font-family:consolas,monospace">'id' => 1], 
    169, 185, 50); font-family:consolas,monospace">'child' => 
    [ 
        [169, 185, 50); font-family:consolas,monospace">'name' => 169, 185, 50); font-family:consolas,monospace">'video', 169, 185, 50); font-family:consolas,monospace">'attr' => [169, 185, 50); font-family:consolas,monospace">'id' => 2], 169, 185, 50); font-family:consolas,monospace">'content' => 169, 185, 50); font-family:consolas,monospace">'Vidyo'], 
        [
            169, 185, 50); font-family:consolas,monospace">'name'  => 169, 185, 50); font-family:consolas,monospace">'music', 
            169, 185, 50); font-family:consolas,monospace">'attr'  => [169, 185, 50); font-family:consolas,monospace">'id' => 3], 
            169, 185, 50); font-family:consolas,monospace">'child' => 
            [ 
                [169, 185, 50); font-family:consolas,monospace">'name' => 169, 185, 50); font-family:consolas,monospace">'video', 169, 185, 50); font-family:consolas,monospace">'attr' => [169, 185, 50); font-family:consolas,monospace">'id' => 2], 169, 185, 50); font-family:consolas,monospace">'content' => 169, 185, 50); font-family:consolas,monospace">'Vidyo'], 
                [169, 185, 50); font-family:consolas,monospace">'name' => 169, 185, 50); font-family:consolas,monospace">'video', 169, 185, 50); font-family:consolas,monospace">'attr' => [169, 185, 50); font-family:consolas,monospace">'id' => 2], 169, 185, 50); font-family:consolas,monospace">'content' => 169, 185, 50); font-family:consolas,monospace">'Vidyo'], 
                [169, 185, 50); font-family:consolas,monospace">'name' => 169, 185, 50); font-family:consolas,monospace">'video', 169, 185, 50); font-family:consolas,monospace">'attr' => [169, 185, 50); font-family:consolas,monospace">'id' => 2], 169, 185, 50); font-family:consolas,monospace">'content' => 169, 185, 50); font-family:consolas,monospace">'Vidyo'] 
            ]
        ]
     ]
]);

45, 81, 115); border-image: none; color: rgb(44, 80, 114); line-height: 1.7; font-family: consolas,monospace; font-size: 14px; margin-bottom: 10px; background-color: rgb(255, 255, 255);">< Xml version = "1.0" encoding = "UTF-8"?>
< Media id = "1">
< video id = "2"> Video < / video >
< music id = "3">
  < video id = " 2 "> video < / video >
  < video id =" 2 "> video < / video >
  < video id =" 2 "> video < / video >
< / music >
< / media >

 

0, 191, 255)"># Save ( 0, 191, 255)">ZN> = 3.0.0 )


Used to create XML file.

Parameters

0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ file The name of the document to be saved.
0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ data Which data will be saved to the document.
return 0, 187, 208); font-family:consolas,monospace">Bool

Use of

0, 187, 208); font-family:consolas,monospace">XML::save(169, 185, 50); font-family:consolas,monospace">'test', 252, 155, 155); font-family:consolas,monospace">$data); 0, 191, 255)"># test.xml 

 

0, 191, 255)"># Load ( 0, 191, 255)">ZN>= 3.0.0 )


Used to load an XML document.

Parameters

0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ file The name of the document to be loaded.
return 0, 187, 208); font-family:consolas,monospace">String

Use of

0, 187, 208); font-family:consolas,monospace">XML::load(169, 185, 50); font-family:consolas,monospace">'test'); 0, 191, 255)"># test.xml 

 

0, 191, 255)"># Parse ( 0, 191, 255)">ZN>= 3.0.0 )


Used to parse an XML document. Used to perform a transformation on an object or array data type.

Parameters

0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ xml The XML string to be searched.
0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ type = 169, 185, 50); font-family:consolas,monospace">'array' Which type will be parsed.
Options 199, 37, 78); font-family:menlo,monaco,consolas,monospace">0, 187, 208); font-family:consolas,monospace">array ,199, 37, 78); font-family:menlo,monaco,consolas,monospace">0, 187, 208); font-family:consolas,monospace"> object ,199, 37, 78); font-family:menlo,monaco,consolas,monospace"> json
return 0, 187, 208); font-family:consolas,monospace">Mixed

Use of

0, 187, 208); font-family:consolas,monospace">XML::parse(252, 155, 155); font-family:consolas,monospace">$data, 169, 185, 50); font-family:consolas,monospace">'array'); 0, 191, 255)"># Return 0, 187, 208); font-family:consolas,monospace">array 

 

0, 191, 255)"># ParseObject ( 0, 191, 255)">ZN>= 3.0.0 )


Used to convert an XML document to object data.

Parameters

0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ xml The XML string to be searched.
return 0, 187, 208); font-family:consolas,monospace">Object

Use of

0, 187, 208); font-family:consolas,monospace">XML::parseObject(252, 155, 155); font-family:consolas,monospace">$data); 0, 191, 255)"># Return 0, 187, 208); font-family:consolas,monospace">object 

 

0, 191, 255)"># ParseArray ( 0, 191, 255)">ZN>= 3.0.0 )


Used to convert an XML document to an array data object.

Parameters

0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ xml The XML string to be searched.
return 0, 187, 208); font-family:consolas,monospace">Array

Use of

0, 187, 208); font-family:consolas,monospace">XML::parseArray(252, 155, 155); font-family:consolas,monospace">$data); 0, 191, 255)"># Return 0, 187, 208); font-family:consolas,monospace">array 

 

0, 191, 255)"># Parsegson ( 0, 191, 255)">ZN>= 3.0.0 )


Used to convert an XML document to an array data object.

Parameters

0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ xml The XML string to be searched.
return 0, 187, 208); font-family:consolas,monospace">String

Use of

0, 187, 208); font-family:consolas,monospace">XML::parseJson(252, 155, 155); font-family:consolas,monospace">$data); 0, 191, 255)"># Return json 

 

0, 191, 255)"># ParseSimple ( 0, 191, 255)">ZN>= 5.3.5 )


Used to retrieve tag properties and values ​​of an XML document. 199, 37, 78); font-family:menlo,monaco,consolas,monospace">SimpleXMLElement class.

Parameters

0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ xml The XML string to be searched.
return 0, 187, 208); font-family:consolas,monospace">Mixed

Use of

252, 155, 155); font-family:consolas,monospace">$data = '<xml version="1.0" encoding="UTF-8"?>
<media id="1">
<video id="2">Vidyo</video>
<music id="3">
  <video id="2">Vidyo1</video>
  <video id="2">Vidyo2</video>
  <video id="2">Vidyo3</video>
</music>
</media>';

252, 155, 155); font-family:consolas,monospace">$parse = 0, 187, 208); font-family:consolas,monospace">XML::parseSimple(252, 155, 155); font-family:consolas,monospace">$data);

echo 252, 155, 155); font-family:consolas,monospace">$parse->music->video;
echo 252, 155, 155); font-family:consolas,monospace">$parse->music->video[1];
45, 81, 115); border-image: none; color: rgb(44, 80, 114); line-height: 1.7; font-family: consolas,monospace; font-size: 14px; margin-bottom: 10px; background-color: rgb(255, 255, 255);">Video1
Video2

 

0, 191, 255)"># Check ( 0, 191, 255)">ZN>= 4.3.5 )


Controls whether the syntax of an XML document is valid.

Parameters

0, 187, 208); font-family:consolas,monospace">String 252, 155, 155); font-family:consolas,monospace">$ xml The XML string to check.
return 0, 187, 208); font-family:consolas,monospace">Bool

Use of

echo 0, 187, 208); font-family:consolas,monospace">XML::check(252, 155, 155); font-family:consolas,monospace">$data);
45, 81, 115); border-image: none; color: rgb(44, 80, 114); line-height: 1.7; font-family: consolas,monospace; font-size: 14px; margin-bottom: 10px; background-color: rgb(255, 255, 255);">230, 42, 90); font-family:consolas,monospace">one