Results: 1580
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Rules that should be followed when we use XML comments:
- Comment must appear after XML declaration.
- Comment may appear anywhere in a document
- Comment must not appear within attribute values.
- Comment cannot be nested inside the other comment.
by Valeri Tandilashvili
4 years ago
0
XML
XML comments
XML Tutorial
0
The term
CDATA
means,
Character Data
. CDATA is defined as blocks of text that
are not parsed
by the parser, but are otherwise recognized as markup
<?xml version="1.0" encoding="UTF-8"?>
<student>
    <!-- Some comment about the student -->
    <first-name>George</first-name>
    <phone.mobile>(011) 123-4567</phone.mobile>
    <city />
    <description>
        <![CDATA[
            <p>
            <a href="/mylink/article1"><img style="float: left; margin-right: 5px;" height="80" src="/mylink/image" alt=""/></a>
            Author Names
            <br/><em>Date</em>
            <br/>Paragraph of text describing the article to be displayed</p>
        ]]>        
    </description>
</student>
CDATA Start section
- CDATA begins with the nine-character delimiter
<![CDATA[
CDATA End section
- CDATA section ends with
]]>
delimiter
CData section
- Characters inside
CData
section are interpreted as characters, and not as markup. It may contain markup characters
<
,
>
, and
&
, but they are ignored by the XML processor
by Valeri Tandilashvili
4 years ago
0
XML
XML CDATA
XML Tutorial
0
1.
CDATA 
cannot contain the string
]]>
anywhere in the XML document 2.
Nesting
is not allowed in CDATA section
by Valeri Tandilashvili
4 years ago
0
XML
XML CDATA
XML Tutorial
0
1. CDATA is still
part of the document
, while a comment is not 2. In CDATA we cannot include the string
]]>
, while in a comment
--
3. CDATA content is visible on the web if we specify
xmlns
attribute as
http://www.w3.org/1999/xhtml
, even if the file is saved as
.xml
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>CDATA Example</title>
    </head>
    <body>

        <h2>Using a Comment</h2>
        <div id="commentExample">
            <!--
            You won't see this in the document
            and can use reserved characters like
            < > & "
            -->
        </div>

        <h2>Using a CDATA Section</h2>
        <div id="cdataExample">
            <![CDATA[
            You will see this in the document
            and can use reserved characters like
            < > & "
            ]]>
        </div>

    </body>
</html>
by Valeri Tandilashvili
4 years ago
0
XML
XML CDATA
0
There are 3 types of whitespace within an XML document, XML Syntax, Significant and Insignificant
1. XML Syntactical whitespace - is whitespace required by the XML in order to delimitate XML constructs.

2. Insignificant Whitespace - is whitespace, that is not considered part of an element, if two elements are separated by just whitespace its considered insignificant.

3. Significant Whitespace - is whitespace that XML element attribute contains.
by Valeri Tandilashvili
4 years ago
0
XML
XML White Spaces
0
XML Processing instructions allow documents to contain instructions for applications. PI consists of two parts: 1.
target
- Identifies the application to which the instruction is directed. 2.
instruction
- A character that describes the information for the
target
application to process. ... PI's example in real XML document
<?xml version="1.0" encoding="UTF-8"?>
<student>
    <?sort alpha-ascending?>
    <?textinfo whitespace is allowed ?>
    <first-name>George</first-name>
    <phone.mobile>(011) 123-4567</phone.mobile>
</student>
In this example we have two PIs 1.
sort
with value -
alpha-ascending
2.
textinfo
with value -
whitespace is allowed
... Note: processing instructions can contain any data except the combination
?>
, which is interpreted as a closing delimiter
by Valeri Tandilashvili
4 years ago
0
XML
XML PIs
0
XML - get PI's values using PHP
The code below can be used to get PI's value from an XML document
<?php

$my_xml_data = 
'<?xml version="1.0" encoding="UTF-8"?>
<student>
    <?sort alpha-ascending?>
    <?textinfo whitespace is allowed ?>
    <first-name>George</first-name>
    <phone.mobile>(011) 123-4567</phone.mobile>
</student>';

$xml = simplexml_load_string($my_xml_data);

$doc   = dom_import_simplexml($xml)->ownerDocument;
$xpath = new DOMXPath($doc);

# prints "/* processing instructions */ ", the value of the first PI: textinfo
echo $xpath->evaluate('string(//processing-instruction("textinfo")[1])');
The output of the above code is the following:
whitespace is allowed
by Valeri Tandilashvili
4 years ago
0
XML
XML Processing Instructions
0
There are two the most commonly used Encoding Types for XML documents: 1.
UTF-8
- 8-bits are used to represent a character 2.
UTF-16
- 16-bits are used to represent a character ...
UTF
stands for
UCS Transformation Format
, and UCS itself means
Universal Character Set
... XML document example that has
UTF-8
encoding
<?xml version="1.0" encoding="UTF-8"?>
<student>
    <first-name>George</first-name>
    <phone.mobile>(011) 123-4567</phone.mobile>
</student>
Note: If an XML document has not specified encoding, the default is
UTF-8
by Valeri Tandilashvili
4 years ago
0
XML
XML Encoding
XML Tutorial
0
XML Schema Definition (XSD) is used to validate and describe an XML data structure and content . It defines the
elements
,
attributes
and
data types
. Here is how XML schema looks like
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="company">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="id" type="xs:unsignedInt" />
        <xs:element name="name" type="xs:string" />
        <xs:element name="phone" type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
The XML schema is derived from the following XML:
<company>
    <id>2859385</id>
    <name>Tanmay Patil</name>
    <phone>(011) 123-4567</phone>
</company>
The XML schema is generated using the following online tool:
https://www.liquid-technologies.com/online-xml-to-xsd-converter
by Valeri Tandilashvili
4 years ago
0
XML
XML Schemas
XML Tutorial
0
passing PHP values to JS in Laravel blade
Correct way to pass values to
JS
is to use
!!
directives:
<script>
        
    change_asset_category('{!! $category_values !!}');

</script>
The result will be:
<script>
        
change_asset_category('{"version":"vers","patch_level":"patc","bcp_dr":"bcp\/d"}');

</script>
by Valeri Tandilashvili
4 years ago
0
Laravel
0
Results: 1580