473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

xmlns attributes are added automatically to nodes

I'm new to xml and having an issue listed below:

I have a sample xml file:

<?xml version="1.0" encoding="utf-8"?>
<tt xml:lang="en" xmlns="http://www.w3.org/ns/ttml" xmlns:tts="http://www.w3.org/ns/ttml#styling"
xmlns:ttp="http://www.w3.org/ns/ttml#parameter" xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
ttp:profile="http://www.netflix.com/ns/ttml/profile/nflx-tt" ttp:frameRate="24"
ttp:frameRateMultiplier="1000 1001" ttp:dropMode="nonDrop" ttp:timeBase="smpte">
<head>
<styling>
<style xml:id="style.default" tts:fontFamily="Arial" tts:fontSize="100%" tts:fontStyle="normal" tts:fontWeight="normal" tts:backgroundColor="transparent" tts:color="white" />
</styling>
<layout>
<region xml:id="region.after.center" tts:displayAlign="after" tts:textAlign="center" tts:origin="10% 10%" tts:extent="80% 80%" />
</layout>
</head>
<body>
<div xml:lang="en">
<p begin="00:03:14:09" xml:id="p62" end="00:03:16:23" region="region.after.center" style="style.default">And that was it.<br />That was his story, right?</p>
<p begin="00:03:18:14" xml:id="p63" end="00:03:19:16" region="region.after.center" style="style.default">
<span tts:fontStyle="italic">So now...</span>
</p>
</div>
</body>
</tt>

Now I have a simple xpath : `//*[starts-with(name(),'d')]` so it selects all elements under the div tag.

The problem is when evaluating the expression against the xml, I get
`xmlns="http://www.w3.org/ns/ttml"` in all `<p></p>` tags and also I get `xmlns:tts="http://www.w3.org/ns/ttml#styling"` in all `<span></span>` tags. Bewlo is a sample result of what is returned:

<p begin="00:00:34:23" xml:id="p2" end="00:00:36:00" region="region.after.center" style="style.default" xmlns="http://www.w3.org/ns/ttml">That was his story, right?</p>
<span tts:fontStyle="italic" xmlns:tts="http://www.w3.org/ns/ttml#styling">But there’s a woman there<br /> So now...</span>

so, is there is something wrong in the xml structure itself?

when adding prefix to `xmlns="http://www.w3.org/ns/ttml"` I do not get it in `<p></p>` tags but still getting xmlns in the `<span></span>` tags.



I appreciate if someone can help me out with this. Thanks in advance
Nov 10 '17 #1
1 5525
Luuk
1,047 Expert 1GB
Which tools are you using to do this?
When viewing your XML with Notepad++, and using the XML-plugin, the Xpath seems to result in what you expect
Attached Images
File Type: jpg xpath.jpg (64.5 KB, 309 views)
Jan 6 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Chris Bedford | last post by:
Hi: this question has been driving me crazy. would be grateful for any help. I am writing a version of the identity transformation to filter some documents (they happen to be wsdl docs)....
5
by: Adam Barr | last post by:
I have a tag foo that I want to copy unchanged when it is a subtag of bar, so I have a template (x is the namespace for the document): <xsl:template match="x:bar/x:foo"> <xsl:copy>...
0
by: Nicolas VanOrton | last post by:
Hi all, When XercesDOMParser parses an XML document in a file, if a Schema is attached, it automatically adds all attributes with default values to the corresponding nodes... I'm trying to...
1
by: Zhenya Sigal via .NET 247 | last post by:
I have the following code: XmlElement parent= m_xmlDoc.CreateElement("parent", "http://tempuri.org/myns"); parent.InnerXml = "<child1>text</child1><child2>text</child2>"; ...
1
by: rlcavebmg | last post by:
I need to generate an XML document that will be validated against a DTD. Up to this point, I have been using XML Serialization with good results, but there is one item I haven't been able to...
5
by: Steven Berkovitz | last post by:
Hi there, I am having a problem where if i add an attribute to a control at runtime the rendered attribute is HTML encoded. For example, on a textbox: textBox.Attributes = "if(x && y)...
4
by: Dotcom | last post by:
I have an ASP.NET application that is mysteriously acquiring height and width attributes on a particular IMG element on multiple pages. This is not being caused by someone editing or uploading new...
3
by: Linda | last post by:
Greetings! In order to keep better track a form with several combo-boxes, I've subclassed the ones that need to change in response to events on other controls on the form. An example of a...
3
by: Gary Stephenson | last post by:
I am endeavouring to use .NET v2.0 XML facilities to "roundtrip" reading and writing XML documents - i.e. to end up with _exactly_ what I started with, but I can't seem to figure out how to get an...
12
by: blackirish | last post by:
Hi all, I am trying to merge 2 XML files that first of all i need to compare nodes of both files according to 2 attributes in the nodes. If those 3 attributes are equal, i need to replace the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.