i got xml file that have <bac:BACnetDevices> and <bac:BACnetDevice> tag 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
Greg Collins [Microsoft MVP] - 17 Jul 2006 23:33 GMT
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")?

Signature
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
dotnetnoob - 18 Jul 2006 05:13 GMT
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
> 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")?
dotnetnoob - 18 Jul 2006 16:50 GMT
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>
> i got xml file that have <bac:BACnetDevices> and <bac:BACnetDevice> tag how
> do you make a xpath query with that type of tags
[quoted text clipped - 3 lines]
>
> but i got "undefined namespace prefix -'bac'" error
dotnetnoob - 18 Jul 2006 22:31 GMT
i got it. by using namespace manager the xpath query work in my VB.net code.
> i got xml file that have <bac:BACnetDevices> and <bac:BACnetDevice> tag how
> do you make a xpath query with that type of tags
[quoted text clipped - 3 lines]
>
> but i got "undefined namespace prefix -'bac'" error
Greg Collins [Microsoft MVP] - 19 Jul 2006 18:49 GMT
Glad you got it working!

Signature
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )