|
Why would you want to develop a custom xml while standards already exist?
www.xcbl.org
www.cxml.org
|
|
|
|
|
If I have a XML like this which I am loading into javascript using DomDocument object. Please note that this XML is having an "ampersand".
<DataSet>
<Row>
<NDOCUMENTID>499</NDOCUMENTID>
<TDESCRIPTION>my & god</TDESCRIPTION>
<TDISPLAYNAME>my god</TDISPLAYNAME>
<TTITLE>my god</TTITLE>
<NPARENT_DOC_ID>0</NPARENT_DOC_ID>
<NPARENT_FOLDER_ID>496</NPARENT_FOLDER_ID>
</Row>
<Row>
<NDOCUMENTID>501</NDOCUMENTID>
<TDESCRIPTION>Level 2Folder</TDESCRIPTION>
<TDISPLAYNAME>Level 2Folder</TDISPLAYNAME>
<TTITLE>Level 2Folder</TTITLE>
<NPARENT_DOC_ID>0</NPARENT_DOC_ID>
<NPARENT_FOLDER_ID>500</NPARENT_FOLDER_ID>
</Row>
</DataSet>
After loading into javascript DomDocument object selectNodes() returns 0.
var objXML = new ActiveXObject("MSXML2.DomDocument");
. . . .
objFolderNodes = objXML.selectNodes("//DataSet/Row[NPARENT_FOLDER_ID = '496']");
alert("objFolderNodes.length :"+objFolderNodes.length);
Please note that if I remove the '&', above code working fine.
Any help is appreciated. Thanks in advance.
Thanks,
Arindam D Tewary
modified on Monday, February 2, 2009 3:37 AM
|
|
|
|
|
|
<report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<body>
<reportitems>
<textbox name="textbox1">
<rd:defaultname>textbox1</rd:defaultname>
<visibility>
<hidden>true</hidden>
</visibility>
<top>2.75in</top>
<width>1in</width>
<style>
<paddingleft>2pt</paddingleft>
<paddingright>2pt</paddingright>
<paddingtop>2pt</paddingtop>
<paddingbottom>2pt</paddingbottom>
</style>
<zindex>3</zindex>
<cangrow>true</cangrow>
<left>4.75in</left>
<height>1.125in</height>
<value>tttttttttttttttttttttttttttttttttttttttttttt</value>
</textbox>
</reportitems>
</body>
<language>en-US</language>
<topmargin>1in</topmargin>
</report>
I have a xml document like this, when i tried to use createdocumentfragment() to add another textbox node
<textbox name="textbox2">
<rd:defaultname xmlns:rd="#unknown">textbox2</rd:defaultname>
<visibility>
<hidden>true</hidden>
</visibility>
<top>2.75in</top>
<width>1in</width>
<style>
<paddingleft>2pt</paddingleft>
<paddingright>2pt</paddingright>
<paddingtop>2pt</paddingtop>
<paddingbottom>2pt</paddingbottom>
</style>
<zindex>3</zindex>
<cangrow>true</cangrow>
<left>4.75in</left>
<height>1.125in</height>
<value>ssssssssssssssssssssssssssssssssss</value>
</textbox>
since there is a <rd:defaultname xmlns:rd="#unknown"></rd:defaultname>, I get an error saying rd namespace not declared.
Anyone has some idea about it?
Thanks in advance!
Ricky
|
|
|
|
|
As far as I know, you have to repeat the explicit declarations in the document fragment:
<textbox xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" name="textbox2">
<rd:defaultname xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">textbox2</rd:defaultname>
<visibility>
<hidden>true</hidden>
</visibility>
<top>2.75in</top>
<width>1in</width>
<style>
<paddingleft>2pt</paddingleft>
<paddingright>2pt</paddingright>
<paddingtop>2pt</paddingtop>
<paddingbottom>2pt</paddingbottom>
</style>
<zindex>3</zindex>
<cangrow>true</cangrow>
<left>4.75in</left>
<height>1.125in</height>
<value>ssssssssssssssssssssssssssssssssss</value>
</textbox>
"We make a living by what we get, we make a life by what we give." --Winston Churchill
modified on Friday, January 30, 2009 3:03 PM
|
|
|
|
|
Greetings!
I would like to use XSLT for ASP server control generation, but when I try to get asp namespace in editor I'm not getting and intellisense for asp controls.
what url should I use for xmlns:asp to get it working?
thanks!
|
|
|
|
|
I'll make this simple:
Here's my XML input:
<a>
<b>123</b>
<c>234</c>
<d>
<e id="c" />
<f id="a" />
</d>
</a>
I want this as output: (note all is same but e & f id's are alpha sorted
<a>
<b>123</b>
<c>234</c>
<d>
<f id="a" />
<e id="c" />
</d>
</a>
|
|
|
|
|
crystal9154 wrote: Not getting ANY help from this site on XSLT
crystal9154 wrote: Could someone kindly offer me the correct xslt code
I'm sorry no one has offered to do your work for you, no really, I am.
|
|
|
|
|
|
|
|
no, I really meant it, f*** off. Besides since you can't get your job done, how do you have the time to post your useless insults to me on the internet? Ah, maybe we are on to something here.
|
|
|
|
|
obviously you possess zero life
|
|
|
|
|
hey sh-t for brains, led mike
i solved the problem myself so thanks for being an a-hole.
hey read your bio,
at least understanding your an a-hole is step 1 to recovery
buh bye
|
|
|
|
|
crystal9154 wrote: thanks for being an a-hole
No problem. Post some useless jackass questions anytime you want some more. I'm here all week.
crystal9154 wrote: i solved the problem myself
Imagine that! What a novel idea! Are you sure that's what you are getting paid for though, I mean if they really want you to get other people to do your work using internet forums then perhaps you should have waited until someone provided you the code.
|
|
|
|
|
Hi Friend,
May be u r true but still but if u want to take help from others u should have patience. That we all should realize.
Thanks,
Aleem Mohammad.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
Could someone kindly offer me the correct xslt code to sort by factoryNum and copy to new xml, retaining all elements and attributes from original XML? Thanks in advance
'******************************
Here's my code but not working:
'******************************
Dim xslt As String =
"<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>" & _
"<xsl:template match='winelist'>" & _
"<xsl:for-each select='wine/winery'>" & _
"<xsl:sort select='@factoryNum' order='descending' data-type='number'/>" & _
"<xsl:copy-of select='.'/>" & _
"</xsl:for-each>" & _
"</xsl:template>" & _
"</xsl:stylesheet>"
'****************************
Here's my source xml:
'****************************
<?xml version="1.0" encoding="utf-16"?>
<winelist>
<wine>
<winery factoryNum="2">Lindeman's</winery>
<product>Bin 65</product>
<year>1998</year>
<prices>
<list>6.99</list>
<discounted>5.99</discounted>
<case>71.50</case>
</prices>
</wine>
<wine>
<winery factoryNum="1">Benziger</winery>
<product>Carneros</product>
<year>1997</year>
<prices>
<list>10.99</list>
<discounted>9.50</discounted>
<case>114.00</case>
</prices>
</wine>
<wine>
<winery factoryNum="4">Kendall Jackson</winery>
<product>Vintner's Reserve</product>
<year>1998</year>
<prices>
<list>12.50</list>
<discounted>9.99</discounted>
<case>115.00</case>
</prices>
</wine>
<wine>
<winery factoryNum="3">Duckpond</winery>
<product>Merit Selection</product>
<year>1996</year>
<prices>
<list>13.99</list>
<discounted>11.99</discounted>
<case>143.50</case>
</prices>
</wine>
</winelist>
|
|
|
|
|
Demanding help and insulting members who volunteer their expert assistance is pitiful!
As far as your problem is concerned, I would place the result of the sorted nodes in a variable. Then, I would copy the sorted nodes in the variable.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I have an XML file looking like this (just an example):
<br />
<?xml version="1.0" encoding="UTF-8" ?> <br />
<family><br />
<name xmlns="http://www.opentrans.org/XMLSchema/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" type="standard"><br />
<firstname>Tom</firstname> <br />
<lastname>Smith</lastname> <br />
</name><br />
<name xmlns="http://www.opentrans.org/XMLSchema/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" type="standard"><br />
<firstname>Dale</firstname> <br />
<lastname>Smith</lastname> <br />
</name><br />
</family><br />
I can read up the document as a XMLDocument and navigate through SelctNodes if the Namespace attribute is not present. I have understood that I need to specify some kind of namespace using a namespace manager.
This is my code so far :
<br />
'Create objcts<br />
Dim m_xmld As XmlDocument<br />
Dim m_nodelist As XmlNodeList<br />
Dim m_node As XmlNode<br />
'Create the XML Document<br />
m_xmld = New XmlDocument()<br />
'Load the Xml file<br />
m_xmld.Load("D:\family.xml")<br />
'Get the list of name nodes <br />
m_nodelist = m_xmld.SelectNodes("/family/name")<br />
'How many nodes<br />
msgbox(m_nodelist.count)<br />
Anyone can fill in the missing parts for me? C# or VB.NET .. doesn't matter
Regards // M
|
|
|
|
|
|
I used the link and could get all my orders suing namespace. Under each namespace there is a lot of elements like <order_id> and others.
I loop through my orders without problems.
But how do I select a child to a node using namespace? releative XPath in other words.
My code now look like this:
'Objects()
Dim XDoc As New XmlDocument
Dim Orders As XmlNodeList
'Try to read doc
XDoc.Load(ImportFile)
'Create an XmlNamespaceManager for resolving namespaces.
Dim XN As XmlNamespaceManager = New XmlNamespaceManager(XDoc.NameTable)
XN.AddNamespace("Order", "http://www.opentrans.org/XMLSchema/1.0")
'Get Orders from XML
Orders = XDoc.SelectNodes("//Order:ORDER", XN)
For Each Order As XmlNode In Orders
dim MyOrderId as string = Orders.SelectSingleNode("ORDER_ID",XN).innerText
next
That doesn't work if I want the OrderID.
If I use
Order.SelectSingleNode("/Order:ORDER_DATE", XN)
I get the first OrderID each time.
Ideas?
//M
|
|
|
|
|
The XML you are now working with (based on your XPath statements) does not seem to match what you posted.
|
|
|
|
|
Using your original posted XML this code outputs TomSmith as expected
XmlDocument doc = new XmlDocument();
doc.Load("c:\\Research\\Xml\\Namespaces.xml");
XmlNamespaceManager man = new XmlNamespaceManager( doc.NameTable);
man.AddNamespace("ot", "http://www.opentrans.org/XMLSchema/1.0");
XmlNode fam = doc.SelectSingleNode("//family");
XmlNode n = fam.SelectSingleNode("ot:name", man);
Console.WriteLine(n.InnerText);
|
|
|
|
|
Wonderful ..
Now lets say I want to go 1 steå under name
You select the Family but under name I have firstname and lastname ...
Can I do a SingleNodeSelect 2 steps down in the structure like "ot:name/firstname"?
//h
|
|
|
|
|
Hopefully by know you have already tried that and discovered that you need to QName all the child nodes.
"ot:name/ot:firstname"
|
|
|
|