XML Namespace tutorial for complete Beginners
Aug 15, 2023
XML Namespace tutorial for complete Beginners
website - https://automationstepbystep.com/ What is namespace in XML What is the use of namespaces How to create a namespace XML Namespace examples Prefixes can be used in XML to resolve elements name conflicts When using prefixes in xml, a namespace for the prefix must be defined xmlns:prefix=“URI” The namespace can be defined by an xmlns attribute in the start tag of an element All child elements with the same prefix are associated with the same namespace Namespaces can also be declared in the XML root element Default Namespaces Defining a default namespace for an element saves us from using prefixes in all the child elements xmlns=“namespace URI” XML namespaces are used for providing uniquely named elements and attributes in an XML document Referenceshttps://www.w3schools.com/xml/xml_nam …https://en.wikipedia.org/wiki/XML_nam … Join Automation Step By Step channel: https://www.youtube.com/automationste … Udemy Discounts - https://automationstepbystep.com/udem … Every LIKE \u0026 SUBSCRIPTION gives me great motivation to keep working for you You can support my mission for education by sharing this knowledge and helping as many people as you can If my work has helped you, consider helping any animal near you, in any way you can. _______ ONLINE COURSES TO LEARN _______https://automationstepbystep.com/onli … GitHub - https://github.com/Raghav-Pal/ Udemy - https://www.udemy.com/user/raghav-pal-3/ Training by Raghav at your venue - [email protected] Training schedule - https://automationstepbystep.com/trai … ----------- UI TESTING ----------- Selenium Beginners - https://bit.ly/2MGRS8K Selenium Java Framework from Scratch - https://bit.ly/2N9xvR6 Selenium Python - https://bit.ly/2oyMp5x Selenium Tips - https://bit.ly/2owxc50 Selenium Builder - https://bit.ly/2MKNtlq Katalon Studio - https://bit.ly/2wARFdi Robot Framework with RIDE- https://bit.ly/2Px6Ue9 Robot Framework with Eclipse - http://bit.ly/2N8DZxb Protractor - http://bit.ly/2KtqVkU TestProject - http://bit.ly/2DRNJYE ----------- API TESTING ----------- Web Services (API) - https://bit.ly/2MGafL7 SoapUI - https://bit.ly/2MGahmd Postman - https://bit.ly/2wz8LrW General - https://bit.ly/2PYdwmV Katalon Studio API Testing - https://bit.ly/2BwuCTN ----------- MOBILE TESTING ----------- Appium - https://bit.ly/2ZHFSGX Mobile Playlist - https://bit.ly/2PxpeUv ----------- CI | CD | DEVOPS ----------- Jenkins Beginner - https://bit.ly/2MIn8EC Jenkins Tips \u0026 Trick - https://bit.ly/2LRt6xC Docker - https://bit.ly/2MInnzx Kubernetes - http://bit.ly/2MJIlMK ------------VIRTUALISATION------------ Virtualization on windows - http://bit.ly/2SItIL9 ----------- VERSION CONTROL SYSTEM ----------- Git \u0026 GitHub - https://bit.ly/2Q1pagY GitLab - http://bit.ly/2kQPGyQ ----------- PERFORMANCE TESTING ----------- JMeter Beginner - https://bit.ly/2oBbtIU JMeter Intermediate - https://bit.ly/2oziNVB JMeter Advanced - https://bit.ly/2Q22Y6a JMeter Tips \u0026 Tricks - https://bit.ly/2NOfWD2 Performance Testing - https://bit.ly/2wEXbLS ----------- PROGRAMMING ----------- Java Beginners - https://bit.ly/2PVUcXs Java Tips \u0026 Tricks - https://bit.ly/2CdcDnJ GROOVY - https://bit.ly/2FvWV5C JAVASCRIPT - http://bit.ly/2KJDZ8o PYTHON - http://bit.ly/2Z4iRye ----------- IDE ----------- Visual Studio Code - https://bit.ly/2V15yvt ----------- BUILD TOOLS ----------- Maven - https://bit.ly/2NJdDRS Gradle - http://bit.ly/30l3h1B ----------- OTHERS ----------- Redis- https://bit.ly/2N9jyCG Misc - https://bit.ly/2Q2q5xQ Tools \u0026 Tips - https://bit.ly/2oBfwoR QnA Friday- https://bit.ly/2NgwGpw Sunday Special - https://bit.ly/2wB23BO Ask Raghav - https://bit.ly/2CoJGWf Interviews - https://bit.ly/2NIPPxk All Playlists - https://bit.ly/2LSiezA ---------- Connect with Raghav ----------- Website - https://automationstepbystep.com/ LifeCharger - http://lifecharger.org/ Udemy Courses - https://www.udemy.com/user/raghav-pal-3/ Facebook - https://www.facebook.com/automationst … Twitter - https://twitter.com/LearnWithRaghav Youtube - / automationstepbystep Never Stop Learning Raghav
Content
0.81 -> Hello and welcome to this session I am Raghav
and in this session, We are going to learn
6.06 -> all about XML namespace Do not worry If you
have no prior knowledge on this topic I will
11.55 -> go very basic step by step and we will start
from scratch. So let's get started Let us
17.57 -> see this example We have an XML where we have
a table element and inside the table element
24.38 -> We have 3 more elements and with the information,
it is giving us It looks like we are talking
31.15 -> about a Furniture table here. If you look
at this another XML here again, we have our
36.81 -> table element and then we have elements like
TR TD, which is for rows and columns and it
43.6 -> looks like here we are talking about HTML
table Now This is all fine If these two tables-
49.53 -> if these are two XML's I used separately and
they are not associated with each other in
55.79 -> any ways However, if we happen to combine
these To xml's together, they will be a conflict
63.31 -> because of the common table element and to
resolve this conflict We can use a prefix
69.229 -> in our elements For example, if I talk about
the furniture table here, I can add a prefix
76.17 -> and here you can see we have added a prefix
called f for all the elements here And now
83.149 -> for the HTML table we can do something similar
here We have added a prefix h in front of
90.74 -> all the elements and now these two elements
are different and they can be used together
97.49 -> and then they will be no conflict because
we are using different names now until now
103.899 -> we have just talked about prefixes that will
help us to resolve the conflicts when we have
110.42 -> common elements We need to understand about
the XMLns or XML namespace attribute whenever
117.549 -> we are using prefixes in our XML a namespace
for the prefix must be defined and here is
124.289 -> the syntax We say xmlns whatever the prefix
we have used equals to our URI For example,
133.53 -> if we happen to combine our earlier 2 xml's
together. I will create a root element and
139.18 -> then here we have our first XML that talks
about HTML table and here we have a prefix
146.599 -> H already added to all the elements and here
I will say xmlns:h which is the prefix equals
154.69 -> to r u r i so this is how we can declare a
namespace and the namespace can be declared
161.879 -> and defined in the starting of the element
or the starting of the XML in the root element
166.87 -> itself And then all the child elements for
that particular tag or element will be associated
173.51 -> with the same namespace and here you can see
the other XML here I can define a XML namespace
181.98 -> attribute like this and I will give the prefix
here and this is how I can Define it and we
188.129 -> can also Define or declare all the name spaces
in the root element itself so that we do not
194.65 -> have to Define him Define the XML namespace
or declare them every time in the rest of
201.439 -> the XML here is how we do that You can see
I have defined both the XML namespaces in
208.299 -> the root element itself Now I do not need
to declare them again in the XML Let me show
214.34 -> you an example I will go to Google and search
for Sample web service so that I can show
223.86 -> you some XML and I'm going to this calculator
web service here And here if I go to this
230.659 -> service description, which will be a XML document
You can see here All the namespaces are declared
238.599 -> in the starting in the root element itself
And then in the rest of the XML I do not need
243.53 -> to declare them again, I can directly use
the prefixes and this is how we can use a
250.079 -> XML namespace now We need to understand about
default name spaces Now if you define a Default
258.85 -> namespace for an element all the child elements
will be associated with that name space and
264.53 -> it will save us from using prefixes in all
the child elements. And this is how we do
271.319 -> it We say XMLns = namespace URI and here you
can see an example here I have added the XML
279.6 -> namespace attribute and all the child elements
will be now associated with this XML namespace
285.449 -> and I do not need to add the fixes for all
the elements and this is another example,
292.509 -> let me show you here This is our XML document
and this is actually a wsdl which is web services
299.59 -> description language And this is what we use
in soap API's Now do not worry about that
304.229 -> I have a separate video to explain what is
wsdl, but just for parsing this document this
310.069 -> XML document I can use a extension on my Chrome
browser So if I go to the web store and On
318.361 -> my Chrome I can use extension called Whistler
and this is used to parse a wsdl document
327.59 -> And this is the extension I have already added
it And here it is This will pass the XML document
334.3 -> So I will click this and it shows me all the
services in this XML I can click on any of
339.83 -> the service and it shows me the XML of that
API service or that request and here you can
346.36 -> see this is how we can define a XML namespace
and all the child elements will be associated
353.72 -> with this particular namespace now in case
any of the child elements needs to be associated
359.48 -> with a different name space You can also do
like this So here the add element belongs
365.05 -> to this namespace and all its child elements
will now be associated with this particular
370.05 -> namespace. So this is how you can Define default
namespaces now Wikipedia says that XML Spaces
378.83 -> are used for providing uniquely named elements
and attributes in an XML document and I hope
385.47 -> now you understand this. We have learned this
in a very simple way I hope all this was useful
390.55 -> You can go and share your knowledge with everyone
also Let me know how did you like this video
395.419 -> and I will meet you in the next session Thank
you for watching.
Source: https://www.youtube.com/watch?v=VTQRGDhH6WQ