469,602 Members | 1,838 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

how do you evalute a xpath query with xml tag like this <bac:BACne

i got xml file that have <bac:BACnetDevicesand <bac:BACnetDevicetag how
do you make a xpath query with that type of tags

this is the query that i come up with
/Site/Networks/Network/bac:BACnetDevices/bac:BACnetDevice/@InstanceNumber

but i got "undefined namespace prefix -'bac'" error
Jul 17 '06 #1
5 1872
What are you using to try to access the node in this XPath? Is this XSL or .NET? Is the bac namespace actually defined (i.e. xmlns:bac="something")?
--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Jul 17 '06 #2
hello, i'm using .Net XmlDocument withh xpath query to access the xml file,
yes the bac is point to http://www.teletrol.com/BACnet but the file is not
there. there is a xsd in the local hard disk.

is this the namespace binding?

thank you
"Greg Collins [Microsoft MVP]" wrote:
What are you using to try to access the node in this XPath? Is this XSL or .NET? Is the bac namespace actually defined (i.e. xmlns:bac="something")?
--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Jul 18 '06 #3
i use XMLSPY to evaluate the xpath query before i use it in my code. i use
VB.net w/Visual Studio.net 2005. if i add a nameperfix in the InstanceNumber
node bac:InstanceNumber then this query will work

/Site/Networks/Network/bac:BACnetDevices/bac:BACnetDevice/@bac:InstanceNumber

how do i get the value of InstanceNumber without adding "bac:" to the
InstanceNumber node on the xml file.

here is the xml file that i'm working with

<Site InstanceNumber="7415">
<ActionGroups/>
<Bookmarks AllowCreate="1" AllowDelete="1">
<Bookmark Name="HomePage" Path="800.7415_316.11_311.1094"/>
</Bookmarks>
<EquipmentCatalogs AllowCreate="0" AllowDelete="1" AllowRename="0">
<EquipmentCatalog InstanceNumber="133">
<GeneralProperties Attr="1" InstanceNumber="133" IsConfigured="0"
ObjectName="H280_Strake_Jesuit" ObjectType="317" SchemaVer="1.4"
TraceOptions="0">
<Description/>
</GeneralProperties>
</EquipmentCatalog>
</EquipmentCatalogs>
<GeneralProperties Attr="1" InstanceNumber="7415" IsConfigured="0"
ObjectName="H280_Strake_Jesuit" ObjectType="800" SchemaVer="1.4"
TraceOptions="0">
<Description><![CDATA[eBuilding Main Site]]></Description>
</GeneralProperties>
<Networks>
<Network InstanceNumber="101">
<bac:BACnetDevices xmlns:bac="http://www.teletrol.com/BACnet">
<bac:BACnetDevice APDUTimeout="" ApplicationSoftwareVersion=""
FirmwareRevision="" InstanceNumber="3744" MaxAPDULengthAccepted=""
ModelName="" NumberOfAPDURetries="" ProtocolConformanceClass=""
ProtocolObjectTypesSupported="" ProtocolServicesSupported=""
ProtocolVersion="" SegmentationSupported="" VendorIdentifier="" VendorName="">
<GeneralProperties Attr="1" InstanceNumber="3744" IsConfigured="0"
ObjectName="Building_1" ObjectType="8" SchemaVer="1.4" TraceOptions="0">
<Description/>
</GeneralProperties>
</bac:BACnetDevice>
</bac:BACnetDevices>
<GeneralProperties Attr="0" InstanceNumber="101" IsConfigured="0"
ObjectName="Network" ObjectType="801" SchemaVer="1.4" TraceOptions="">
<Description/>
</GeneralProperties>
<NetworkControllers>
<NetworkController InstanceNumber="115" InternalType="10">
<GeneralProperties Attr="1" InstanceNumber="115" IsConfigured="1"
ObjectName="H280_Strake_Jesuit_Plant" ObjectType="8" SchemaVer="1.4"
TraceOptions="0">
<Description><![CDATA[Teletrol Systems, Inc. eBuilding Network
Controller model 110]]></Description>
</GeneralProperties>
</NetworkController>
<NetworkController InstanceNumber="116" InternalType="10">
<GeneralProperties Attr="1" InstanceNumber="116" IsConfigured="1"
ObjectName="H280_Strake_Jesuit_Ahu" ObjectType="8" SchemaVer="1.4"
TraceOptions="0">
<Description><![CDATA[Teletrol Systems, Inc. eBuilding Network
Controller model 110]]></Description>
</GeneralProperties>
</NetworkController>
<NetworkController InstanceNumber="1264" InternalType="10">
<GeneralProperties Attr="1" InstanceNumber="1264" IsConfigured="0"
ObjectName="H280_Strake_Jesuit_FH" ObjectType="8" SchemaVer="1.4"
TraceOptions="0">
<Description><![CDATA[Teletrol Systems, Inc. eBuilding Network
Controller model 120. (Field House controller)
]]></Description>
</GeneralProperties>
</NetworkController>
<NetworkController InstanceNumber="3764" InternalType="10">
<GeneralProperties Attr="1" InstanceNumber="3764" IsConfigured="0"
ObjectName="eNC_Model_130" ObjectType="8" SchemaVer="1.4" TraceOptions="0">
<Description><![CDATA[Teletrol Systems, Inc. eBuilding Network
Controller model 130]]></Description>
</GeneralProperties>
</NetworkController>
</NetworkControllers>
<NetworkProperties NetworkNumber="1" ProtocolName="">
<Description/>
<PropertiesEx/>
</NetworkProperties>
</Network>
</Networks>
<Queries/>
<SharedObjects/>
<SiteProperties IpAddress="" NextInstanceNumber="3771" SiteServerVersion=""/>
<Facility FacilityIndexURL="" IndexPageURL="" InstanceNumber="11"
minimizedMenu="0" showAlarmIcon="1" showMenu="1" showSaveIcon="1">
<GeneralProperties Attr="1" InstanceNumber="11" IsConfigured="0"
ObjectName="Facility" ObjectType="316" SchemaVer="1.4" TraceOptions="">
<Description><![CDATA[Set of Facility Pages]]></Description>
</GeneralProperties>
</Facility>
<Globals InstanceNumber="3">
<GeneralProperties Attr="1" InstanceNumber="3" IsConfigured="0"
ObjectName="Globals" ObjectType="201" SchemaVer="1.4" TraceOptions="0">
<Description><![CDATA[Location for all Global System
Objects]]></Description>
</GeneralProperties>
</Globals>
</Site>
"dotnetnoob" wrote:
i got xml file that have <bac:BACnetDevicesand <bac:BACnetDevicetag how
do you make a xpath query with that type of tags

this is the query that i come up with
/Site/Networks/Network/bac:BACnetDevices/bac:BACnetDevice/@InstanceNumber

but i got "undefined namespace prefix -'bac'" error
Jul 18 '06 #4
i got it. by using namespace manager the xpath query work in my VB.net code.

"dotnetnoob" wrote:
i got xml file that have <bac:BACnetDevicesand <bac:BACnetDevicetag how
do you make a xpath query with that type of tags

this is the query that i come up with
/Site/Networks/Network/bac:BACnetDevices/bac:BACnetDevice/@InstanceNumber

but i got "undefined namespace prefix -'bac'" error
Jul 18 '06 #5
Glad you got it working!

--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Jul 19 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by gfrommer | last post: by
2 posts views Thread by R | last post: by
2 posts views Thread by David Gordon | last post: by
3 posts views Thread by IMS.Rushikesh | last post: by
2 posts views Thread by dc | last post: by
reply views Thread by dotnetnoob | last post: by
2 posts views Thread by Claudio | last post: by
3 posts views Thread by Jason Mobarak | last post: by
2 posts views Thread by =?Utf-8?B?RGlmZmlkZW50?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.