XML数据有子属性吗? [英] XML data has childattributes ?

查看:50
本文介绍了XML数据有子属性吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。


我在本文末尾附上了有问题的XML数据。


我不明白什么是< TripDataand< / TripData>。当我告诉XML文档的发布者时,他说:你将不得不使用

子属性来访问< TripDataelement的属性。


当我尝试通过XML文档迭代以确定每个元素的节点类型时,它表示< TripData是#text类型的元素。 br />

我尝试使用XMLNODE,XMLTextReader和XPathNavigator。所有方法都说

< TripData是#text的一个元素。它没有属性,而且它只有一个#text的孩子。


我不是这方面的专家,所以我读了一些XML图书。我甚至审查了它们

并查看了子属性的索引。据我所知,

没有childattributes这样的东西。


< TripDatacon包含我想要从这个网络服务消费的数据。

如何使用XPathNavigator类导航它?我可以通过XML的其余部分导航

而没有问题。


这个供应商很难使用。回复

电子邮件需要几天的时间。当你打电话给他们的技术支持网络服务时,他们从来没有办公室里任何可以回答网络服务问题的人。这篇文章是

我最后的手段试图找出< TripDatais的内容。


任何机构都能提供的任何帮助都将非常感激。


谢谢,

Tony


================ ======================= XML DATA =============

< TripExportDataObject

xmlns =" http://tempuri.org/TripExportDataObject.xsd">< Trip>< TripID> 17369< / TripID>< CurrentRevisionNumber> 3< / CurrentRevisionNumber>< IsDispatch>假LT; / IsDispatch>< IsActive>假LT; / IsActive>< IsComplete>真< / IsComplete><的isArchived>真< /的isArchived>< XVIN> 67111377< / XVIN>< OrganizationID> 1212< / OrganizationID> ;< UserDefinedRouteID> 0000000000< / UserDefinedRouteID><起始日期> 2006-08-02T22:46:00.0000000-05:00< /起始日期><结束日期> 2006-08-03T10:00:00.0000000-05:00< /结束日期>< LastMessageDate> 2006-08-03T10:06:22.16 70000-05:00< / LastMessageDate>< TRIPTYPE>商店< / TRIPTYPE>< TimeVariance大于0< / TimeVariance>< DateLastModified> 2006-08-03T10:06:22.0870000-05:00< / DateLastModified>< TripData>& lt; Trip

InternalElementID =" 1" TRIPTYPE = QUOT;店" Audited =" False"

OrganizationID =" 1212"& gt;

& lt; Actual InternalElementID =" 2" UserDefinedRouteID =" 0000000000"

XVIN =" 67111377" FinalEventFileSequenceNumber = QUOT; 205" StartingStateID =" 42"

XAMTripToken =" 1154558803267" ContainsFirstEventGroup =" True"

BegFuel =" 12786.125" EndFuel = QUOT; 12786.25" BegDateTime =" 2006-08-02T22:46:00"

EndDateTime =" 2006-08-03T10:00:00" BegXSiteID = QUOT; 68284" BegLatitude =" 40190450"

BegLongitude =" -74787700" EndXSiteID = QUOT; 68284" EndLatitude =" 40189850"

EndLongitude =" -74787570" StartingRoadwayStatus =Taxable& gt;

& lt; Stop InternalElementID =" 3" BegOdo = QUOT; 296311" EndOdo =" 296311"

BegFuel =" 12786.125" EndFuel = QUOT; 12786.25" BegDateTime =" 2006-08-02T22:46:00"

EndDateTime =" 2006-08-03T10:00:00" BegXSiteID = QUOT; 68284" BegLatitude =" 40190450"

BegLongitude =" -74787700" EndXSiteID = QUOT; 68284" EndLatitude =" 40189850"

EndLongitude =" -74787570" HasBegin = QUOT;真" HasEnd = QUOT;真" DriverInCharge =" True"
DriverInChargeXDriverID =" -1" XSiteID = QUOT; 68284" /& gt;

& lt; EventFiles InternalElementID =" 4" CloseReason =" TripEnd"

StartedMoving =" True" EndedMoving = QUOT假QUOT; StartedStateID =" 42"

EndedStateID =" 42"的SequenceNumber = QUOT; 203" BegOdo = QUOT; 296302.1" EndOdo =" 296311"

BegFuel =" 12785.25" EndFuel = QUOT; 12786.125" BegDateTime =" 2006-08-02T22:27:00"

EndDateTime =" 2006-08-02T22:46:00" BegXSiteID = QUOT; 86436" BegLatitude =" 40096470"

BegLongitude =" -74873680" EndXSiteID = QUOT; 68284" EndLatitude =" 40190450"

EndLongitude =" -74787700"& gt;

& lt; DCSEventFileClose InternalElementID =" 5" CloseOdo =" 296311"

CloseHubo =" 83131.3" /& gt;

& lt; / EventFiles& gt;

& lt; EventFiles InternalElementID =" 6" CloseReason =" NewDay"

StartedMoving =" False" EndedMoving = QUOT假QUOT; StartedStateID =" 42"

EndedStateID =" 42"的SequenceNumber = QUOT; 204" BegOdo = QUOT; 296311" EndOdo =" 296311"

BegFuel =" 12786.125" EndFuel = QUOT; 12786.125" BegDateTime =" 2006-08-02T22:46:00"

EndDateTime =" 2006-08-03T04:00:00" BegXSiteID = QUOT; 68284" BegLatitude =" 40190450"

BegLongitude =" -74787700" EndXSiteID = QUOT; 68284" EndLatitude =" 40190450"

EndLongitude =" -74787700"& gt;

& lt; DCSEventFileClose InternalElementID =" 7" CloseOdo =" 296311"

CloseHubo =" 83131.3" /& gt;

& lt; / EventFiles& gt;

& lt; EventFiles InternalElementID =" 8" CloseReason =" LeavingStop"

StartedMoving =" False" EndedMoving = QUOT;真" StartedStateID =" 42"

EndedStateID =" 42"的SequenceNumber = QUOT; 205" BegOdo = QUOT; 296311" EndOdo =" 296312.6"

BegFuel =" 12786.125" EndFuel = QUOT; 12786.375" BegDateTime =" 2006-08-03T04:00:00"

EndDateTime =" 2006-08-03T10:04:00" BegXSiteID = QUOT; 68284" BegLatitude =" 40190450"

BegLongitude =" -74787700" EndLatitude = QUOT; 40181490" EndLongitude =" -74809250"& gt;

& lt; DCSEventFileClose InternalElementID =" 9" CloseOdo =" 296312.7"

CloseHubo =" 83132.9" /& gt;

& lt; / EventFiles& gt;

& lt; / Actual& gt;

& lt ; / Trip& gt;

< / TripData>< / Trip>< Trip>< TripID> 17333< / TripID>< CurrentRevisionNumber> 10< / CurrentRevisionNumber>

解决方案

" Tony Girgenti" < tony(nospam)@ lakesideos.com写在留言中

新闻:%2 **************** @ TK2MSFTNGP05.phx.gbl ...


你好。


我在本文末尾附上了有问题的XML数据。


我不明白< TripDataand< / TripData>之间的区别。当我告诉XML文档的发布者时,他说:你将不得不使用子属性来访问< TripDataelement的属性。


当我尝试通过XML文档迭代以确定每个元素的节点类型时,它表示< TripData是#text类型的元素。 br />

我尝试使用XMLNODE,XMLTextReader和XPathNavigator。所有方法都说

< TripData是#text的一个元素。它没有属性和

它只有一个#text的孩子。


我不是这方面的专家,所以我读了一些XML图书。我甚至审查了它们

并查看了子属性的索引。至于我确定了
,没有子属性这样的东西。


< TripDatacon包含我希望从这个Web服务获取的数据

消费。我如何使用XPathNavigator类导航它?

我可以通过XML的其余部分导航而没有问题。


这个供应商很难与...合作。回复

电子邮件需要几天的时间。当你打电话给他们的技术支持网络服务时,他们永远不会在办公室里有任何人可以回答网络服务问题。这个

的帖子是我最后的手段,试图找出< TripDatais的内容。


任何机构都能提供的任何帮助都将非常感激。



Tony,它是一个文本节点。它是一个文本节点。尝试使用.InnerText和

使用它来使用XmlDocument.LoadXml加载新的XmlDocument。


John


你好约翰。


我非常感谢你对此的帮助,但我一直在尝试整个周末

来弄清楚怎么做你的建议。


据我所知,XmlDocument.LoadXml需要一个字符串。


你可以提供任何额外的帮助非常感谢。


谢谢,

Tony


" John Saunders" < john.saunders at trizetto.comwrote in message

news:u6 ************** @ TK2MSFTNGP02.phx.gbl ...
< blockquote class =post_quotes>
" Tony Girgenti" < tony(nospam)@ lakesideos.com写在留言中

新闻:%2 **************** @ TK2MSFTNGP05.phx.gbl ...


>您好。

我在本文末尾附上了有问题的XML数据。

我不明白< TripDataand< / TripData>之间的区别。当我与XML文档的发布者交谈时,他说:你将不得不使用子属性来访问< TripDataelement的属性。

我尝试通过XML文档迭代来确定每个元素的节点类型,它说< TripData是#text类型的元素。

我尝试使用XMLNODE,XMLTextReader和XPathNavigator。所有方法都说
< TripData是#text的一个元素。它没有属性和
它只有一个#text的孩子。

我不是这方面的专家,所以我读了一些XML书籍。我甚至审查了他们并查看了子属性的索引。据我所知,没有子属性这样的东西。

< TripDatacon包含我想要从这个网络服务消费的数据。如何使用XPathNavigator类导航它?
我可以毫无问题地浏览XML的其余部分。

这个供应商很难使用。回复
电子邮件需要几天的时间。当您致电他们的Web服务技术支持时,他们永远不会在办公室中有任何人可以回答Web服务问题。这个帖子是我最后的手段,试图弄清楚什么< TripDatais。

任何机构都能提供的任何帮助都将非常感激。



Tony,它是一个文本节点。它是一个文本节点。尝试使用.InnerText和

使用它来使用XmlDocument.LoadXml加载新的XmlDocument。


John



" Tony Girgenti" < tony(nospam)@ lakesideos.com写信息

新闻:uH ************** @ TK2MSFTNGP05.phx.gbl ...


你好约翰。


我真的很感谢你的帮助,但我一直在尝试所有

周末弄清楚如何做你的建议。


据我所知,XmlDocument.LoadXml需要一个字符串。


Any我们将非常感谢您提供的额外帮助。



Tony,一旦你在XmlNode中得到TripData,比如说tripData,试试:


XmlDocument temp = new XmlDocument();

temp.LoadXml(tripData.InnerText);


现在,您可以使用temp.DocumentElement作为该节点的XML数据。


John


Hello.

I have attached the XML data in question at the end of this post.

I don''t understand what is between <TripDataand </TripData>. When i
talked to the publisher of the XML document, he says: "you will have to use
childattributes to access the attributes of the <TripDataelement".

When i try to iterate thru the XML document to determine the nodetype of
each element, it says that <TripDatais an Element of type #text.

I tried using XMLNODE, XMLTextReader and XPathNavigator. All methods say
that <TripDatais an element of #text. It does not have attributes and it
only has one child of #text.

I''m not an expert at this, so i read some XML books. I even reviewed them
and looked in the indexes for childattributes. As far as i have determined,
there is no such thing as childattributes.

<TripDatacontains the data that i want from this web service consumption.
How can i navigate thru it using the XPathNavigator class ? I can navigate
thru the rest of the XML without a problem.

This vendor is very hard to work with. It takes them days to reply to
emails. When you call their tech support for web services, they never have
anybody in the office that can answer web services questions. This post is
my last resort to try to figure out what <TripDatais about.

Any help that any body can provide would be gratefully appreciated.

Thanks,
Tony

======================================= XML DATA =============
<TripExportDataObject
xmlns="http://tempuri.org/TripExportDataObject.xsd"><Trip><TripID>17369</TripID><CurrentRevisionNumber>3</CurrentRevisionNumber><IsDispatch>false</IsDispatch><IsActive>false</IsActive><IsComplete>true</IsComplete><IsArchived>true</IsArchived><XVIN>67111377</XVIN><OrganizationID>1212</OrganizationID><UserDefinedRouteID>0000000000</UserDefinedRouteID><StartDate>2006-08-02T22:46:00.0000000-05:00</StartDate><EndDate>2006-08-03T10:00:00.0000000-05:00</EndDate><LastMessageDate>2006-08-03T10:06:22.1670000-05:00</LastMessageDate><TripType>Shop</TripType><TimeVariance>0</TimeVariance><DateLastModified>2006-08-03T10:06:22.0870000-05:00</DateLastModified><TripData>&lt;Trip
InternalElementID="1" TripType="Shop" Audited="False"
OrganizationID="1212"&gt;
&lt;Actual InternalElementID="2" UserDefinedRouteID="0000000000"
XVIN="67111377" FinalEventFileSequenceNumber="205" StartingStateID="42"
XAMTripToken="1154558803267" ContainsFirstEventGroup="True"
ContainsLastEventGroup="True" BegOdo="296311" EndOdo="296311"
BegFuel="12786.125" EndFuel="12786.25" BegDateTime="2006-08-02T22:46:00"
EndDateTime="2006-08-03T10:00:00" BegXSiteID="68284" BegLatitude="40190450"
BegLongitude="-74787700" EndXSiteID="68284" EndLatitude="40189850"
EndLongitude="-74787570" StartingRoadwayStatus="Taxable"&gt;
&lt;Stop InternalElementID="3" BegOdo="296311" EndOdo="296311"
BegFuel="12786.125" EndFuel="12786.25" BegDateTime="2006-08-02T22:46:00"
EndDateTime="2006-08-03T10:00:00" BegXSiteID="68284" BegLatitude="40190450"
BegLongitude="-74787700" EndXSiteID="68284" EndLatitude="40189850"
EndLongitude="-74787570" HasBegin="True" HasEnd="True" DriverInCharge="True"
DriverInChargeXDriverID="-1" XSiteID="68284" /&gt;
&lt;EventFiles InternalElementID="4" CloseReason="TripEnd"
StartedMoving="True" EndedMoving="False" StartedStateID="42"
EndedStateID="42" SequenceNumber="203" BegOdo="296302.1" EndOdo="296311"
BegFuel="12785.25" EndFuel="12786.125" BegDateTime="2006-08-02T22:27:00"
EndDateTime="2006-08-02T22:46:00" BegXSiteID="86436" BegLatitude="40096470"
BegLongitude="-74873680" EndXSiteID="68284" EndLatitude="40190450"
EndLongitude="-74787700"&gt;
&lt;DCSEventFileClose InternalElementID="5" CloseOdo="296311"
CloseHubo="83131.3" /&gt;
&lt;/EventFiles&gt;
&lt;EventFiles InternalElementID="6" CloseReason="NewDay"
StartedMoving="False" EndedMoving="False" StartedStateID="42"
EndedStateID="42" SequenceNumber="204" BegOdo="296311" EndOdo="296311"
BegFuel="12786.125" EndFuel="12786.125" BegDateTime="2006-08-02T22:46:00"
EndDateTime="2006-08-03T04:00:00" BegXSiteID="68284" BegLatitude="40190450"
BegLongitude="-74787700" EndXSiteID="68284" EndLatitude="40190450"
EndLongitude="-74787700"&gt;
&lt;DCSEventFileClose InternalElementID="7" CloseOdo="296311"
CloseHubo="83131.3" /&gt;
&lt;/EventFiles&gt;
&lt;EventFiles InternalElementID="8" CloseReason="LeavingStop"
StartedMoving="False" EndedMoving="True" StartedStateID="42"
EndedStateID="42" SequenceNumber="205" BegOdo="296311" EndOdo="296312.6"
BegFuel="12786.125" EndFuel="12786.375" BegDateTime="2006-08-03T04:00:00"
EndDateTime="2006-08-03T10:04:00" BegXSiteID="68284" BegLatitude="40190450"
BegLongitude="-74787700" EndLatitude="40181490" EndLongitude="-74809250"&gt;
&lt;DCSEventFileClose InternalElementID="9" CloseOdo="296312.7"
CloseHubo="83132.9" /&gt;
&lt;/EventFiles&gt;
&lt;/Actual&gt;
&lt;/Trip&gt;
</TripData></Trip><Trip><TripID>17333</TripID><CurrentRevisionNumber>10</CurrentRevisionNumber>

解决方案

"Tony Girgenti" <tony(nospam)@lakesideos.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

Hello.

I have attached the XML data in question at the end of this post.

I don''t understand what is between <TripDataand </TripData>. When i
talked to the publisher of the XML document, he says: "you will have to
use childattributes to access the attributes of the <TripDataelement".

When i try to iterate thru the XML document to determine the nodetype of
each element, it says that <TripDatais an Element of type #text.

I tried using XMLNODE, XMLTextReader and XPathNavigator. All methods say
that <TripDatais an element of #text. It does not have attributes and
it only has one child of #text.

I''m not an expert at this, so i read some XML books. I even reviewed them
and looked in the indexes for childattributes. As far as i have
determined, there is no such thing as childattributes.

<TripDatacontains the data that i want from this web service
consumption. How can i navigate thru it using the XPathNavigator class ?
I can navigate thru the rest of the XML without a problem.

This vendor is very hard to work with. It takes them days to reply to
emails. When you call their tech support for web services, they never
have anybody in the office that can answer web services questions. This
post is my last resort to try to figure out what <TripDatais about.

Any help that any body can provide would be gratefully appreciated.

Tony, it is a text node. It is a text node. Try taking the .InnerText and
using it to load a new XmlDocument by using XmlDocument.LoadXml.

John


Hello John.

I really appreciate your help with this, but i have been trying all weekend
to figure out how to do what you are suggesting.

As far as i can see the XmlDocument.LoadXml requires a string.

Any additional help that you can provide would be gratefully appreciated.

Thanks,
Tony

"John Saunders" <john.saunders at trizetto.comwrote in message
news:u6**************@TK2MSFTNGP02.phx.gbl...

"Tony Girgenti" <tony(nospam)@lakesideos.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

>Hello.

I have attached the XML data in question at the end of this post.

I don''t understand what is between <TripDataand </TripData>. When i
talked to the publisher of the XML document, he says: "you will have to
use childattributes to access the attributes of the <TripDataelement".

When i try to iterate thru the XML document to determine the nodetype of
each element, it says that <TripDatais an Element of type #text.

I tried using XMLNODE, XMLTextReader and XPathNavigator. All methods say
that <TripDatais an element of #text. It does not have attributes and
it only has one child of #text.

I''m not an expert at this, so i read some XML books. I even reviewed
them and looked in the indexes for childattributes. As far as i have
determined, there is no such thing as childattributes.

<TripDatacontains the data that i want from this web service
consumption. How can i navigate thru it using the XPathNavigator class ?
I can navigate thru the rest of the XML without a problem.

This vendor is very hard to work with. It takes them days to reply to
emails. When you call their tech support for web services, they never
have anybody in the office that can answer web services questions. This
post is my last resort to try to figure out what <TripDatais about.

Any help that any body can provide would be gratefully appreciated.


Tony, it is a text node. It is a text node. Try taking the .InnerText and
using it to load a new XmlDocument by using XmlDocument.LoadXml.

John



"Tony Girgenti" <tony(nospam)@lakesideos.comwrote in message
news:uH**************@TK2MSFTNGP05.phx.gbl...

Hello John.

I really appreciate your help with this, but i have been trying all
weekend to figure out how to do what you are suggesting.

As far as i can see the XmlDocument.LoadXml requires a string.

Any additional help that you can provide would be gratefully appreciated.

Tony, once you''ve got TripData in an XmlNode, say, tripData, try:

XmlDocument temp = new XmlDocument();
temp.LoadXml(tripData.InnerText);

Now, you can use temp.DocumentElement as the XML data from that node.

John


这篇关于XML数据有子属性吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆